pub fn crate_root(span: Span) -> Self {
PathSegment {
identifier: Ident { ctxt: span.ctxt, ..keywords::CrateRoot.ident() },
- span: span,
+ span,
parameters: None,
}
}
where_clause: WhereClause {
id: DUMMY_NODE_ID,
predicates: Vec::new(),
+ span: DUMMY_SP,
},
span: DUMMY_SP,
}
pub struct WhereClause {
pub id: NodeId,
pub predicates: Vec<WherePredicate>,
+ pub span: Span,
}
/// A single predicate in a `where` clause
TupleStruct(Path, Vec<P<Pat>>, Option<usize>),
/// A possibly qualified path pattern.
- /// Unquailfied path patterns `A::B::C` can legally refer to variants, structs, constants
- /// or associated constants. Quailfied path patterns `<A>::B::C`/`<A as Trait>::B::C` can
+ /// Unqualified path patterns `A::B::C` can legally refer to variants, structs, constants
+ /// or associated constants. Qualified path patterns `<A>::B::C`/`<A as Trait>::B::C` can
/// only legally refer to associated constants.
Path(Option<QSelf>, Path),
};
self
}
+
+ pub fn is_item(&self) -> bool {
+ match self.node {
+ StmtKind::Local(_) => true,
+ _ => false,
+ }
+ }
}
impl fmt::Debug for Stmt {
let infer_ty = P(Ty {
id: DUMMY_NODE_ID,
node: TyKind::ImplicitSelf,
- span: span,
+ span,
});
let arg = |mutbl, ty| Arg {
pat: P(Pat {
id: DUMMY_NODE_ID,
node: PatKind::Ident(BindingMode::ByValue(mutbl), eself_ident, None),
- span: span,
+ span,
}),
- ty: ty,
+ ty,
id: DUMMY_NODE_ID,
};
match eself.node {
SelfKind::Region(lt, mutbl) => arg(Mutability::Immutable, P(Ty {
id: DUMMY_NODE_ID,
node: TyKind::Rptr(lt, MutTy { ty: infer_ty, mutbl: mutbl }),
- span: span,
+ span,
})),
}
}
PolyTraitRef {
bound_lifetimes: lifetimes,
trait_ref: TraitRef { path: path, ref_id: DUMMY_NODE_ID },
- span: span,
+ span,
}
}
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub enum ItemKind {
- /// An`extern crate` item, with optional original crate name.
+ /// An `extern crate` item, with optional original crate name.
///
/// E.g. `extern crate foo` or `extern crate foo_bar as foo`
ExternCrate(Option<Name>),