summaryrefslogtreecommitdiffstats
path: root/tests/ui/issues/issue-15783.rs
blob: 0b1f4545e88043e7ec958713ecce0d8e1ac1c75e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub fn foo(params: Option<&[&str]>) -> usize {
    params.unwrap().first().unwrap().len()
}

fn main() {
    let name = "Foo";
    let x = Some(&[name]);
    let msg = foo(x);
    //~^ ERROR mismatched types
    //~| expected enum `Option<&[&str]>`
    //~| found enum `Option<&[&str; 1]>`
    //~| expected slice `[&str]`, found array `[&str; 1]`
    assert_eq!(msg, 3);
}