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
|
2019-11-13 16:16:56 -06:00
|
|
|
//~| expected enum `std::option::Option<&[&str]>`
|
|
|
|
//~| found enum `std::option::Option<&[&str; 1]>`
|
2019-11-15 01:45:30 -06:00
|
|
|
//~| expected slice `[&str]`, found array `[&str; 1]`
|
2014-09-11 17:54:44 -05:00
|
|
|
assert_eq!(msg, 3);
|
|
|
|
}
|