rust/tests/ui/issues/issue-15783.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
380 B
Rust
Raw Normal View History

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);
2019-09-06 18:21:26 +00:00
//~^ ERROR mismatched types
//~| expected enum `Option<&[&str]>`
//~| found enum `Option<&[&str; 1]>`
//~| expected `Option<&[&str]>`, found `Option<&[&str; 1]>`
assert_eq!(msg, 3);
}