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