about summary refs log tree commit diff
path: root/src/libsyntax/std_inject.rs
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2017-09-26 23:04:00 +0200
committerPietro Albini <pietro@pietroalbini.org>2017-11-30 13:10:26 +0100
commit91ba8b42fcce0491fa8a1b95e4088bcabf9abf4a (patch)
tree8816e095bc7a534e8d9ecbe542a5e640d35b6c2c /src/libsyntax/std_inject.rs
parentd6b010f98beae1591ea6e8e21008de97d6cf5be4 (diff)
downloadrust-91ba8b42fcce0491fa8a1b95e4088bcabf9abf4a.tar.gz
rust-91ba8b42fcce0491fa8a1b95e4088bcabf9abf4a.zip
Implement RFC 2128 (use_nested_groups)
This commit adds support for nested groups inside `use` declarations,
such as `use foo::{bar, sub::{baz::Foo, *}};`.
Diffstat (limited to 'src/libsyntax/std_inject.rs')
-rw-r--r--src/libsyntax/std_inject.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs
index 7aa94de9d3d..ae22230198f 100644
--- a/src/libsyntax/std_inject.rs
+++ b/src/libsyntax/std_inject.rs
@@ -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,