2015-01-08 11:02:42 +00:00
|
|
|
pub fn foo(params: Option<&[&str]>) -> usize {
|
2015-01-02 07:53:35 +00:00
|
|
|
params.unwrap().first().unwrap().len()
|
2014-09-11 22:54:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let name = "Foo";
|
2015-02-02 02:53:25 +00:00
|
|
|
let x = Some(&[name]);
|
2015-01-08 16:39:17 +00:00
|
|
|
let msg = foo(x);
|
2019-09-06 18:21:26 +00:00
|
|
|
//~^ ERROR mismatched types
|
2020-09-02 07:40:56 +00:00
|
|
|
//~| expected enum `Option<&[&str]>`
|
|
|
|
//~| found enum `Option<&[&str; 1]>`
|
2023-01-03 02:00:33 +00:00
|
|
|
//~| expected `Option<&[&str]>`, found `Option<&[&str; 1]>`
|
2014-09-11 22:54:44 +00:00
|
|
|
assert_eq!(msg, 3);
|
|
|
|
}
|