Closed
Description
When I do try!(file.metadata()).mtime()
without MetadataExt
in scope, the compiler suggests that I import std::sys::ext::fs::MetadataExt
. It does not suggest any other candidates:
<anon>:17:15: 17:22 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:
<anon>:17:15: 17:22 help: candidate #1: use `std::sys::ext::fs::MetadataExt`
error: aborting due to previous error
But that trait is private, so a use
of it will not work.
It turns out that I can do use std::os::unix::fs::MetadataExt;
(which I assume is an alternative path to the same trait), and that path is publicly accessible.
playpen demo: https://play.rust-lang.org/?gist=557a8c49fbf072db1033&version=nightly
(This is related to #25358 but is not a dupe of it; that bug is about the suggestion of traits to implement, while this bug is about the suggestion of traits to pull into scope via use
)
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Name/path resolution done by `rustc_resolve` specificallyArea: Suggestions generated by the compiler applied by `cargo fix`Category: This is a bug.Diagnostics: Confusing error or lint; hard to understand for new users.Relevant to the compiler team, which will review and decide on the PR/issue.