rust/tests/ui/mir/dyn_metadata_sroa.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
370 B
Rust
Raw Normal View History

2024-05-24 02:40:39 -05:00
//@ run-pass
//@ compile-flags: -Zmir-opt-level=5 -Zvalidate-mir
#![feature(ptr_metadata)]
// Regression for <https://github.com/rust-lang/rust/issues/125506>,
// which failed because of SRoA would project into `DynMetadata`.
trait Foo {}
struct Bar;
impl Foo for Bar {}
fn main() {
let a: *mut dyn Foo = &mut Bar;
let _d = a.to_raw_parts().0 as usize;
}