Closed
Description
Code
#![feature(extern_types)]
extern "C" {
type Content;
}
pub struct List {
len: usize,
_opaque: Content,
}
pub fn main() {
let _len = match Option::<&List>::None {
Some(a) => a.len,
None => 0,
};
}
Meta
rustc 1.59.0-nightly (928783de6 2021-12-11)
Error output
error: internal compiler error: /rustc/928783de663bd855a96f14b2d38c1061603587c6/compiler/rustc_const_eval/src/interpret/eval_context.rs:627:33: Fields cannot be extern types, unless they are at offset 0
--> a.rs:13:22
|
13 | let _len = match Option::<&List>::None {
| ^^^^^^^^^^^^^^^^^^^^^
thread 'rustc' panicked at 'Box<dyn Any>', /rustc/928783de663bd855a96f14b2d38c1061603587c6/compiler/rustc_errors/src/lib.rs:1116:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.59.0-nightly (928783de6 2021-12-11) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [optimized_mir] optimizing MIR for `main`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.`#![feature(extern_types)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.This issue requires a nightly compiler in some way.