2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
2018-02-16 11:02:06 +01:00
|
|
|
// Don't fail if we encounter a NonNull<T> where T is an unsized type
|
2015-04-25 04:20:08 -04:00
|
|
|
|
2017-12-22 19:29:16 +01:00
|
|
|
use std::ptr::NonNull;
|
2015-04-25 04:20:08 -04:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let mut a = [0u8; 5];
|
2017-12-22 19:29:16 +01:00
|
|
|
let b: Option<NonNull<[u8]>> = Some(NonNull::from(&mut a));
|
2015-04-25 04:20:08 -04:00
|
|
|
match b {
|
|
|
|
Some(_) => println!("Got `Some`"),
|
|
|
|
None => panic!("Unexpected `None`"),
|
|
|
|
}
|
|
|
|
}
|