Implement RFC 2128 (use_nested_groups)
This commit adds support for nested groups inside `use` declarations,
such as `use foo::{bar, sub::{baz::Foo, *}};`.
This commit is contained in:
@@ -13,7 +13,7 @@ use attr;
|
||||
use ext::hygiene::{Mark, SyntaxContext};
|
||||
use symbol::{Symbol, keywords};
|
||||
use syntax_pos::{DUMMY_SP, Span};
|
||||
use codemap::{self, ExpnInfo, NameAndSpan, MacroAttribute};
|
||||
use codemap::{ExpnInfo, NameAndSpan, MacroAttribute};
|
||||
use ptr::P;
|
||||
use tokenstream::TokenStream;
|
||||
|
||||
@@ -75,12 +75,16 @@ pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option<Strin
|
||||
span,
|
||||
}],
|
||||
vis: ast::Visibility::Inherited,
|
||||
node: ast::ItemKind::Use(P(codemap::dummy_spanned(ast::ViewPathGlob(ast::Path {
|
||||
segments: ["{{root}}", name, "prelude", "v1"].into_iter().map(|name| {
|
||||
ast::PathSegment::from_ident(ast::Ident::from_str(name), DUMMY_SP)
|
||||
}).collect(),
|
||||
node: ast::ItemKind::Use(P(ast::UseTree {
|
||||
prefix: ast::Path {
|
||||
segments: ["{{root}}", name, "prelude", "v1"].into_iter().map(|name| {
|
||||
ast::PathSegment::from_ident(ast::Ident::from_str(name), DUMMY_SP)
|
||||
}).collect(),
|
||||
span,
|
||||
},
|
||||
kind: ast::UseTreeKind::Glob,
|
||||
span,
|
||||
})))),
|
||||
})),
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
ident: keywords::Invalid.ident(),
|
||||
span,
|
||||
|
||||
Reference in New Issue
Block a user