summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-23433.rs
blob: d4fbbde62ffa5d8d87602082ce9294f3c07629eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// run-pass
// Don't fail if we encounter a NonNull<T> where T is an unsized type

use std::ptr::NonNull;

fn main() {
    let mut a = [0u8; 5];
    let b: Option<NonNull<[u8]>> = Some(NonNull::from(&mut a));
    match b {
        Some(_) => println!("Got `Some`"),
        None => panic!("Unexpected `None`"),
    }
}