rust/tests/ui/cast/issue-89497.fixed

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

11 lines
276 B
Rust
Raw Normal View History

// Regression test for issue #89497.
// run-rustfix
fn main() {
let pointer: usize = &1_i32 as *const i32 as usize;
let _reference: &'static i32 = unsafe { &*(pointer as *const i32) };
//~^ ERROR: non-primitive cast
//~| HELP: consider borrowing the value
}