diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-03-12 23:16:09 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2018-03-17 22:29:15 +0300 |
| commit | a02b1d7e2bd329bee0ad2f6a3e281c2004325540 (patch) | |
| tree | 218af564850700e4f8a2a1d8ee04c18458384d84 /src/libsyntax | |
| parent | 636357b09a638661d1ed1473738038d8caa9a02e (diff) | |
| download | rust-a02b1d7e2bd329bee0ad2f6a3e281c2004325540.tar.gz rust-a02b1d7e2bd329bee0ad2f6a3e281c2004325540.zip | |
Add some docs + Fix rebase
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast.rs | 6 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index eef7a6f8b4d..1f16b728cd2 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -1877,13 +1877,19 @@ pub struct Variant_ { pub type Variant = Spanned<Variant_>; +/// Part of `use` item to the right of its prefix. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub enum UseTreeKind { + /// `use prefix` or `use prefix as rename` Simple(Option<Ident>), + /// `use prefix::{...}` Nested(Vec<(UseTree, NodeId)>), + /// `use prefix::*` Glob, } +/// A tree of paths sharing common prefixes. +/// Used in `use` items both at top-level and inside of braces in import groups. #[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)] pub struct UseTree { pub prefix: Path, diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index f42cb8a2583..0aef5045341 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1438,7 +1438,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { } fn visit_use_tree(&mut self, use_tree: &'a ast::UseTree, id: NodeId, _nested: bool) { - if let ast::UseTreeKind::Simple(ident) = use_tree.kind { + if let ast::UseTreeKind::Simple(Some(ident)) = use_tree.kind { if ident.name == "_" { gate_feature_post!(&self, underscore_imports, use_tree.span, "renaming imports with `_` is unstable"); |
