Skip to content

Commit a02b1d7

Browse files
committed
Add some docs + Fix rebase
1 parent 636357b commit a02b1d7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/libsyntax/ast.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1877,13 +1877,19 @@ pub struct Variant_ {
18771877

18781878
pub type Variant = Spanned<Variant_>;
18791879

1880+
/// Part of `use` item to the right of its prefix.
18801881
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
18811882
pub enum UseTreeKind {
1883+
/// `use prefix` or `use prefix as rename`
18821884
Simple(Option<Ident>),
1885+
/// `use prefix::{...}`
18831886
Nested(Vec<(UseTree, NodeId)>),
1887+
/// `use prefix::*`
18841888
Glob,
18851889
}
18861890

1891+
/// A tree of paths sharing common prefixes.
1892+
/// Used in `use` items both at top-level and inside of braces in import groups.
18871893
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
18881894
pub struct UseTree {
18891895
pub prefix: Path,

src/libsyntax/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1438,7 +1438,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
14381438
}
14391439

14401440
fn visit_use_tree(&mut self, use_tree: &'a ast::UseTree, id: NodeId, _nested: bool) {
1441-
if let ast::UseTreeKind::Simple(ident) = use_tree.kind {
1441+
if let ast::UseTreeKind::Simple(Some(ident)) = use_tree.kind {
14421442
if ident.name == "_" {
14431443
gate_feature_post!(&self, underscore_imports, use_tree.span,
14441444
"renaming imports with `_` is unstable");

0 commit comments

Comments
 (0)