You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Miscompilation of a program projecting field of an extern type #127336
Since #118534 projecting a field of an extern type at non-zero offset panics. MIR transformations do not understand this:
$ cat a.rs#![feature(extern_types)]extern "C" { type Opaque;}fn main() { let a = [0u8; 1]; let b: &(u8, Opaque) = unsafe { &*(&a as *const _ as *const (u8, Opaque)) }; let _ = &b.1;}
$ rustc a.rs -Zmir-opt-level=1 && ./a
$ rustc a.rs -Zmir-opt-level=0 && ./athread 'main' panicked at library/core/src/panicking.rs:221:5:attempted to compute the size or alignment of extern type `Opaque`note: run with `RUST_BACKTRACE=1` environment variable to display a backtracethread caused non-unwinding panic. aborting.Aborted
Activity