2019-02-28 07:32:13 +01:00
|
|
|
use std::ptr::NonNull;
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x: &'static NonNull<u32> = &(NonNull::dangling());
|
2019-04-22 08:40:08 +01:00
|
|
|
//~^ ERROR temporary value dropped while borrowed
|
2019-02-28 07:32:13 +01:00
|
|
|
|
|
|
|
let mut i: i32 = 10;
|
|
|
|
let non_null = NonNull::new(&mut i).unwrap();
|
|
|
|
let x: &'static NonNull<u32> = &(non_null.cast());
|
2019-04-22 08:40:08 +01:00
|
|
|
//~^ ERROR temporary value dropped while borrowed
|
2019-02-28 07:32:13 +01:00
|
|
|
}
|