]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/suggest-borrow-to-dyn-object.rs
Rollup merge of #107477 - GuillaumeGomez:css-var, r=notriddle
[rust.git] / tests / ui / suggestions / suggest-borrow-to-dyn-object.rs
1 use std::ffi::{OsStr, OsString};
2 use std::path::Path;
3
4 fn check(p: &dyn AsRef<Path>) {
5     let m = std::fs::metadata(&p);
6     println!("{:?}", &m);
7 }
8
9 fn main() {
10     let s: OsString = ".".into();
11     let s: &OsStr = &s;
12     check(s);
13     //~^ ERROR the size for values of type `[u8]` cannot be known at compilation time
14     //~| HELP within `OsStr`, the trait `Sized` is not implemented for `[u8]`
15     //~| HELP consider borrowing the value, since `&OsStr` can be coerced into `dyn AsRef<Path>`
16 }