Closed
Description
struct Baz<T: ?Sized> {
a: T
}
fn main() {
let d : Baz<[i32; 4]> = Baz { a: [1,2,3,4] };
assert_eq!([1, 2, 3, 4], d.a);
}
$ rustc -V
rustc 1.42.0-nightly (fc5deca21 2019-12-21)
$ rustc example/dst-field-align.rs && ./dst-field-align
$ rustc -Zmir-opt-level=2 example/dst-field-align.rs && ./dst-field-align
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `[1, 2, 3, 4]`,
right: `[0, 0, 0, 0]`', example/dst-field-align.rs:10:5
struct Baz<T: ?Sized> {
a: T
}
fn main() {
let d : Baz<[i32; 4]> = Baz { a: [1,2,3,4] };
println!("{:?}", d.a);
}
$ rustc example/dst-field-align.rs && ./dst-field-align
[1, 2, 3, 4]
$ rustc -Zmir-opt-level=2 example/dst-field-align.rs && ./dst-field-align
[0, 0, 0, 0]
This issue has been assigned to @jumbatm via this comment.
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlCategory: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessRelevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.