Add some docs + Fix rebase

This commit is contained in:
Vadim Petrochenkov 2018-03-12 23:16:09 +03:00
parent 636357b09a
commit a02b1d7e2b
2 changed files with 7 additions and 1 deletions

View file

@ -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,

View file

@ -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");