mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
62ba3e70a1
The previous output was unintuitive to users.
14 lines
380 B
Rust
14 lines
380 B
Rust
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 `Option<&[&str]>`, found `Option<&[&str; 1]>`
|
|
assert_eq!(msg, 3);
|
|
}
|