Skip to content

internal compiler error with a unknown value in a slice #28670

Closed
@adjivas

Description

@adjivas

struct with unknow value from enum in slice variable

I tried this code:

#[repr(C)]
#[derive(Copy, Clone)]
pub enum Ipc {
  CREAT = 0o0001000, // POSIX
  NOWAIT = 2048, // POSIX
}

pub struct MsgBuf {
  pub mtype: u32,
  pub mtext: [u8; Ipc::MSG_BUFF as usize], // <- The error is Ipc::MSG_BUFF, this variable not exist.
}

fn main() {
}

I expected to see this happen:

error: unresolved name `MSG_BUFF`

Instead, this happened:

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'path not fully resolved: PathResolution { base_def: DefTy(DefId { krate: 0, node: 4 }Ipc, true), last_private: LastMod(AllPublic), depth: 1 }', ../src/librustc/middle/def.rs:80


playpen: application terminated with error code 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions