-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I made a typo text -> test and got a very strange suggestion.
use std::{fs, io::Read};
fn foo() {
let mut f = fs::File::new("hello");
let mut text = String::new();
f.read_to_string(&mut test).unwrap();
}
The current output is:
Standard Error
Compiling playground v0.0.1 (/playground)
error[E0423]: expected value, found attribute macro `test`
--> src/lib.rs:6:27
|
6 | f.read_to_string(&mut test).unwrap();
| ^^^^
|
help: a local variable with a similar name exists
|
6 | f.read_to_string(&mut text).unwrap();
| ^^^^
help: consider importing one of these items instead
|
1 | use crate::fs::io::sys::ext::net::raw_fd::sys_common::backtrace::backtrace_rs::symbolize::gimli::mystd::detect::bit::test;
|
1 | use crate::fs::io::sys::ext::net::raw_fd::sys_common::backtrace::backtrace_rs::symbolize::gimli::mystd::detect::cache::test;
|
The import suggestions here are kind of nonsense.
(They are only suggested if fs
is imported.)
It seems like "consider importing one of these items instead" shouldn't suggest private items, at the very least in the case of external crates.
(For the current crate, maybe you wanted one of your own items to be available, but those should still probably be called out as being private items?)
jfrimmel and bluss
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.