Rollup merge of #104315 - SparkyPotato:fix-104276, r=cjgillot
Improve spans with `use crate::{self}` Fixes #104276. The error becomes: ``` error: crate root imports need to be explicitly named: `use crate as name;` --> src/lib.rs.rs:1:13 | 1 | use crate::{self}; | ^^^^ warning: unused import: `self` --> src/lib.rs:1:13 | 1 | use crate::{self}; | ^^^^ | = note: `#[warn(unused_imports)]` on by default ```
This commit is contained in:
commit
5c764da9b0
3 changed files with 15 additions and 1 deletions
|
@ -469,9 +469,11 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
|
|||
}
|
||||
|
||||
// Replace `use foo::{ self };` with `use foo;`
|
||||
let self_span = source.ident.span;
|
||||
source = module_path.pop().unwrap();
|
||||
if rename.is_none() {
|
||||
ident = source.ident;
|
||||
// Keep the span of `self`, but the name of `foo`
|
||||
ident = Ident { name: source.ident.name, span: self_span };
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue