You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using rustc 1.15.1 (021bd294c 2017-02-08), installed with rustup on Arch Linux
Here is code:
// use std::os::ext::fs::MetadataExt;fnmain(){let file = std::fs::File::open("/dev/null").unwrap();let metadata = file.metadata().unwrap();println!("{:?}", metadata.mode());}
When I try to compile this, I get
error: no method named `mode` found for type `std::fs::Metadata` in the current scope
--> src/main.rs:9:31
|
9 | println!("{:?}", metadata.mode());
| ^^^^
|
= help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
= help: candidate #1: `use std::os::ext::fs::MetadataExt;`
but when I uncomment first line, I get
error[E0432]: unresolved import `std::os::ext::fs::MetadataExt`
--> src/main.rs:3:5
|
3 | use std::os::ext::fs::MetadataExt;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `ext` in `os`
The solution is to use std::os::linux::fs::MetadataExt; and then use st_mode() instead of mode() but that's not good. Compiler must not give me bad advices.
The text was updated successfully, but these errors were encountered:
I am using
rustc 1.15.1 (021bd294c 2017-02-08)
, installed withrustup
on Arch LinuxHere is code:
When I try to compile this, I get
but when I uncomment first line, I get
The solution is to
use std::os::linux::fs::MetadataExt;
and then usest_mode()
instead ofmode()
but that's not good. Compiler must not give me bad advices.The text was updated successfully, but these errors were encountered: