mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
ast_lowering: Fix regression in use ::{}
imports.
This commit is contained in:
parent
8fb67fb37f
commit
8b6b9c5efc
@ -569,7 +569,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
||||
});
|
||||
}
|
||||
|
||||
let path = if trees.is_empty() && !prefix.segments.is_empty() {
|
||||
// Condition should match `build_reduced_graph_for_use_tree`.
|
||||
let path = if trees.is_empty()
|
||||
&& !(prefix.segments.is_empty()
|
||||
|| prefix.segments.len() == 1
|
||||
&& prefix.segments[0].ident.name == kw::PathRoot)
|
||||
{
|
||||
// For empty lists we need to lower the prefix so it is checked for things
|
||||
// like stability later.
|
||||
let res = self.lower_import_res(id, span);
|
||||
|
10
tests/ui/imports/empty-import-prefix-pass-2015.rs
Normal file
10
tests/ui/imports/empty-import-prefix-pass-2015.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// check-pass
|
||||
// edition:2015
|
||||
|
||||
use {};
|
||||
use {{}};
|
||||
|
||||
use ::{};
|
||||
use {::{}};
|
||||
|
||||
fn main() {}
|
10
tests/ui/imports/empty-import-prefix-pass.rs
Normal file
10
tests/ui/imports/empty-import-prefix-pass.rs
Normal file
@ -0,0 +1,10 @@
|
||||
// check-pass
|
||||
// edition:2018
|
||||
|
||||
use {};
|
||||
use {{}};
|
||||
|
||||
use ::{};
|
||||
use {::{}};
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user