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