move span to self
instead of crate
This commit is contained in:
parent
825f8edc2f
commit
c7b2891315
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 {
|
||||
|
|
4
src/test/ui/use/use-crate-self.rs
Normal file
4
src/test/ui/use/use-crate-self.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
use crate::{self};
|
||||
//~^ ERROR crate root imports need to be explicitly named: `use crate as name;`
|
||||
|
||||
fn main() {}
|
8
src/test/ui/use/use-crate-self.stderr
Normal file
8
src/test/ui/use/use-crate-self.stderr
Normal file
|
@ -0,0 +1,8 @@
|
|||
error: crate root imports need to be explicitly named: `use crate as name;`
|
||||
--> $DIR/use-crate-self.rs:1:13
|
||||
|
|
||||
LL | use crate::{self};
|
||||
| ^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue