Closed
Description
If there is a list import with use path::{...};
with a wrong path, Rust is giving wrong suggestions for that path, it suggests a semicolon. E.g. for this code:
use std::collections::{HashMap, Entry};
It prints:
error[E0432]: unresolved import `std::collections::Entry`
--> src/lib.rs:1:33
|
1 | use std::collections::{HashMap, Entry};
| ^^^^^ no `Entry` in `collections`
|
help: consider importing one of these items instead
|
1 | use std::collections::{HashMap, hashbrown::hash_map::Entry;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 | use std::collections::{HashMap, hashbrown::hash_set::Entry;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 | use std::collections::{HashMap, hashlink::lru_cache::Entry;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 | use std::collections::{HashMap, http::header::Entry;
| ~~~~~~~~~~~~~~~~~~~~
and 14 other candidates
You can't use a semicolon here however, you have to use a comma. Also, it suggests absolute paths, while it should take into account that we are looking for sub-paths of std::collections
.
It should suggest code like:
use std::collections::{HashMap, hash_map::Entry};
use std::collections::{HashMap, btree_map::Entry};
@rustbot label A-diagnostics