Closed
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?)