Remove most of Hash
impls from AST and HIR structures
This commit is contained in:
parent
4d1a30c92b
commit
5987fe8f75
7 changed files with 208 additions and 210 deletions
|
@ -172,7 +172,7 @@ pub const DUMMY_HIR_ID: HirId = HirId {
|
||||||
|
|
||||||
pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId(!0);
|
pub const DUMMY_ITEM_LOCAL_ID: ItemLocalId = ItemLocalId(!0);
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
|
||||||
pub struct Label {
|
pub struct Label {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ impl fmt::Debug for Label {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
|
||||||
pub struct Lifetime {
|
pub struct Lifetime {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -312,7 +312,7 @@ impl Lifetime {
|
||||||
/// A "Path" is essentially Rust's notion of a name; for instance:
|
/// A "Path" is essentially Rust's notion of a name; for instance:
|
||||||
/// `std::cmp::PartialEq`. It's represented as a sequence of identifiers,
|
/// `std::cmp::PartialEq`. It's represented as a sequence of identifiers,
|
||||||
/// along with a bunch of supporting information.
|
/// along with a bunch of supporting information.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
/// The definition that the path resolved to.
|
/// The definition that the path resolved to.
|
||||||
|
@ -341,7 +341,7 @@ impl fmt::Display for Path {
|
||||||
|
|
||||||
/// A segment of a path: an identifier, an optional lifetime, and a set of
|
/// A segment of a path: an identifier, an optional lifetime, and a set of
|
||||||
/// types.
|
/// types.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct PathSegment {
|
pub struct PathSegment {
|
||||||
/// The identifier portion of this path segment.
|
/// The identifier portion of this path segment.
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -396,7 +396,7 @@ impl PathSegment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum GenericArg {
|
pub enum GenericArg {
|
||||||
Lifetime(Lifetime),
|
Lifetime(Lifetime),
|
||||||
Type(Ty),
|
Type(Ty),
|
||||||
|
@ -411,7 +411,7 @@ impl GenericArg {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct GenericArgs {
|
pub struct GenericArgs {
|
||||||
/// The generic arguments for this path segment.
|
/// The generic arguments for this path segment.
|
||||||
pub args: HirVec<GenericArg>,
|
pub args: HirVec<GenericArg>,
|
||||||
|
@ -467,7 +467,7 @@ pub enum TraitBoundModifier {
|
||||||
/// typeck::collect::compute_bounds matches these against
|
/// typeck::collect::compute_bounds matches these against
|
||||||
/// the "special" built-in traits (see middle::lang_items) and
|
/// the "special" built-in traits (see middle::lang_items) and
|
||||||
/// detects Copy, Send and Sync.
|
/// detects Copy, Send and Sync.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum GenericBound {
|
pub enum GenericBound {
|
||||||
Trait(PolyTraitRef, TraitBoundModifier),
|
Trait(PolyTraitRef, TraitBoundModifier),
|
||||||
Outlives(Lifetime),
|
Outlives(Lifetime),
|
||||||
|
@ -484,7 +484,7 @@ impl GenericBound {
|
||||||
|
|
||||||
pub type GenericBounds = HirVec<GenericBound>;
|
pub type GenericBounds = HirVec<GenericBound>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum GenericParamKind {
|
pub enum GenericParamKind {
|
||||||
/// A lifetime definition, eg `'a: 'b + 'c + 'd`.
|
/// A lifetime definition, eg `'a: 'b + 'c + 'd`.
|
||||||
Lifetime {
|
Lifetime {
|
||||||
|
@ -499,7 +499,7 @@ pub enum GenericParamKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct GenericParam {
|
pub struct GenericParam {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub name: ParamName,
|
pub name: ParamName,
|
||||||
|
@ -518,7 +518,7 @@ pub struct GenericParamCount {
|
||||||
|
|
||||||
/// Represents lifetimes and type parameters attached to a declaration
|
/// Represents lifetimes and type parameters attached to a declaration
|
||||||
/// of a function, enum, trait, etc.
|
/// of a function, enum, trait, etc.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Generics {
|
pub struct Generics {
|
||||||
pub params: HirVec<GenericParam>,
|
pub params: HirVec<GenericParam>,
|
||||||
pub where_clause: WhereClause,
|
pub where_clause: WhereClause,
|
||||||
|
@ -574,7 +574,7 @@ pub enum SyntheticTyParamKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A `where` clause in a definition
|
/// A `where` clause in a definition
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereClause {
|
pub struct WhereClause {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub predicates: HirVec<WherePredicate>,
|
pub predicates: HirVec<WherePredicate>,
|
||||||
|
@ -593,7 +593,7 @@ impl WhereClause {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single predicate in a `where` clause
|
/// A single predicate in a `where` clause
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum WherePredicate {
|
pub enum WherePredicate {
|
||||||
/// A type binding, eg `for<'c> Foo: Send+Clone+'c`
|
/// A type binding, eg `for<'c> Foo: Send+Clone+'c`
|
||||||
BoundPredicate(WhereBoundPredicate),
|
BoundPredicate(WhereBoundPredicate),
|
||||||
|
@ -614,7 +614,7 @@ impl WherePredicate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A type bound, eg `for<'c> Foo: Send+Clone+'c`
|
/// A type bound, eg `for<'c> Foo: Send+Clone+'c`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereBoundPredicate {
|
pub struct WhereBoundPredicate {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
/// Any generics from a `for` binding
|
/// Any generics from a `for` binding
|
||||||
|
@ -626,7 +626,7 @@ pub struct WhereBoundPredicate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A lifetime predicate, e.g. `'a: 'b+'c`
|
/// A lifetime predicate, e.g. `'a: 'b+'c`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereRegionPredicate {
|
pub struct WhereRegionPredicate {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub lifetime: Lifetime,
|
pub lifetime: Lifetime,
|
||||||
|
@ -634,7 +634,7 @@ pub struct WhereRegionPredicate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An equality predicate (unsupported), e.g. `T=int`
|
/// An equality predicate (unsupported), e.g. `T=int`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereEqPredicate {
|
pub struct WhereEqPredicate {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -748,7 +748,7 @@ impl Crate {
|
||||||
/// A macro definition, in this crate or imported from another.
|
/// A macro definition, in this crate or imported from another.
|
||||||
///
|
///
|
||||||
/// Not parsed directly, but created on macro import or `macro_rules!` expansion.
|
/// Not parsed directly, but created on macro import or `macro_rules!` expansion.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct MacroDef {
|
pub struct MacroDef {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub vis: Visibility,
|
pub vis: Visibility,
|
||||||
|
@ -759,7 +759,7 @@ pub struct MacroDef {
|
||||||
pub legacy: bool,
|
pub legacy: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// Statements in a block
|
/// Statements in a block
|
||||||
pub stmts: HirVec<Stmt>,
|
pub stmts: HirVec<Stmt>,
|
||||||
|
@ -782,7 +782,7 @@ pub struct Block {
|
||||||
pub recovered: bool,
|
pub recovered: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Pat {
|
pub struct Pat {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
|
@ -844,7 +844,7 @@ impl Pat {
|
||||||
/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
|
/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
|
||||||
/// are treated the same as` x: x, y: ref y, z: ref mut z`,
|
/// are treated the same as` x: x, y: ref y, z: ref mut z`,
|
||||||
/// except is_shorthand is true
|
/// except is_shorthand is true
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct FieldPat {
|
pub struct FieldPat {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
/// The identifier for the field
|
/// The identifier for the field
|
||||||
|
@ -857,7 +857,7 @@ pub struct FieldPat {
|
||||||
/// Explicit binding annotations given in the HIR for a binding. Note
|
/// Explicit binding annotations given in the HIR for a binding. Note
|
||||||
/// that this is not the final binding *mode* that we infer after type
|
/// that this is not the final binding *mode* that we infer after type
|
||||||
/// inference.
|
/// inference.
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum BindingAnnotation {
|
pub enum BindingAnnotation {
|
||||||
/// No binding annotation given: this means that the final binding mode
|
/// No binding annotation given: this means that the final binding mode
|
||||||
/// will depend on whether we have skipped through a `&` reference
|
/// will depend on whether we have skipped through a `&` reference
|
||||||
|
@ -878,13 +878,13 @@ pub enum BindingAnnotation {
|
||||||
RefMut,
|
RefMut,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum RangeEnd {
|
pub enum RangeEnd {
|
||||||
Included,
|
Included,
|
||||||
Excluded,
|
Excluded,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum PatKind {
|
pub enum PatKind {
|
||||||
/// Represents a wildcard pattern (`_`)
|
/// Represents a wildcard pattern (`_`)
|
||||||
Wild,
|
Wild,
|
||||||
|
@ -940,7 +940,7 @@ impl Mutability {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum BinOp_ {
|
pub enum BinOp_ {
|
||||||
/// The `+` operator (addition)
|
/// The `+` operator (addition)
|
||||||
BiAdd,
|
BiAdd,
|
||||||
|
@ -1069,7 +1069,7 @@ impl Into<ast::BinOpKind> for BinOp_ {
|
||||||
|
|
||||||
pub type BinOp = Spanned<BinOp_>;
|
pub type BinOp = Spanned<BinOp_>;
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum UnOp {
|
pub enum UnOp {
|
||||||
/// The `*` operator for dereferencing
|
/// The `*` operator for dereferencing
|
||||||
UnDeref,
|
UnDeref,
|
||||||
|
@ -1111,7 +1111,7 @@ impl fmt::Debug for Stmt_ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub enum Stmt_ {
|
pub enum Stmt_ {
|
||||||
/// Could be an item or a local (let) binding:
|
/// Could be an item or a local (let) binding:
|
||||||
StmtDecl(P<Decl>, NodeId),
|
StmtDecl(P<Decl>, NodeId),
|
||||||
|
@ -1142,7 +1142,7 @@ impl Stmt_ {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
|
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Local {
|
pub struct Local {
|
||||||
pub pat: P<Pat>,
|
pub pat: P<Pat>,
|
||||||
pub ty: Option<P<Ty>>,
|
pub ty: Option<P<Ty>>,
|
||||||
|
@ -1157,7 +1157,7 @@ pub struct Local {
|
||||||
|
|
||||||
pub type Decl = Spanned<Decl_>;
|
pub type Decl = Spanned<Decl_>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Decl_ {
|
pub enum Decl_ {
|
||||||
/// A local (let) binding:
|
/// A local (let) binding:
|
||||||
DeclLocal(P<Local>),
|
DeclLocal(P<Local>),
|
||||||
|
@ -1182,7 +1182,7 @@ impl Decl_ {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// represents one arm of a 'match'
|
/// represents one arm of a 'match'
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Arm {
|
pub struct Arm {
|
||||||
pub attrs: HirVec<Attribute>,
|
pub attrs: HirVec<Attribute>,
|
||||||
pub pats: HirVec<P<Pat>>,
|
pub pats: HirVec<P<Pat>>,
|
||||||
|
@ -1190,7 +1190,7 @@ pub struct Arm {
|
||||||
pub body: P<Expr>,
|
pub body: P<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Field {
|
pub struct Field {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1199,7 +1199,7 @@ pub struct Field {
|
||||||
pub is_shorthand: bool,
|
pub is_shorthand: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum BlockCheckMode {
|
pub enum BlockCheckMode {
|
||||||
DefaultBlock,
|
DefaultBlock,
|
||||||
UnsafeBlock(UnsafeSource),
|
UnsafeBlock(UnsafeSource),
|
||||||
|
@ -1207,7 +1207,7 @@ pub enum BlockCheckMode {
|
||||||
PopUnsafeBlock(UnsafeSource),
|
PopUnsafeBlock(UnsafeSource),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum UnsafeSource {
|
pub enum UnsafeSource {
|
||||||
CompilerGenerated,
|
CompilerGenerated,
|
||||||
UserProvided,
|
UserProvided,
|
||||||
|
@ -1239,7 +1239,7 @@ pub struct BodyId {
|
||||||
///
|
///
|
||||||
/// All bodies have an **owner**, which can be accessed via the HIR
|
/// All bodies have an **owner**, which can be accessed via the HIR
|
||||||
/// map using `body_owner_def_id()`.
|
/// map using `body_owner_def_id()`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Body {
|
pub struct Body {
|
||||||
pub arguments: HirVec<Arg>,
|
pub arguments: HirVec<Arg>,
|
||||||
pub value: Expr,
|
pub value: Expr,
|
||||||
|
@ -1271,7 +1271,7 @@ pub enum BodyOwnerKind {
|
||||||
/// These are usually found nested inside types (e.g. array lengths)
|
/// These are usually found nested inside types (e.g. array lengths)
|
||||||
/// or expressions (e.g. repeat counts), and also used to define
|
/// or expressions (e.g. repeat counts), and also used to define
|
||||||
/// explicit discriminant values for enum variants.
|
/// explicit discriminant values for enum variants.
|
||||||
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct AnonConst {
|
pub struct AnonConst {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub hir_id: HirId,
|
pub hir_id: HirId,
|
||||||
|
@ -1279,7 +1279,7 @@ pub struct AnonConst {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An expression
|
/// An expression
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Expr {
|
pub struct Expr {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -1330,7 +1330,7 @@ impl fmt::Debug for Expr {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Expr_ {
|
pub enum Expr_ {
|
||||||
/// A `box x` expression.
|
/// A `box x` expression.
|
||||||
ExprBox(P<Expr>),
|
ExprBox(P<Expr>),
|
||||||
|
@ -1432,7 +1432,7 @@ pub enum Expr_ {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Optionally `Self`-qualified value/type path or associated extension.
|
/// Optionally `Self`-qualified value/type path or associated extension.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum QPath {
|
pub enum QPath {
|
||||||
/// Path to a definition, optionally "fully-qualified" with a `Self`
|
/// Path to a definition, optionally "fully-qualified" with a `Self`
|
||||||
/// type, if the path points to an associated item in a trait.
|
/// type, if the path points to an associated item in a trait.
|
||||||
|
@ -1452,7 +1452,7 @@ pub enum QPath {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Hints at the original code for a let statement
|
/// Hints at the original code for a let statement
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum LocalSource {
|
pub enum LocalSource {
|
||||||
/// A `match _ { .. }`
|
/// A `match _ { .. }`
|
||||||
Normal,
|
Normal,
|
||||||
|
@ -1479,7 +1479,7 @@ pub enum MatchSource {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The loop type that yielded an ExprLoop
|
/// The loop type that yielded an ExprLoop
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum LoopSource {
|
pub enum LoopSource {
|
||||||
/// A `loop { .. }` loop
|
/// A `loop { .. }` loop
|
||||||
Loop,
|
Loop,
|
||||||
|
@ -1489,7 +1489,7 @@ pub enum LoopSource {
|
||||||
ForLoop,
|
ForLoop,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum LoopIdError {
|
pub enum LoopIdError {
|
||||||
OutsideLoopScope,
|
OutsideLoopScope,
|
||||||
UnlabeledCfInWhileCondition,
|
UnlabeledCfInWhileCondition,
|
||||||
|
@ -1507,6 +1507,7 @@ impl fmt::Display for LoopIdError {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub struct Destination {
|
pub struct Destination {
|
||||||
// This is `Some(_)` iff there is an explicit user-specified `label
|
// This is `Some(_)` iff there is an explicit user-specified `label
|
||||||
pub label: Option<Label>,
|
pub label: Option<Label>,
|
||||||
|
@ -1522,7 +1523,7 @@ pub enum GeneratorMovability {
|
||||||
Movable,
|
Movable,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum CaptureClause {
|
pub enum CaptureClause {
|
||||||
CaptureByValue,
|
CaptureByValue,
|
||||||
CaptureByRef,
|
CaptureByRef,
|
||||||
|
@ -1530,14 +1531,14 @@ pub enum CaptureClause {
|
||||||
|
|
||||||
// NB: If you change this, you'll probably want to change the corresponding
|
// NB: If you change this, you'll probably want to change the corresponding
|
||||||
// type structure in middle/ty.rs as well.
|
// type structure in middle/ty.rs as well.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct MutTy {
|
pub struct MutTy {
|
||||||
pub ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
pub mutbl: Mutability,
|
pub mutbl: Mutability,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a method's signature in a trait declaration or implementation.
|
/// Represents a method's signature in a trait declaration or implementation.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct MethodSig {
|
pub struct MethodSig {
|
||||||
pub header: FnHeader,
|
pub header: FnHeader,
|
||||||
pub decl: P<FnDecl>,
|
pub decl: P<FnDecl>,
|
||||||
|
@ -1546,7 +1547,7 @@ pub struct MethodSig {
|
||||||
// The bodies for items are stored "out of line", in a separate
|
// The bodies for items are stored "out of line", in a separate
|
||||||
// hashmap in the `Crate`. Here we just record the node-id of the item
|
// hashmap in the `Crate`. Here we just record the node-id of the item
|
||||||
// so it can fetched later.
|
// so it can fetched later.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TraitItemId {
|
pub struct TraitItemId {
|
||||||
pub node_id: NodeId,
|
pub node_id: NodeId,
|
||||||
}
|
}
|
||||||
|
@ -1555,7 +1556,7 @@ pub struct TraitItemId {
|
||||||
/// possibly including a default implementation. A trait item is
|
/// possibly including a default implementation. A trait item is
|
||||||
/// either required (meaning it doesn't have an implementation, just a
|
/// either required (meaning it doesn't have an implementation, just a
|
||||||
/// signature) or provided (meaning it has a default implementation).
|
/// signature) or provided (meaning it has a default implementation).
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TraitItem {
|
pub struct TraitItem {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1567,7 +1568,7 @@ pub struct TraitItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A trait method's body (or just argument names).
|
/// A trait method's body (or just argument names).
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum TraitMethod {
|
pub enum TraitMethod {
|
||||||
/// No default body in the trait, just a signature.
|
/// No default body in the trait, just a signature.
|
||||||
Required(HirVec<Ident>),
|
Required(HirVec<Ident>),
|
||||||
|
@ -1577,7 +1578,7 @@ pub enum TraitMethod {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents a trait method or associated constant or type
|
/// Represents a trait method or associated constant or type
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum TraitItemKind {
|
pub enum TraitItemKind {
|
||||||
/// An associated constant with an optional value (otherwise `impl`s
|
/// An associated constant with an optional value (otherwise `impl`s
|
||||||
/// must contain a value)
|
/// must contain a value)
|
||||||
|
@ -1592,13 +1593,13 @@ pub enum TraitItemKind {
|
||||||
// The bodies for items are stored "out of line", in a separate
|
// The bodies for items are stored "out of line", in a separate
|
||||||
// hashmap in the `Crate`. Here we just record the node-id of the item
|
// hashmap in the `Crate`. Here we just record the node-id of the item
|
||||||
// so it can fetched later.
|
// so it can fetched later.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ImplItemId {
|
pub struct ImplItemId {
|
||||||
pub node_id: NodeId,
|
pub node_id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents anything within an `impl` block
|
/// Represents anything within an `impl` block
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ImplItem {
|
pub struct ImplItem {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1612,7 +1613,7 @@ pub struct ImplItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents different contents within `impl`s
|
/// Represents different contents within `impl`s
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum ImplItemKind {
|
pub enum ImplItemKind {
|
||||||
/// An associated constant of the given type, set to the constant result
|
/// An associated constant of the given type, set to the constant result
|
||||||
/// of the expression
|
/// of the expression
|
||||||
|
@ -1624,7 +1625,7 @@ pub enum ImplItemKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind a type to an associated type: `A=Foo`.
|
// Bind a type to an associated type: `A=Foo`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TypeBinding {
|
pub struct TypeBinding {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1633,7 +1634,7 @@ pub struct TypeBinding {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Ty {
|
pub struct Ty {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub node: Ty_,
|
pub node: Ty_,
|
||||||
|
@ -1659,7 +1660,7 @@ pub enum PrimTy {
|
||||||
TyChar,
|
TyChar,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct BareFnTy {
|
pub struct BareFnTy {
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Unsafety,
|
||||||
pub abi: Abi,
|
pub abi: Abi,
|
||||||
|
@ -1668,14 +1669,14 @@ pub struct BareFnTy {
|
||||||
pub arg_names: HirVec<Ident>,
|
pub arg_names: HirVec<Ident>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ExistTy {
|
pub struct ExistTy {
|
||||||
pub generics: Generics,
|
pub generics: Generics,
|
||||||
pub bounds: GenericBounds,
|
pub bounds: GenericBounds,
|
||||||
pub impl_trait_fn: Option<DefId>,
|
pub impl_trait_fn: Option<DefId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
/// The different kinds of types recognized by the compiler
|
/// The different kinds of types recognized by the compiler
|
||||||
pub enum Ty_ {
|
pub enum Ty_ {
|
||||||
/// A variable length slice (`[T]`)
|
/// A variable length slice (`[T]`)
|
||||||
|
@ -1709,14 +1710,14 @@ pub enum Ty_ {
|
||||||
TyErr,
|
TyErr,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct InlineAsmOutput {
|
pub struct InlineAsmOutput {
|
||||||
pub constraint: Symbol,
|
pub constraint: Symbol,
|
||||||
pub is_rw: bool,
|
pub is_rw: bool,
|
||||||
pub is_indirect: bool,
|
pub is_indirect: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct InlineAsm {
|
pub struct InlineAsm {
|
||||||
pub asm: Symbol,
|
pub asm: Symbol,
|
||||||
pub asm_str_style: StrStyle,
|
pub asm_str_style: StrStyle,
|
||||||
|
@ -1730,7 +1731,7 @@ pub struct InlineAsm {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// represents an argument in a function header
|
/// represents an argument in a function header
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Arg {
|
pub struct Arg {
|
||||||
pub pat: P<Pat>,
|
pub pat: P<Pat>,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
|
@ -1738,7 +1739,7 @@ pub struct Arg {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Represents the header (not the body) of a function declaration
|
/// Represents the header (not the body) of a function declaration
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct FnDecl {
|
pub struct FnDecl {
|
||||||
pub inputs: HirVec<Ty>,
|
pub inputs: HirVec<Ty>,
|
||||||
pub output: FunctionRetTy,
|
pub output: FunctionRetTy,
|
||||||
|
@ -1749,13 +1750,13 @@ pub struct FnDecl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is the trait definition an auto trait?
|
/// Is the trait definition an auto trait?
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum IsAuto {
|
pub enum IsAuto {
|
||||||
Yes,
|
Yes,
|
||||||
No
|
No
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum IsAsync {
|
pub enum IsAsync {
|
||||||
Async,
|
Async,
|
||||||
NotAsync,
|
NotAsync,
|
||||||
|
@ -1767,13 +1768,13 @@ pub enum Unsafety {
|
||||||
Normal,
|
Normal,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Constness {
|
pub enum Constness {
|
||||||
Const,
|
Const,
|
||||||
NotConst,
|
NotConst,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Defaultness {
|
pub enum Defaultness {
|
||||||
Default { has_value: bool },
|
Default { has_value: bool },
|
||||||
Final,
|
Final,
|
||||||
|
@ -1809,7 +1810,7 @@ impl fmt::Display for Unsafety {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||||
pub enum ImplPolarity {
|
pub enum ImplPolarity {
|
||||||
/// `impl Trait for Type`
|
/// `impl Trait for Type`
|
||||||
Positive,
|
Positive,
|
||||||
|
@ -1827,7 +1828,7 @@ impl fmt::Debug for ImplPolarity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum FunctionRetTy {
|
pub enum FunctionRetTy {
|
||||||
/// Return type is not specified.
|
/// Return type is not specified.
|
||||||
///
|
///
|
||||||
|
@ -1848,7 +1849,7 @@ impl FunctionRetTy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Mod {
|
pub struct Mod {
|
||||||
/// A span from the first token past `{` to the last token until `}`.
|
/// A span from the first token past `{` to the last token until `}`.
|
||||||
/// For `mod foo;`, the inner span ranges from the first token
|
/// For `mod foo;`, the inner span ranges from the first token
|
||||||
|
@ -1857,24 +1858,24 @@ pub struct Mod {
|
||||||
pub item_ids: HirVec<ItemId>,
|
pub item_ids: HirVec<ItemId>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ForeignMod {
|
pub struct ForeignMod {
|
||||||
pub abi: Abi,
|
pub abi: Abi,
|
||||||
pub items: HirVec<ForeignItem>,
|
pub items: HirVec<ForeignItem>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct GlobalAsm {
|
pub struct GlobalAsm {
|
||||||
pub asm: Symbol,
|
pub asm: Symbol,
|
||||||
pub ctxt: SyntaxContext,
|
pub ctxt: SyntaxContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct EnumDef {
|
pub struct EnumDef {
|
||||||
pub variants: HirVec<Variant>,
|
pub variants: HirVec<Variant>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Variant_ {
|
pub struct Variant_ {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub attrs: HirVec<Attribute>,
|
pub attrs: HirVec<Attribute>,
|
||||||
|
@ -1885,7 +1886,7 @@ pub struct Variant_ {
|
||||||
|
|
||||||
pub type Variant = Spanned<Variant_>;
|
pub type Variant = Spanned<Variant_>;
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum UseKind {
|
pub enum UseKind {
|
||||||
/// One import, e.g. `use foo::bar` or `use foo::bar as baz`.
|
/// One import, e.g. `use foo::bar` or `use foo::bar as baz`.
|
||||||
/// Also produced for each element of a list `use`, e.g.
|
/// Also produced for each element of a list `use`, e.g.
|
||||||
|
@ -1907,13 +1908,13 @@ pub enum UseKind {
|
||||||
/// that the ref_id is for. Note that ref_id's value is not the NodeId of the
|
/// that the ref_id is for. Note that ref_id's value is not the NodeId of the
|
||||||
/// trait being referred to but just a unique NodeId that serves as a key
|
/// trait being referred to but just a unique NodeId that serves as a key
|
||||||
/// within the DefMap.
|
/// within the DefMap.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TraitRef {
|
pub struct TraitRef {
|
||||||
pub path: Path,
|
pub path: Path,
|
||||||
pub ref_id: NodeId,
|
pub ref_id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct PolyTraitRef {
|
pub struct PolyTraitRef {
|
||||||
/// The `'a` in `<'a> Foo<&'a T>`
|
/// The `'a` in `<'a> Foo<&'a T>`
|
||||||
pub bound_generic_params: HirVec<GenericParam>,
|
pub bound_generic_params: HirVec<GenericParam>,
|
||||||
|
@ -1926,7 +1927,7 @@ pub struct PolyTraitRef {
|
||||||
|
|
||||||
pub type Visibility = Spanned<VisibilityKind>;
|
pub type Visibility = Spanned<VisibilityKind>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum VisibilityKind {
|
pub enum VisibilityKind {
|
||||||
Public,
|
Public,
|
||||||
Crate(CrateSugar),
|
Crate(CrateSugar),
|
||||||
|
@ -1952,7 +1953,7 @@ impl VisibilityKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct StructField {
|
pub struct StructField {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1981,7 +1982,7 @@ impl StructField {
|
||||||
/// used for `Struct`-structs (but still presents). Structures don't have an analogue of "Id of
|
/// used for `Struct`-structs (but still presents). Structures don't have an analogue of "Id of
|
||||||
/// the variant itself" from enum variants.
|
/// the variant itself" from enum variants.
|
||||||
/// Id of the whole struct lives in `Item`.
|
/// Id of the whole struct lives in `Item`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum VariantData {
|
pub enum VariantData {
|
||||||
Struct(HirVec<StructField>, NodeId),
|
Struct(HirVec<StructField>, NodeId),
|
||||||
Tuple(HirVec<StructField>, NodeId),
|
Tuple(HirVec<StructField>, NodeId),
|
||||||
|
@ -2026,7 +2027,7 @@ impl VariantData {
|
||||||
// The bodies for items are stored "out of line", in a separate
|
// The bodies for items are stored "out of line", in a separate
|
||||||
// hashmap in the `Crate`. Here we just record the node-id of the item
|
// hashmap in the `Crate`. Here we just record the node-id of the item
|
||||||
// so it can fetched later.
|
// so it can fetched later.
|
||||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ItemId {
|
pub struct ItemId {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
}
|
}
|
||||||
|
@ -2034,7 +2035,7 @@ pub struct ItemId {
|
||||||
/// An item
|
/// An item
|
||||||
///
|
///
|
||||||
/// The name might be a dummy name in case of anonymous items
|
/// The name might be a dummy name in case of anonymous items
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Item {
|
pub struct Item {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
|
@ -2045,7 +2046,7 @@ pub struct Item {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct FnHeader {
|
pub struct FnHeader {
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Unsafety,
|
||||||
pub constness: Constness,
|
pub constness: Constness,
|
||||||
|
@ -2053,7 +2054,7 @@ pub struct FnHeader {
|
||||||
pub abi: Abi,
|
pub abi: Abi,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Item_ {
|
pub enum Item_ {
|
||||||
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
|
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
|
||||||
///
|
///
|
||||||
|
@ -2155,7 +2156,7 @@ impl Item_ {
|
||||||
/// type or method, and whether it is public). This allows other
|
/// type or method, and whether it is public). This allows other
|
||||||
/// passes to find the impl they want without loading the id (which
|
/// passes to find the impl they want without loading the id (which
|
||||||
/// means fewer edges in the incremental compilation graph).
|
/// means fewer edges in the incremental compilation graph).
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TraitItemRef {
|
pub struct TraitItemRef {
|
||||||
pub id: TraitItemId,
|
pub id: TraitItemId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -2170,7 +2171,7 @@ pub struct TraitItemRef {
|
||||||
/// type or method, and whether it is public). This allows other
|
/// type or method, and whether it is public). This allows other
|
||||||
/// passes to find the impl they want without loading the id (which
|
/// passes to find the impl they want without loading the id (which
|
||||||
/// means fewer edges in the incremental compilation graph).
|
/// means fewer edges in the incremental compilation graph).
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ImplItemRef {
|
pub struct ImplItemRef {
|
||||||
pub id: ImplItemId,
|
pub id: ImplItemId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -2180,14 +2181,14 @@ pub struct ImplItemRef {
|
||||||
pub defaultness: Defaultness,
|
pub defaultness: Defaultness,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum AssociatedItemKind {
|
pub enum AssociatedItemKind {
|
||||||
Const,
|
Const,
|
||||||
Method { has_self: bool },
|
Method { has_self: bool },
|
||||||
Type,
|
Type,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ForeignItem {
|
pub struct ForeignItem {
|
||||||
pub name: Name,
|
pub name: Name,
|
||||||
pub attrs: HirVec<Attribute>,
|
pub attrs: HirVec<Attribute>,
|
||||||
|
@ -2198,7 +2199,7 @@ pub struct ForeignItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An item within an `extern` block
|
/// An item within an `extern` block
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum ForeignItem_ {
|
pub enum ForeignItem_ {
|
||||||
/// A foreign function
|
/// A foreign function
|
||||||
ForeignItemFn(P<FnDecl>, HirVec<Ident>, Generics),
|
ForeignItemFn(P<FnDecl>, HirVec<Ident>, Generics),
|
||||||
|
@ -2260,7 +2261,7 @@ pub fn provide(providers: &mut Providers) {
|
||||||
providers.describe_def = map::describe_def;
|
providers.describe_def = map::describe_def;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct CodegenFnAttrs {
|
pub struct CodegenFnAttrs {
|
||||||
pub flags: CodegenFnAttrFlags,
|
pub flags: CodegenFnAttrFlags,
|
||||||
pub inline: InlineAttr,
|
pub inline: InlineAttr,
|
||||||
|
|
|
@ -125,7 +125,7 @@ pub enum NativeLibraryKind {
|
||||||
NativeUnknown,
|
NativeUnknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Hash, RustcEncodable, RustcDecodable)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct NativeLibrary {
|
pub struct NativeLibrary {
|
||||||
pub kind: NativeLibraryKind,
|
pub kind: NativeLibraryKind,
|
||||||
pub name: Symbol,
|
pub name: Symbol,
|
||||||
|
|
|
@ -49,6 +49,7 @@ use rustc::lint as lint;
|
||||||
|
|
||||||
use std::collections::hash_map::Entry;
|
use std::collections::hash_map::Entry;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
|
use std::hash::{Hash, Hasher};
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use std::{mem, slice, vec};
|
use std::{mem, slice, vec};
|
||||||
use std::iter::{FromIterator, once};
|
use std::iter::{FromIterator, once};
|
||||||
|
@ -754,7 +755,7 @@ impl<'a> FromIterator<&'a DocFragment> for String {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Default, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Default)]
|
||||||
pub struct Attributes {
|
pub struct Attributes {
|
||||||
pub doc_strings: Vec<DocFragment>,
|
pub doc_strings: Vec<DocFragment>,
|
||||||
pub other_attrs: Vec<ast::Attribute>,
|
pub other_attrs: Vec<ast::Attribute>,
|
||||||
|
@ -980,12 +981,24 @@ impl PartialEq for Attributes {
|
||||||
self.cfg == rhs.cfg &&
|
self.cfg == rhs.cfg &&
|
||||||
self.span == rhs.span &&
|
self.span == rhs.span &&
|
||||||
self.links == rhs.links &&
|
self.links == rhs.links &&
|
||||||
self.other_attrs.id == rhs.other_attrs.id
|
self.other_attrs.iter().map(|attr| attr.id).eq(rhs.other_attrs.iter().map(|attr| attr.id))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Eq for Attributes {}
|
impl Eq for Attributes {}
|
||||||
|
|
||||||
|
impl Hash for Attributes {
|
||||||
|
fn hash<H: Hasher>(&self, hasher: &mut H) {
|
||||||
|
self.doc_strings.hash(hasher);
|
||||||
|
self.cfg.hash(hasher);
|
||||||
|
self.span.hash(hasher);
|
||||||
|
self.links.hash(hasher);
|
||||||
|
for attr in &self.other_attrs {
|
||||||
|
attr.id.hash(hasher);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl AttributesExt for Attributes {
|
impl AttributesExt for Attributes {
|
||||||
fn lists<'a>(&'a self, name: &'a str) -> ListAttributesIter<'a> {
|
fn lists<'a>(&'a self, name: &'a str) -> ListAttributesIter<'a> {
|
||||||
self.other_attrs.lists(name)
|
self.other_attrs.lists(name)
|
||||||
|
|
|
@ -34,7 +34,7 @@ use std::u32;
|
||||||
|
|
||||||
pub use rustc_target::abi::FloatTy;
|
pub use rustc_target::abi::FloatTy;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
|
||||||
pub struct Label {
|
pub struct Label {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ impl fmt::Debug for Label {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
|
||||||
pub struct Lifetime {
|
pub struct Lifetime {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -63,7 +63,7 @@ impl fmt::Debug for Lifetime {
|
||||||
/// along with a bunch of supporting information.
|
/// along with a bunch of supporting information.
|
||||||
///
|
///
|
||||||
/// E.g. `std::cmp::PartialEq`
|
/// E.g. `std::cmp::PartialEq`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Path {
|
pub struct Path {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
/// The segments in the path: the things separated by `::`.
|
/// The segments in the path: the things separated by `::`.
|
||||||
|
@ -115,7 +115,7 @@ impl Path {
|
||||||
/// A segment of a path: an identifier, an optional lifetime, and a set of types.
|
/// A segment of a path: an identifier, an optional lifetime, and a set of types.
|
||||||
///
|
///
|
||||||
/// E.g. `std`, `String` or `Box<T>`
|
/// E.g. `std`, `String` or `Box<T>`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct PathSegment {
|
pub struct PathSegment {
|
||||||
/// The identifier portion of this path segment.
|
/// The identifier portion of this path segment.
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -141,7 +141,7 @@ impl PathSegment {
|
||||||
/// Arguments of a path segment.
|
/// Arguments of a path segment.
|
||||||
///
|
///
|
||||||
/// E.g. `<A, B>` as in `Foo<A, B>` or `(A, B)` as in `Foo(A, B)`
|
/// E.g. `<A, B>` as in `Foo<A, B>` or `(A, B)` as in `Foo(A, B)`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum GenericArgs {
|
pub enum GenericArgs {
|
||||||
/// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>`
|
/// The `<'a, A,B,C>` in `foo::bar::baz::<'a, A,B,C>`
|
||||||
AngleBracketed(AngleBracketedArgs),
|
AngleBracketed(AngleBracketedArgs),
|
||||||
|
@ -158,14 +158,14 @@ impl GenericArgs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum GenericArg {
|
pub enum GenericArg {
|
||||||
Lifetime(Lifetime),
|
Lifetime(Lifetime),
|
||||||
Type(P<Ty>),
|
Type(P<Ty>),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A path like `Foo<'a, T>`
|
/// A path like `Foo<'a, T>`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Default)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Default)]
|
||||||
pub struct AngleBracketedArgs {
|
pub struct AngleBracketedArgs {
|
||||||
/// Overall span
|
/// Overall span
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -190,7 +190,7 @@ impl Into<Option<P<GenericArgs>>> for ParenthesisedArgs {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A path like `Foo(A,B) -> C`
|
/// A path like `Foo(A,B) -> C`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ParenthesisedArgs {
|
pub struct ParenthesisedArgs {
|
||||||
/// Overall span
|
/// Overall span
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -270,7 +270,7 @@ pub const DUMMY_NODE_ID: NodeId = NodeId(!0);
|
||||||
|
|
||||||
/// A modifier on a bound, currently this is only used for `?Sized`, where the
|
/// A modifier on a bound, currently this is only used for `?Sized`, where the
|
||||||
/// modifier is `Maybe`. Negative bounds should also be handled here.
|
/// modifier is `Maybe`. Negative bounds should also be handled here.
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum TraitBoundModifier {
|
pub enum TraitBoundModifier {
|
||||||
None,
|
None,
|
||||||
Maybe,
|
Maybe,
|
||||||
|
@ -280,7 +280,7 @@ pub enum TraitBoundModifier {
|
||||||
/// typeck::collect::compute_bounds matches these against
|
/// typeck::collect::compute_bounds matches these against
|
||||||
/// the "special" built-in traits (see middle::lang_items) and
|
/// the "special" built-in traits (see middle::lang_items) and
|
||||||
/// detects Copy, Send and Sync.
|
/// detects Copy, Send and Sync.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum GenericBound {
|
pub enum GenericBound {
|
||||||
Trait(PolyTraitRef, TraitBoundModifier),
|
Trait(PolyTraitRef, TraitBoundModifier),
|
||||||
Outlives(Lifetime)
|
Outlives(Lifetime)
|
||||||
|
@ -297,7 +297,7 @@ impl GenericBound {
|
||||||
|
|
||||||
pub type GenericBounds = Vec<GenericBound>;
|
pub type GenericBounds = Vec<GenericBound>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum GenericParamKind {
|
pub enum GenericParamKind {
|
||||||
/// A lifetime definition, e.g. `'a: 'b+'c+'d`.
|
/// A lifetime definition, e.g. `'a: 'b+'c+'d`.
|
||||||
Lifetime,
|
Lifetime,
|
||||||
|
@ -306,7 +306,7 @@ pub enum GenericParamKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct GenericParam {
|
pub struct GenericParam {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -318,7 +318,7 @@ pub struct GenericParam {
|
||||||
|
|
||||||
/// Represents lifetime, type and const parameters attached to a declaration of
|
/// Represents lifetime, type and const parameters attached to a declaration of
|
||||||
/// a function, enum, trait, etc.
|
/// a function, enum, trait, etc.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Generics {
|
pub struct Generics {
|
||||||
pub params: Vec<GenericParam>,
|
pub params: Vec<GenericParam>,
|
||||||
pub where_clause: WhereClause,
|
pub where_clause: WhereClause,
|
||||||
|
@ -341,7 +341,7 @@ impl Default for Generics {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A `where` clause in a definition
|
/// A `where` clause in a definition
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereClause {
|
pub struct WhereClause {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub predicates: Vec<WherePredicate>,
|
pub predicates: Vec<WherePredicate>,
|
||||||
|
@ -349,7 +349,7 @@ pub struct WhereClause {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A single predicate in a `where` clause
|
/// A single predicate in a `where` clause
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum WherePredicate {
|
pub enum WherePredicate {
|
||||||
/// A type binding, e.g. `for<'c> Foo: Send+Clone+'c`
|
/// A type binding, e.g. `for<'c> Foo: Send+Clone+'c`
|
||||||
BoundPredicate(WhereBoundPredicate),
|
BoundPredicate(WhereBoundPredicate),
|
||||||
|
@ -372,7 +372,7 @@ impl WherePredicate {
|
||||||
/// A type bound.
|
/// A type bound.
|
||||||
///
|
///
|
||||||
/// E.g. `for<'c> Foo: Send+Clone+'c`
|
/// E.g. `for<'c> Foo: Send+Clone+'c`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereBoundPredicate {
|
pub struct WhereBoundPredicate {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
/// Any generics from a `for` binding
|
/// Any generics from a `for` binding
|
||||||
|
@ -386,7 +386,7 @@ pub struct WhereBoundPredicate {
|
||||||
/// A lifetime predicate.
|
/// A lifetime predicate.
|
||||||
///
|
///
|
||||||
/// E.g. `'a: 'b+'c`
|
/// E.g. `'a: 'b+'c`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereRegionPredicate {
|
pub struct WhereRegionPredicate {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub lifetime: Lifetime,
|
pub lifetime: Lifetime,
|
||||||
|
@ -396,7 +396,7 @@ pub struct WhereRegionPredicate {
|
||||||
/// An equality predicate (unsupported).
|
/// An equality predicate (unsupported).
|
||||||
///
|
///
|
||||||
/// E.g. `T=int`
|
/// E.g. `T=int`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct WhereEqPredicate {
|
pub struct WhereEqPredicate {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
@ -408,7 +408,7 @@ pub struct WhereEqPredicate {
|
||||||
/// used to drive conditional compilation
|
/// used to drive conditional compilation
|
||||||
pub type CrateConfig = HashSet<(Name, Option<Symbol>)>;
|
pub type CrateConfig = HashSet<(Name, Option<Symbol>)>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Crate {
|
pub struct Crate {
|
||||||
pub module: Mod,
|
pub module: Mod,
|
||||||
pub attrs: Vec<Attribute>,
|
pub attrs: Vec<Attribute>,
|
||||||
|
@ -421,7 +421,7 @@ pub type NestedMetaItem = Spanned<NestedMetaItemKind>;
|
||||||
/// Possible values inside of compile-time attribute lists.
|
/// Possible values inside of compile-time attribute lists.
|
||||||
///
|
///
|
||||||
/// E.g. the '..' in `#[name(..)]`.
|
/// E.g. the '..' in `#[name(..)]`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum NestedMetaItemKind {
|
pub enum NestedMetaItemKind {
|
||||||
/// A full MetaItem, for recursive meta items.
|
/// A full MetaItem, for recursive meta items.
|
||||||
MetaItem(MetaItem),
|
MetaItem(MetaItem),
|
||||||
|
@ -434,7 +434,7 @@ pub enum NestedMetaItemKind {
|
||||||
/// A spanned compile-time attribute item.
|
/// A spanned compile-time attribute item.
|
||||||
///
|
///
|
||||||
/// E.g. `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`
|
/// E.g. `#[test]`, `#[derive(..)]`, `#[rustfmt::skip]` or `#[feature = "foo"]`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct MetaItem {
|
pub struct MetaItem {
|
||||||
pub ident: Path,
|
pub ident: Path,
|
||||||
pub node: MetaItemKind,
|
pub node: MetaItemKind,
|
||||||
|
@ -444,7 +444,7 @@ pub struct MetaItem {
|
||||||
/// A compile-time attribute item.
|
/// A compile-time attribute item.
|
||||||
///
|
///
|
||||||
/// E.g. `#[test]`, `#[derive(..)]` or `#[feature = "foo"]`
|
/// E.g. `#[test]`, `#[derive(..)]` or `#[feature = "foo"]`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum MetaItemKind {
|
pub enum MetaItemKind {
|
||||||
/// Word meta item.
|
/// Word meta item.
|
||||||
///
|
///
|
||||||
|
@ -463,7 +463,7 @@ pub enum MetaItemKind {
|
||||||
/// A Block (`{ .. }`).
|
/// A Block (`{ .. }`).
|
||||||
///
|
///
|
||||||
/// E.g. `{ .. }` as in `fn foo() { .. }`
|
/// E.g. `{ .. }` as in `fn foo() { .. }`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Block {
|
pub struct Block {
|
||||||
/// Statements in a block
|
/// Statements in a block
|
||||||
pub stmts: Vec<Stmt>,
|
pub stmts: Vec<Stmt>,
|
||||||
|
@ -474,7 +474,7 @@ pub struct Block {
|
||||||
pub recovered: bool,
|
pub recovered: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Pat {
|
pub struct Pat {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub node: PatKind,
|
pub node: PatKind,
|
||||||
|
@ -552,7 +552,7 @@ impl Pat {
|
||||||
/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
|
/// Patterns like the fields of Foo `{ x, ref y, ref mut z }`
|
||||||
/// are treated the same as` x: x, y: ref y, z: ref mut z`,
|
/// are treated the same as` x: x, y: ref y, z: ref mut z`,
|
||||||
/// except is_shorthand is true
|
/// except is_shorthand is true
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct FieldPat {
|
pub struct FieldPat {
|
||||||
/// The identifier for the field
|
/// The identifier for the field
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -562,25 +562,25 @@ pub struct FieldPat {
|
||||||
pub attrs: ThinVec<Attribute>,
|
pub attrs: ThinVec<Attribute>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum BindingMode {
|
pub enum BindingMode {
|
||||||
ByRef(Mutability),
|
ByRef(Mutability),
|
||||||
ByValue(Mutability),
|
ByValue(Mutability),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum RangeEnd {
|
pub enum RangeEnd {
|
||||||
Included(RangeSyntax),
|
Included(RangeSyntax),
|
||||||
Excluded,
|
Excluded,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum RangeSyntax {
|
pub enum RangeSyntax {
|
||||||
DotDotDot,
|
DotDotDot,
|
||||||
DotDotEq,
|
DotDotEq,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum PatKind {
|
pub enum PatKind {
|
||||||
/// Represents a wildcard pattern (`_`)
|
/// Represents a wildcard pattern (`_`)
|
||||||
Wild,
|
Wild,
|
||||||
|
@ -627,13 +627,13 @@ pub enum PatKind {
|
||||||
Mac(Mac),
|
Mac(Mac),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum Mutability {
|
pub enum Mutability {
|
||||||
Mutable,
|
Mutable,
|
||||||
Immutable,
|
Immutable,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum BinOpKind {
|
pub enum BinOpKind {
|
||||||
/// The `+` operator (addition)
|
/// The `+` operator (addition)
|
||||||
Add,
|
Add,
|
||||||
|
@ -730,7 +730,7 @@ impl BinOpKind {
|
||||||
|
|
||||||
pub type BinOp = Spanned<BinOpKind>;
|
pub type BinOp = Spanned<BinOpKind>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum UnOp {
|
pub enum UnOp {
|
||||||
/// The `*` operator for dereferencing
|
/// The `*` operator for dereferencing
|
||||||
Deref,
|
Deref,
|
||||||
|
@ -759,7 +759,7 @@ impl UnOp {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A statement
|
/// A statement
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Stmt {
|
pub struct Stmt {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub node: StmtKind,
|
pub node: StmtKind,
|
||||||
|
@ -800,7 +800,7 @@ impl fmt::Debug for Stmt {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub enum StmtKind {
|
pub enum StmtKind {
|
||||||
/// A local (let) binding.
|
/// A local (let) binding.
|
||||||
Local(P<Local>),
|
Local(P<Local>),
|
||||||
|
@ -816,7 +816,7 @@ pub enum StmtKind {
|
||||||
Mac(P<(Mac, MacStmtStyle, ThinVec<Attribute>)>),
|
Mac(P<(Mac, MacStmtStyle, ThinVec<Attribute>)>),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum MacStmtStyle {
|
pub enum MacStmtStyle {
|
||||||
/// The macro statement had a trailing semicolon, e.g. `foo! { ... };`
|
/// The macro statement had a trailing semicolon, e.g. `foo! { ... };`
|
||||||
/// `foo!(...);`, `foo![...];`
|
/// `foo!(...);`, `foo![...];`
|
||||||
|
@ -830,7 +830,7 @@ pub enum MacStmtStyle {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
|
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Local {
|
pub struct Local {
|
||||||
pub pat: P<Pat>,
|
pub pat: P<Pat>,
|
||||||
pub ty: Option<P<Ty>>,
|
pub ty: Option<P<Ty>>,
|
||||||
|
@ -851,7 +851,7 @@ pub struct Local {
|
||||||
/// _ => { println!("no match!") },
|
/// _ => { println!("no match!") },
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Arm {
|
pub struct Arm {
|
||||||
pub attrs: Vec<Attribute>,
|
pub attrs: Vec<Attribute>,
|
||||||
pub pats: Vec<P<Pat>>,
|
pub pats: Vec<P<Pat>>,
|
||||||
|
@ -859,7 +859,7 @@ pub struct Arm {
|
||||||
pub body: P<Expr>,
|
pub body: P<Expr>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Field {
|
pub struct Field {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub expr: P<Expr>,
|
pub expr: P<Expr>,
|
||||||
|
@ -870,13 +870,13 @@ pub struct Field {
|
||||||
|
|
||||||
pub type SpannedIdent = Spanned<Ident>;
|
pub type SpannedIdent = Spanned<Ident>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum BlockCheckMode {
|
pub enum BlockCheckMode {
|
||||||
Default,
|
Default,
|
||||||
Unsafe(UnsafeSource),
|
Unsafe(UnsafeSource),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum UnsafeSource {
|
pub enum UnsafeSource {
|
||||||
CompilerGenerated,
|
CompilerGenerated,
|
||||||
UserProvided,
|
UserProvided,
|
||||||
|
@ -887,7 +887,7 @@ pub enum UnsafeSource {
|
||||||
/// These are usually found nested inside types (e.g. array lengths)
|
/// These are usually found nested inside types (e.g. array lengths)
|
||||||
/// or expressions (e.g. repeat counts), and also used to define
|
/// or expressions (e.g. repeat counts), and also used to define
|
||||||
/// explicit discriminant values for enum variants.
|
/// explicit discriminant values for enum variants.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct AnonConst {
|
pub struct AnonConst {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub value: P<Expr>,
|
pub value: P<Expr>,
|
||||||
|
@ -895,7 +895,7 @@ pub struct AnonConst {
|
||||||
|
|
||||||
|
|
||||||
/// An expression
|
/// An expression
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash,)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Expr {
|
pub struct Expr {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub node: ExprKind,
|
pub node: ExprKind,
|
||||||
|
@ -1018,7 +1018,7 @@ impl fmt::Debug for Expr {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Limit types of a range (inclusive or exclusive)
|
/// Limit types of a range (inclusive or exclusive)
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum RangeLimits {
|
pub enum RangeLimits {
|
||||||
/// Inclusive at the beginning, exclusive at the end
|
/// Inclusive at the beginning, exclusive at the end
|
||||||
HalfOpen,
|
HalfOpen,
|
||||||
|
@ -1026,7 +1026,7 @@ pub enum RangeLimits {
|
||||||
Closed,
|
Closed,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum ExprKind {
|
pub enum ExprKind {
|
||||||
/// A `box x` expression.
|
/// A `box x` expression.
|
||||||
Box(P<Expr>),
|
Box(P<Expr>),
|
||||||
|
@ -1183,7 +1183,7 @@ pub enum ExprKind {
|
||||||
/// ^~~~~ ^
|
/// ^~~~~ ^
|
||||||
/// ty position = 0
|
/// ty position = 0
|
||||||
/// ```
|
/// ```
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct QSelf {
|
pub struct QSelf {
|
||||||
pub ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
|
|
||||||
|
@ -1195,14 +1195,14 @@ pub struct QSelf {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A capture clause
|
/// A capture clause
|
||||||
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum CaptureBy {
|
pub enum CaptureBy {
|
||||||
Value,
|
Value,
|
||||||
Ref,
|
Ref,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The movability of a generator / closure literal
|
/// The movability of a generator / closure literal
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum Movability {
|
pub enum Movability {
|
||||||
Static,
|
Static,
|
||||||
Movable,
|
Movable,
|
||||||
|
@ -1216,14 +1216,14 @@ pub type Mac = Spanned<Mac_>;
|
||||||
///
|
///
|
||||||
/// NB: the additional ident for a macro_rules-style macro is actually
|
/// NB: the additional ident for a macro_rules-style macro is actually
|
||||||
/// stored in the enclosing item. Oog.
|
/// stored in the enclosing item. Oog.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Mac_ {
|
pub struct Mac_ {
|
||||||
pub path: Path,
|
pub path: Path,
|
||||||
pub delim: MacDelimiter,
|
pub delim: MacDelimiter,
|
||||||
pub tts: ThinTokenStream,
|
pub tts: ThinTokenStream,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum MacDelimiter {
|
pub enum MacDelimiter {
|
||||||
Parenthesis,
|
Parenthesis,
|
||||||
Bracket,
|
Bracket,
|
||||||
|
@ -1236,7 +1236,7 @@ impl Mac_ {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct MacroDef {
|
pub struct MacroDef {
|
||||||
pub tokens: ThinTokenStream,
|
pub tokens: ThinTokenStream,
|
||||||
pub legacy: bool,
|
pub legacy: bool,
|
||||||
|
@ -1248,7 +1248,7 @@ impl MacroDef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum StrStyle {
|
pub enum StrStyle {
|
||||||
/// A regular string, like `"foo"`
|
/// A regular string, like `"foo"`
|
||||||
Cooked,
|
Cooked,
|
||||||
|
@ -1261,7 +1261,7 @@ pub enum StrStyle {
|
||||||
/// A literal
|
/// A literal
|
||||||
pub type Lit = Spanned<LitKind>;
|
pub type Lit = Spanned<LitKind>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum LitIntType {
|
pub enum LitIntType {
|
||||||
Signed(IntTy),
|
Signed(IntTy),
|
||||||
Unsigned(UintTy),
|
Unsigned(UintTy),
|
||||||
|
@ -1271,7 +1271,7 @@ pub enum LitIntType {
|
||||||
/// Literal kind.
|
/// Literal kind.
|
||||||
///
|
///
|
||||||
/// E.g. `"foo"`, `42`, `12.34` or `bool`
|
/// E.g. `"foo"`, `42`, `12.34` or `bool`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum LitKind {
|
pub enum LitKind {
|
||||||
/// A string literal (`"foo"`)
|
/// A string literal (`"foo"`)
|
||||||
Str(Symbol, StrStyle),
|
Str(Symbol, StrStyle),
|
||||||
|
@ -1337,7 +1337,7 @@ impl LitKind {
|
||||||
|
|
||||||
// NB: If you change this, you'll probably want to change the corresponding
|
// NB: If you change this, you'll probably want to change the corresponding
|
||||||
// type structure in middle/ty.rs as well.
|
// type structure in middle/ty.rs as well.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct MutTy {
|
pub struct MutTy {
|
||||||
pub ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
pub mutbl: Mutability,
|
pub mutbl: Mutability,
|
||||||
|
@ -1345,7 +1345,7 @@ pub struct MutTy {
|
||||||
|
|
||||||
/// Represents a method's signature in a trait declaration,
|
/// Represents a method's signature in a trait declaration,
|
||||||
/// or in an implementation.
|
/// or in an implementation.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct MethodSig {
|
pub struct MethodSig {
|
||||||
pub header: FnHeader,
|
pub header: FnHeader,
|
||||||
pub decl: P<FnDecl>,
|
pub decl: P<FnDecl>,
|
||||||
|
@ -1355,7 +1355,7 @@ pub struct MethodSig {
|
||||||
/// possibly including a default implementation. A trait item is
|
/// possibly including a default implementation. A trait item is
|
||||||
/// either required (meaning it doesn't have an implementation, just a
|
/// either required (meaning it doesn't have an implementation, just a
|
||||||
/// signature) or provided (meaning it has a default implementation).
|
/// signature) or provided (meaning it has a default implementation).
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TraitItem {
|
pub struct TraitItem {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1367,7 +1367,7 @@ pub struct TraitItem {
|
||||||
pub tokens: Option<TokenStream>,
|
pub tokens: Option<TokenStream>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum TraitItemKind {
|
pub enum TraitItemKind {
|
||||||
Const(P<Ty>, Option<P<Expr>>),
|
Const(P<Ty>, Option<P<Expr>>),
|
||||||
Method(MethodSig, Option<P<Block>>),
|
Method(MethodSig, Option<P<Block>>),
|
||||||
|
@ -1375,7 +1375,7 @@ pub enum TraitItemKind {
|
||||||
Macro(Mac),
|
Macro(Mac),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ImplItem {
|
pub struct ImplItem {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1389,7 +1389,7 @@ pub struct ImplItem {
|
||||||
pub tokens: Option<TokenStream>,
|
pub tokens: Option<TokenStream>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum ImplItemKind {
|
pub enum ImplItemKind {
|
||||||
Const(P<Ty>, P<Expr>),
|
Const(P<Ty>, P<Expr>),
|
||||||
Method(MethodSig, P<Block>),
|
Method(MethodSig, P<Block>),
|
||||||
|
@ -1397,7 +1397,7 @@ pub enum ImplItemKind {
|
||||||
Macro(Mac),
|
Macro(Mac),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Copy)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Copy)]
|
||||||
pub enum IntTy {
|
pub enum IntTy {
|
||||||
Isize,
|
Isize,
|
||||||
I8,
|
I8,
|
||||||
|
@ -1450,7 +1450,7 @@ impl IntTy {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable, RustcDecodable, Hash, Copy)]
|
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, RustcEncodable, RustcDecodable, Copy)]
|
||||||
pub enum UintTy {
|
pub enum UintTy {
|
||||||
Usize,
|
Usize,
|
||||||
U8,
|
U8,
|
||||||
|
@ -1501,7 +1501,7 @@ impl fmt::Display for UintTy {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Bind a type to an associated type: `A=Foo`.
|
// Bind a type to an associated type: `A=Foo`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TypeBinding {
|
pub struct TypeBinding {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
|
@ -1509,7 +1509,7 @@ pub struct TypeBinding {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
pub struct Ty {
|
pub struct Ty {
|
||||||
pub id: NodeId,
|
pub id: NodeId,
|
||||||
pub node: TyKind,
|
pub node: TyKind,
|
||||||
|
@ -1522,7 +1522,7 @@ impl fmt::Debug for Ty {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct BareFnTy {
|
pub struct BareFnTy {
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Unsafety,
|
||||||
pub abi: Abi,
|
pub abi: Abi,
|
||||||
|
@ -1531,7 +1531,7 @@ pub struct BareFnTy {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The different kinds of types recognized by the compiler
|
/// The different kinds of types recognized by the compiler
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum TyKind {
|
pub enum TyKind {
|
||||||
/// A variable-length slice (`[T]`)
|
/// A variable-length slice (`[T]`)
|
||||||
Slice(P<Ty>),
|
Slice(P<Ty>),
|
||||||
|
@ -1587,7 +1587,7 @@ impl TyKind {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Syntax used to declare a trait object.
|
/// Syntax used to declare a trait object.
|
||||||
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, Copy, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum TraitObjectSyntax {
|
pub enum TraitObjectSyntax {
|
||||||
Dyn,
|
Dyn,
|
||||||
None,
|
None,
|
||||||
|
@ -1596,7 +1596,7 @@ pub enum TraitObjectSyntax {
|
||||||
/// Inline assembly dialect.
|
/// Inline assembly dialect.
|
||||||
///
|
///
|
||||||
/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`
|
/// E.g. `"intel"` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum AsmDialect {
|
pub enum AsmDialect {
|
||||||
Att,
|
Att,
|
||||||
Intel,
|
Intel,
|
||||||
|
@ -1605,7 +1605,7 @@ pub enum AsmDialect {
|
||||||
/// Inline assembly.
|
/// Inline assembly.
|
||||||
///
|
///
|
||||||
/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`
|
/// E.g. `"={eax}"(result)` as in `asm!("mov eax, 2" : "={eax}"(result) : : : "intel")`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct InlineAsmOutput {
|
pub struct InlineAsmOutput {
|
||||||
pub constraint: Symbol,
|
pub constraint: Symbol,
|
||||||
pub expr: P<Expr>,
|
pub expr: P<Expr>,
|
||||||
|
@ -1616,7 +1616,7 @@ pub struct InlineAsmOutput {
|
||||||
/// Inline assembly.
|
/// Inline assembly.
|
||||||
///
|
///
|
||||||
/// E.g. `asm!("NOP");`
|
/// E.g. `asm!("NOP");`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct InlineAsm {
|
pub struct InlineAsm {
|
||||||
pub asm: Symbol,
|
pub asm: Symbol,
|
||||||
pub asm_str_style: StrStyle,
|
pub asm_str_style: StrStyle,
|
||||||
|
@ -1632,7 +1632,7 @@ pub struct InlineAsm {
|
||||||
/// An argument in a function header.
|
/// An argument in a function header.
|
||||||
///
|
///
|
||||||
/// E.g. `bar: usize` as in `fn foo(bar: usize)`
|
/// E.g. `bar: usize` as in `fn foo(bar: usize)`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Arg {
|
pub struct Arg {
|
||||||
pub ty: P<Ty>,
|
pub ty: P<Ty>,
|
||||||
pub pat: P<Pat>,
|
pub pat: P<Pat>,
|
||||||
|
@ -1642,7 +1642,7 @@ pub struct Arg {
|
||||||
/// Alternative representation for `Arg`s describing `self` parameter of methods.
|
/// Alternative representation for `Arg`s describing `self` parameter of methods.
|
||||||
///
|
///
|
||||||
/// E.g. `&mut self` as in `fn foo(&mut self)`
|
/// E.g. `&mut self` as in `fn foo(&mut self)`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum SelfKind {
|
pub enum SelfKind {
|
||||||
/// `self`, `mut self`
|
/// `self`, `mut self`
|
||||||
Value(Mutability),
|
Value(Mutability),
|
||||||
|
@ -1710,7 +1710,7 @@ impl Arg {
|
||||||
/// Header (not the body) of a function declaration.
|
/// Header (not the body) of a function declaration.
|
||||||
///
|
///
|
||||||
/// E.g. `fn foo(bar: baz)`
|
/// E.g. `fn foo(bar: baz)`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct FnDecl {
|
pub struct FnDecl {
|
||||||
pub inputs: Vec<Arg>,
|
pub inputs: Vec<Arg>,
|
||||||
pub output: FunctionRetTy,
|
pub output: FunctionRetTy,
|
||||||
|
@ -1727,19 +1727,19 @@ impl FnDecl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Is the trait definition an auto trait?
|
/// Is the trait definition an auto trait?
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum IsAuto {
|
pub enum IsAuto {
|
||||||
Yes,
|
Yes,
|
||||||
No
|
No
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Unsafety {
|
pub enum Unsafety {
|
||||||
Unsafe,
|
Unsafe,
|
||||||
Normal,
|
Normal,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum IsAsync {
|
pub enum IsAsync {
|
||||||
Async {
|
Async {
|
||||||
closure_id: NodeId,
|
closure_id: NodeId,
|
||||||
|
@ -1765,13 +1765,13 @@ impl IsAsync {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Constness {
|
pub enum Constness {
|
||||||
Const,
|
Const,
|
||||||
NotConst,
|
NotConst,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum Defaultness {
|
pub enum Defaultness {
|
||||||
Default,
|
Default,
|
||||||
Final,
|
Final,
|
||||||
|
@ -1786,7 +1786,7 @@ impl fmt::Display for Unsafety {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Copy, Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||||
pub enum ImplPolarity {
|
pub enum ImplPolarity {
|
||||||
/// `impl Trait for Type`
|
/// `impl Trait for Type`
|
||||||
Positive,
|
Positive,
|
||||||
|
@ -1804,7 +1804,7 @@ impl fmt::Debug for ImplPolarity {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum FunctionRetTy {
|
pub enum FunctionRetTy {
|
||||||
/// Return type is not specified.
|
/// Return type is not specified.
|
||||||
///
|
///
|
||||||
|
@ -1828,7 +1828,7 @@ impl FunctionRetTy {
|
||||||
/// Module declaration.
|
/// Module declaration.
|
||||||
///
|
///
|
||||||
/// E.g. `mod foo;` or `mod foo { .. }`
|
/// E.g. `mod foo;` or `mod foo { .. }`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Mod {
|
pub struct Mod {
|
||||||
/// A span from the first token past `{` to the last token until `}`.
|
/// A span from the first token past `{` to the last token until `}`.
|
||||||
/// For `mod foo;`, the inner span ranges from the first token
|
/// For `mod foo;`, the inner span ranges from the first token
|
||||||
|
@ -1840,7 +1840,7 @@ pub struct Mod {
|
||||||
/// Foreign module declaration.
|
/// Foreign module declaration.
|
||||||
///
|
///
|
||||||
/// E.g. `extern { .. }` or `extern C { .. }`
|
/// E.g. `extern { .. }` or `extern C { .. }`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ForeignMod {
|
pub struct ForeignMod {
|
||||||
pub abi: Abi,
|
pub abi: Abi,
|
||||||
pub items: Vec<ForeignItem>,
|
pub items: Vec<ForeignItem>,
|
||||||
|
@ -1849,18 +1849,18 @@ pub struct ForeignMod {
|
||||||
/// Global inline assembly
|
/// Global inline assembly
|
||||||
///
|
///
|
||||||
/// aka module-level assembly or file-scoped assembly
|
/// aka module-level assembly or file-scoped assembly
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub struct GlobalAsm {
|
pub struct GlobalAsm {
|
||||||
pub asm: Symbol,
|
pub asm: Symbol,
|
||||||
pub ctxt: SyntaxContext,
|
pub ctxt: SyntaxContext,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct EnumDef {
|
pub struct EnumDef {
|
||||||
pub variants: Vec<Variant>,
|
pub variants: Vec<Variant>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Variant_ {
|
pub struct Variant_ {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub attrs: Vec<Attribute>,
|
pub attrs: Vec<Attribute>,
|
||||||
|
@ -1872,7 +1872,7 @@ pub struct Variant_ {
|
||||||
pub type Variant = Spanned<Variant_>;
|
pub type Variant = Spanned<Variant_>;
|
||||||
|
|
||||||
/// Part of `use` item to the right of its prefix.
|
/// Part of `use` item to the right of its prefix.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum UseTreeKind {
|
pub enum UseTreeKind {
|
||||||
/// `use prefix` or `use prefix as rename`
|
/// `use prefix` or `use prefix as rename`
|
||||||
///
|
///
|
||||||
|
@ -1887,7 +1887,7 @@ pub enum UseTreeKind {
|
||||||
|
|
||||||
/// A tree of paths sharing common prefixes.
|
/// A tree of paths sharing common prefixes.
|
||||||
/// Used in `use` items both at top-level and inside of braces in import groups.
|
/// Used in `use` items both at top-level and inside of braces in import groups.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct UseTree {
|
pub struct UseTree {
|
||||||
pub prefix: Path,
|
pub prefix: Path,
|
||||||
pub kind: UseTreeKind,
|
pub kind: UseTreeKind,
|
||||||
|
@ -1908,7 +1908,7 @@ impl UseTree {
|
||||||
/// Distinguishes between Attributes that decorate items and Attributes that
|
/// Distinguishes between Attributes that decorate items and Attributes that
|
||||||
/// are contained as statements within items. These two cases need to be
|
/// are contained as statements within items. These two cases need to be
|
||||||
/// distinguished for pretty-printing.
|
/// distinguished for pretty-printing.
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug, Copy)]
|
||||||
pub enum AttrStyle {
|
pub enum AttrStyle {
|
||||||
Outer,
|
Outer,
|
||||||
Inner,
|
Inner,
|
||||||
|
@ -1919,7 +1919,7 @@ pub struct AttrId(pub usize);
|
||||||
|
|
||||||
/// Meta-data associated with an item
|
/// Meta-data associated with an item
|
||||||
/// Doc-comments are promoted to attributes that have is_sugared_doc = true
|
/// Doc-comments are promoted to attributes that have is_sugared_doc = true
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Attribute {
|
pub struct Attribute {
|
||||||
pub id: AttrId,
|
pub id: AttrId,
|
||||||
pub style: AttrStyle,
|
pub style: AttrStyle,
|
||||||
|
@ -1935,13 +1935,13 @@ pub struct Attribute {
|
||||||
/// that the ref_id is for. The impl_id maps to the "self type" of this impl.
|
/// that the ref_id is for. The impl_id maps to the "self type" of this impl.
|
||||||
/// If this impl is an ItemKind::Impl, the impl_id is redundant (it could be the
|
/// If this impl is an ItemKind::Impl, the impl_id is redundant (it could be the
|
||||||
/// same as the impl's node id).
|
/// same as the impl's node id).
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct TraitRef {
|
pub struct TraitRef {
|
||||||
pub path: Path,
|
pub path: Path,
|
||||||
pub ref_id: NodeId,
|
pub ref_id: NodeId,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct PolyTraitRef {
|
pub struct PolyTraitRef {
|
||||||
/// The `'a` in `<'a> Foo<&'a T>`
|
/// The `'a` in `<'a> Foo<&'a T>`
|
||||||
pub bound_generic_params: Vec<GenericParam>,
|
pub bound_generic_params: Vec<GenericParam>,
|
||||||
|
@ -1962,7 +1962,7 @@ impl PolyTraitRef {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum CrateSugar {
|
pub enum CrateSugar {
|
||||||
/// Source is `pub(crate)`
|
/// Source is `pub(crate)`
|
||||||
PubCrate,
|
PubCrate,
|
||||||
|
@ -1973,7 +1973,7 @@ pub enum CrateSugar {
|
||||||
|
|
||||||
pub type Visibility = Spanned<VisibilityKind>;
|
pub type Visibility = Spanned<VisibilityKind>;
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum VisibilityKind {
|
pub enum VisibilityKind {
|
||||||
Public,
|
Public,
|
||||||
Crate(CrateSugar),
|
Crate(CrateSugar),
|
||||||
|
@ -1990,7 +1990,7 @@ impl VisibilityKind {
|
||||||
/// Field of a struct.
|
/// Field of a struct.
|
||||||
///
|
///
|
||||||
/// E.g. `bar: usize` as in `struct Foo { bar: usize }`
|
/// E.g. `bar: usize` as in `struct Foo { bar: usize }`
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct StructField {
|
pub struct StructField {
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
pub ident: Option<Ident>,
|
pub ident: Option<Ident>,
|
||||||
|
@ -2011,7 +2011,7 @@ pub struct StructField {
|
||||||
/// used for `Struct`-structs (but still presents). Structures don't have an analogue of "Id of
|
/// used for `Struct`-structs (but still presents). Structures don't have an analogue of "Id of
|
||||||
/// the variant itself" from enum variants.
|
/// the variant itself" from enum variants.
|
||||||
/// Id of the whole struct lives in `Item`.
|
/// Id of the whole struct lives in `Item`.
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum VariantData {
|
pub enum VariantData {
|
||||||
/// Struct variant.
|
/// Struct variant.
|
||||||
///
|
///
|
||||||
|
@ -2053,7 +2053,7 @@ impl VariantData {
|
||||||
/// An item
|
/// An item
|
||||||
///
|
///
|
||||||
/// The name might be a dummy name in case of anonymous items
|
/// The name might be a dummy name in case of anonymous items
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Item {
|
pub struct Item {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub attrs: Vec<Attribute>,
|
pub attrs: Vec<Attribute>,
|
||||||
|
@ -2076,7 +2076,7 @@ pub struct Item {
|
||||||
///
|
///
|
||||||
/// All the information between the visibility & the name of the function is
|
/// All the information between the visibility & the name of the function is
|
||||||
/// included in this struct (e.g. `async unsafe fn` or `const extern "C" fn`)
|
/// included in this struct (e.g. `async unsafe fn` or `const extern "C" fn`)
|
||||||
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, Copy, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct FnHeader {
|
pub struct FnHeader {
|
||||||
pub unsafety: Unsafety,
|
pub unsafety: Unsafety,
|
||||||
pub asyncness: IsAsync,
|
pub asyncness: IsAsync,
|
||||||
|
@ -2095,7 +2095,7 @@ impl Default for FnHeader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum ItemKind {
|
pub enum ItemKind {
|
||||||
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
|
/// An `extern crate` item, with optional *original* crate name if the crate was renamed.
|
||||||
///
|
///
|
||||||
|
@ -2194,7 +2194,7 @@ impl ItemKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct ForeignItem {
|
pub struct ForeignItem {
|
||||||
pub ident: Ident,
|
pub ident: Ident,
|
||||||
pub attrs: Vec<Attribute>,
|
pub attrs: Vec<Attribute>,
|
||||||
|
@ -2205,7 +2205,7 @@ pub struct ForeignItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// An item within an `extern` block
|
/// An item within an `extern` block
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub enum ForeignItemKind {
|
pub enum ForeignItemKind {
|
||||||
/// A foreign function
|
/// A foreign function
|
||||||
Fn(P<FnDecl>, Generics),
|
Fn(P<FnDecl>, Generics),
|
||||||
|
|
|
@ -22,7 +22,7 @@ use rustc_data_structures::sync::Lrc;
|
||||||
|
|
||||||
/// Contains the sub-token-trees of a "delimited" token tree, such as the contents of `(`. Note
|
/// Contains the sub-token-trees of a "delimited" token tree, such as the contents of `(`. Note
|
||||||
/// that the delimiter itself might be `NoDelim`.
|
/// that the delimiter itself might be `NoDelim`.
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Delimited {
|
pub struct Delimited {
|
||||||
pub delim: token::DelimToken,
|
pub delim: token::DelimToken,
|
||||||
pub tts: Vec<TokenTree>,
|
pub tts: Vec<TokenTree>,
|
||||||
|
@ -60,7 +60,7 @@ impl Delimited {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct SequenceRepetition {
|
pub struct SequenceRepetition {
|
||||||
/// The sequence of token trees
|
/// The sequence of token trees
|
||||||
pub tts: Vec<TokenTree>,
|
pub tts: Vec<TokenTree>,
|
||||||
|
@ -85,7 +85,7 @@ pub enum KleeneOp {
|
||||||
|
|
||||||
/// Similar to `tokenstream::TokenTree`, except that `$i`, `$i:ident`, and `$(...)`
|
/// Similar to `tokenstream::TokenTree`, except that `$i`, `$i:ident`, and `$(...)`
|
||||||
/// are "first-class" token trees. Useful for parsing macros.
|
/// are "first-class" token trees. Useful for parsing macros.
|
||||||
#[derive(Debug, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Debug, Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||||
pub enum TokenTree {
|
pub enum TokenTree {
|
||||||
Token(Span, token::Token),
|
Token(Span, token::Token),
|
||||||
Delimited(Span, Lrc<Delimited>),
|
Delimited(Span, Lrc<Delimited>),
|
||||||
|
|
|
@ -139,7 +139,7 @@ fn ident_can_begin_type(ident: ast::Ident, is_raw: bool) -> bool {
|
||||||
].contains(&ident.name)
|
].contains(&ident.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Hash, Debug)]
|
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Debug)]
|
||||||
pub enum Token {
|
pub enum Token {
|
||||||
/* Expression-operator symbols. */
|
/* Expression-operator symbols. */
|
||||||
Eq,
|
Eq,
|
||||||
|
@ -638,7 +638,7 @@ impl Token {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Clone, RustcEncodable, RustcDecodable)]
|
||||||
/// For interpolation during macro expansion.
|
/// For interpolation during macro expansion.
|
||||||
pub enum Nonterminal {
|
pub enum Nonterminal {
|
||||||
NtItem(P<ast::Item>),
|
NtItem(P<ast::Item>),
|
||||||
|
|
|
@ -33,10 +33,9 @@ use util::RcSlice;
|
||||||
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::{fmt, iter, mem};
|
use std::{fmt, iter, mem};
|
||||||
use std::hash::{self, Hash};
|
|
||||||
|
|
||||||
/// A delimited sequence of token trees
|
/// A delimited sequence of token trees
|
||||||
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Hash, Debug)]
|
#[derive(Clone, PartialEq, RustcEncodable, RustcDecodable, Debug)]
|
||||||
pub struct Delimited {
|
pub struct Delimited {
|
||||||
/// The type of delimiter
|
/// The type of delimiter
|
||||||
pub delim: token::DelimToken,
|
pub delim: token::DelimToken,
|
||||||
|
@ -93,7 +92,7 @@ impl Delimited {
|
||||||
///
|
///
|
||||||
/// The RHS of an MBE macro is the only place `SubstNt`s are substituted.
|
/// The RHS of an MBE macro is the only place `SubstNt`s are substituted.
|
||||||
/// Nothing special happens to misnamed or misplaced `SubstNt`s.
|
/// Nothing special happens to misnamed or misplaced `SubstNt`s.
|
||||||
#[derive(Debug, Clone, PartialEq, RustcEncodable, RustcDecodable, Hash)]
|
#[derive(Debug, Clone, PartialEq, RustcEncodable, RustcDecodable)]
|
||||||
pub enum TokenTree {
|
pub enum TokenTree {
|
||||||
/// A single token
|
/// A single token
|
||||||
Token(Span, token::Token),
|
Token(Span, token::Token),
|
||||||
|
@ -605,14 +604,6 @@ impl Decodable for TokenStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Hash for TokenStream {
|
|
||||||
fn hash<H: hash::Hasher>(&self, state: &mut H) {
|
|
||||||
for tree in self.trees() {
|
|
||||||
tree.hash(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Encodable for ThinTokenStream {
|
impl Encodable for ThinTokenStream {
|
||||||
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error> {
|
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), E::Error> {
|
||||||
TokenStream::from(self.clone()).encode(encoder)
|
TokenStream::from(self.clone()).encode(encoder)
|
||||||
|
@ -625,13 +616,6 @@ impl Decodable for ThinTokenStream {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Hash for ThinTokenStream {
|
|
||||||
fn hash<H: hash::Hasher>(&self, state: &mut H) {
|
|
||||||
TokenStream::from(self.clone()).hash(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue