]> git.proxmox.com Git - rustc.git/blob - src/test/ui/suggestions/suggest-borrow-to-dyn-object.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / 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 }