std: Drop Total from Total{Eq,Ord}

This completes the last stage of the renaming of the comparison hierarchy of
traits. This change renames TotalEq to Eq and TotalOrd to Ord.

In the future the new Eq/Ord will be filled out with their appropriate methods,
but for now this change is purely a renaming change.

[breaking-change]
This commit is contained in:
Alex Crichton 2014-05-31 10:43:52 -07:00
parent c605c2b57b
commit bba701c59d
83 changed files with 436 additions and 431 deletions

View file

@ -39,7 +39,7 @@ pub fn P<T: 'static>(value: T) -> P<T> {
// table) and a SyntaxContext to track renaming and
// macro expansion per Flatt et al., "Macros
// That Work Together"
#[deriving(Clone, Hash, PartialOrd, TotalEq, TotalOrd, Show)]
#[deriving(Clone, Hash, PartialOrd, Eq, Ord, Show)]
pub struct Ident {
pub name: Name,
pub ctxt: SyntaxContext
@ -114,7 +114,7 @@ impl<D:Decoder<E>, E> Decodable<D, E> for Ident {
/// Function name (not all functions have names)
pub type FnIdent = Option<Ident>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Lifetime {
pub id: NodeId,
pub span: Span,
@ -125,7 +125,7 @@ pub struct Lifetime {
// for instance: std::cmp::PartialEq . It's represented
// as a sequence of identifiers, along with a bunch
// of supporting information.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Path {
pub span: Span,
/// A `::foo` path, is relative to the crate root rather than current
@ -137,7 +137,7 @@ pub struct Path {
/// A segment of a path: an identifier, an optional lifetime, and a set of
/// types.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct PathSegment {
/// The identifier portion of this path segment.
pub identifier: Ident,
@ -151,7 +151,7 @@ pub type CrateNum = u32;
pub type NodeId = u32;
#[deriving(Clone, TotalEq, TotalOrd, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, Eq, Ord, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)]
pub struct DefId {
pub krate: CrateNum,
pub node: NodeId,
@ -171,14 +171,14 @@ pub static DUMMY_NODE_ID: NodeId = -1;
// typeck::collect::compute_bounds matches these against
// the "special" built-in traits (see middle::lang_items) and
// detects Copy, Send and Share.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum TyParamBound {
TraitTyParamBound(TraitRef),
StaticRegionTyParamBound,
OtherRegionTyParamBound(Span) // FIXME -- just here until work for #5723 lands
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct TyParam {
pub ident: Ident,
pub id: NodeId,
@ -188,7 +188,7 @@ pub struct TyParam {
pub span: Span
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Generics {
pub lifetimes: Vec<Lifetime>,
pub ty_params: OwnedSlice<TyParam>,
@ -206,13 +206,13 @@ impl Generics {
}
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum MethodProvenance {
FromTrait(DefId),
FromImpl(DefId),
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Def {
DefFn(DefId, FnStyle),
DefStaticMethod(/* method */ DefId, MethodProvenance, FnStyle),
@ -249,7 +249,7 @@ pub enum Def {
DefMethod(DefId /* method */, Option<DefId> /* trait */),
}
#[deriving(Clone, PartialEq, TotalEq, Hash, Encodable, Decodable, Show)]
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
pub enum DefRegion {
DefStaticRegion,
DefEarlyBoundRegion(/* index */ uint, /* lifetime decl */ NodeId),
@ -261,7 +261,7 @@ pub enum DefRegion {
// used to drive conditional compilation
pub type CrateConfig = Vec<@MetaItem> ;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Crate {
pub module: Mod,
pub attrs: Vec<Attribute>,
@ -271,7 +271,7 @@ pub struct Crate {
pub type MetaItem = Spanned<MetaItem_>;
#[deriving(Clone, Encodable, Decodable, TotalEq, Hash)]
#[deriving(Clone, Encodable, Decodable, Eq, Hash)]
pub enum MetaItem_ {
MetaWord(InternedString),
MetaList(InternedString, Vec<@MetaItem> ),
@ -303,7 +303,7 @@ impl PartialEq for MetaItem_ {
}
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Block {
pub view_items: Vec<ViewItem>,
pub stmts: Vec<@Stmt>,
@ -313,26 +313,26 @@ pub struct Block {
pub span: Span,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Pat {
pub id: NodeId,
pub node: Pat_,
pub span: Span,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct FieldPat {
pub ident: Ident,
pub pat: @Pat,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum BindingMode {
BindByRef(Mutability),
BindByValue(Mutability),
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Pat_ {
PatWild,
PatWildMulti,
@ -358,20 +358,20 @@ pub enum Pat_ {
PatMac(Mac),
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Mutability {
MutMutable,
MutImmutable,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ExprVstore {
ExprVstoreUniq, // ~[1,2,3,4]
ExprVstoreSlice, // &[1,2,3,4]
ExprVstoreMutSlice, // &mut [1,2,3,4]
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum BinOp {
BiAdd,
BiSub,
@ -393,7 +393,7 @@ pub enum BinOp {
BiGt,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum UnOp {
UnBox,
UnUniq,
@ -404,7 +404,7 @@ pub enum UnOp {
pub type Stmt = Spanned<Stmt_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Stmt_ {
// could be an item or a local (let) binding:
StmtDecl(@Decl, NodeId),
@ -421,7 +421,7 @@ pub enum Stmt_ {
/// Where a local declaration came from: either a true `let ... =
/// ...;`, or one desugared from the pattern of a for loop.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum LocalSource {
LocalLet,
LocalFor,
@ -430,7 +430,7 @@ pub enum LocalSource {
// FIXME (pending discussion of #1697, #2178...): local should really be
// a refinement on pat.
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Local {
pub ty: P<Ty>,
pub pat: @Pat,
@ -442,7 +442,7 @@ pub struct Local {
pub type Decl = Spanned<Decl_>;
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Decl_ {
// a local (let) binding:
DeclLocal(@Local),
@ -450,7 +450,7 @@ pub enum Decl_ {
DeclItem(@Item),
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Arm {
pub attrs: Vec<Attribute>,
pub pats: Vec<@Pat>,
@ -458,7 +458,7 @@ pub struct Arm {
pub body: @Expr,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Field {
pub ident: SpannedIdent,
pub expr: @Expr,
@ -467,26 +467,26 @@ pub struct Field {
pub type SpannedIdent = Spanned<Ident>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum BlockCheckMode {
DefaultBlock,
UnsafeBlock(UnsafeSource),
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum UnsafeSource {
CompilerGenerated,
UserProvided,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Expr {
pub id: NodeId,
pub node: Expr_,
pub span: Span,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Expr_ {
ExprVstore(@Expr, ExprVstore),
// First expr is the place; second expr is the value.
@ -555,7 +555,7 @@ pub enum Expr_ {
// else knows what to do with them, so you'll probably get a syntax
// error.
//
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
#[doc="For macro invocations; parsing is delegated to the macro"]
pub enum TokenTree {
// a single token
@ -631,7 +631,7 @@ pub enum TokenTree {
//
pub type Matcher = Spanned<Matcher_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Matcher_ {
// match one token
MatchTok(::parse::token::Token),
@ -648,12 +648,12 @@ pub type Mac = Spanned<Mac_>;
// is being invoked, and the vector of token-trees contains the source
// of the macro invocation.
// There's only one flavor, now, so this could presumably be simplified.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Mac_ {
MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum StrStyle {
CookedStr,
RawStr(uint)
@ -661,7 +661,7 @@ pub enum StrStyle {
pub type Lit = Spanned<Lit_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Lit_ {
LitStr(InternedString, StrStyle),
LitBinary(Rc<Vec<u8> >),
@ -677,20 +677,20 @@ pub enum Lit_ {
// NB: If you change this, you'll probably want to change the corresponding
// type structure in middle/ty.rs as well.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct MutTy {
pub ty: P<Ty>,
pub mutbl: Mutability,
}
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct TypeField {
pub ident: Ident,
pub mt: MutTy,
pub span: Span,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct TypeMethod {
pub ident: Ident,
pub attrs: Vec<Attribute>,
@ -706,13 +706,13 @@ pub struct TypeMethod {
// A trait method is either required (meaning it doesn't have an
// implementation, just a signature) or provided (meaning it has a default
// implementation).
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum TraitMethod {
Required(TypeMethod),
Provided(@Method),
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum IntTy {
TyI,
TyI8,
@ -728,7 +728,7 @@ impl fmt::Show for IntTy {
}
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum UintTy {
TyU,
TyU8,
@ -744,7 +744,7 @@ impl fmt::Show for UintTy {
}
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum FloatTy {
TyF32,
TyF64,
@ -758,7 +758,7 @@ impl fmt::Show for FloatTy {
}
// NB PartialEq method appears below.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Ty {
pub id: NodeId,
pub node: Ty_,
@ -766,7 +766,7 @@ pub struct Ty {
}
// Not represented directly in the AST, referred to by name through a ty_path.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum PrimTy {
TyInt(IntTy),
TyUint(UintTy),
@ -776,7 +776,7 @@ pub enum PrimTy {
TyChar
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Onceness {
Once,
Many
@ -791,7 +791,7 @@ impl fmt::Show for Onceness {
}
}
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct ClosureTy {
pub lifetimes: Vec<Lifetime>,
pub fn_style: FnStyle,
@ -804,7 +804,7 @@ pub struct ClosureTy {
pub bounds: Option<OwnedSlice<TyParamBound>>,
}
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct BareFnTy {
pub fn_style: FnStyle,
pub abi: Abi,
@ -812,7 +812,7 @@ pub struct BareFnTy {
pub decl: P<FnDecl>
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Ty_ {
TyNil,
TyBot, /* bottom type */
@ -833,13 +833,13 @@ pub enum Ty_ {
TyInfer,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum AsmDialect {
AsmAtt,
AsmIntel
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct InlineAsm {
pub asm: InternedString,
pub asm_str_style: StrStyle,
@ -851,7 +851,7 @@ pub struct InlineAsm {
pub dialect: AsmDialect
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Arg {
pub ty: P<Ty>,
pub pat: @Pat,
@ -878,7 +878,7 @@ impl Arg {
}
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct FnDecl {
pub inputs: Vec<Arg>,
pub output: P<Ty>,
@ -886,7 +886,7 @@ pub struct FnDecl {
pub variadic: bool
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum FnStyle {
UnsafeFn, // declared with "unsafe fn"
NormalFn, // declared with "fn"
@ -901,14 +901,14 @@ impl fmt::Show for FnStyle {
}
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum RetStyle {
NoReturn, // functions with return type _|_ that always
// raise an error or exit (i.e. never return to the caller)
Return, // everything else
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ExplicitSelf_ {
SelfStatic, // no self
SelfValue, // `self`
@ -918,7 +918,7 @@ pub enum ExplicitSelf_ {
pub type ExplicitSelf = Spanned<ExplicitSelf_>;
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Method {
pub ident: Ident,
pub attrs: Vec<Attribute>,
@ -932,7 +932,7 @@ pub struct Method {
pub vis: Visibility,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Mod {
/// A span from the first token past `{` to the last token until `}`.
/// For `mod foo;`, the inner span ranges from the first token
@ -942,31 +942,31 @@ pub struct Mod {
pub items: Vec<@Item>,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct ForeignMod {
pub abi: Abi,
pub view_items: Vec<ViewItem>,
pub items: Vec<@ForeignItem>,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct VariantArg {
pub ty: P<Ty>,
pub id: NodeId,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum VariantKind {
TupleVariantKind(Vec<VariantArg>),
StructVariantKind(@StructDef),
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct EnumDef {
pub variants: Vec<P<Variant>>,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Variant_ {
pub name: Ident,
pub attrs: Vec<Attribute>,
@ -978,7 +978,7 @@ pub struct Variant_ {
pub type Variant = Spanned<Variant_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct PathListIdent_ {
pub name: Ident,
pub id: NodeId,
@ -988,7 +988,7 @@ pub type PathListIdent = Spanned<PathListIdent_>;
pub type ViewPath = Spanned<ViewPath_>;
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ViewPath_ {
// quux = foo::bar::baz
@ -1005,7 +1005,7 @@ pub enum ViewPath_ {
ViewPathList(Path, Vec<PathListIdent> , NodeId)
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct ViewItem {
pub node: ViewItem_,
pub attrs: Vec<Attribute>,
@ -1013,7 +1013,7 @@ pub struct ViewItem {
pub span: Span,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ViewItem_ {
// ident: name used to refer to this crate in the code
// optional (InternedString,StrStyle): if present, this is a location
@ -1029,17 +1029,17 @@ pub type Attribute = Spanned<Attribute_>;
// Distinguishes between Attributes that decorate items and Attributes that
// are contained as statements within items. These two cases need to be
// distinguished for pretty-printing.
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum AttrStyle {
AttrOuter,
AttrInner,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct AttrId(pub uint);
// doc-comments are promoted to attributes that have is_sugared_doc = true
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Attribute_ {
pub id: AttrId,
pub style: AttrStyle,
@ -1054,13 +1054,13 @@ pub struct Attribute_ {
If this impl is an ItemImpl, the impl_id is redundant (it could be the
same as the impl's node id).
*/
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct TraitRef {
pub path: Path,
pub ref_id: NodeId,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Visibility {
Public,
Inherited,
@ -1075,13 +1075,13 @@ impl Visibility {
}
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Sized {
DynSize,
StaticSize,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct StructField_ {
pub kind: StructFieldKind,
pub id: NodeId,
@ -1091,7 +1091,7 @@ pub struct StructField_ {
pub type StructField = Spanned<StructField_>;
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum StructFieldKind {
NamedField(Ident, Visibility),
UnnamedField(Visibility), // element of a tuple-like struct
@ -1106,7 +1106,7 @@ impl StructFieldKind {
}
}
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct StructDef {
pub fields: Vec<StructField>, /* fields, not including ctor */
/* ID of the constructor. This is only used for tuple- or enum-like
@ -1120,7 +1120,7 @@ pub struct StructDef {
FIXME (#3300): Should allow items to be anonymous. Right now
we just use dummy names for anon items.
*/
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct Item {
pub ident: Ident,
pub attrs: Vec<Attribute>,
@ -1130,7 +1130,7 @@ pub struct Item {
pub span: Span,
}
#[deriving(Clone, PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Item_ {
ItemStatic(P<Ty>, Mutability, @Expr),
ItemFn(P<FnDecl>, FnStyle, Abi, Generics, P<Block>),
@ -1148,7 +1148,7 @@ pub enum Item_ {
ItemMac(Mac),
}
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub struct ForeignItem {
pub ident: Ident,
pub attrs: Vec<Attribute>,
@ -1158,7 +1158,7 @@ pub struct ForeignItem {
pub vis: Visibility,
}
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum ForeignItem_ {
ForeignItemFn(P<FnDecl>, Generics),
ForeignItemStatic(P<Ty>, /* is_mutbl */ bool),
@ -1167,7 +1167,7 @@ pub enum ForeignItem_ {
// The data we save and restore about an inlined item or method. This is not
// part of the AST that we parse from a file, but it becomes part of the tree
// that we trans.
#[deriving(PartialEq, TotalEq, Encodable, Decodable, Hash)]
#[deriving(PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum InlinedItem {
IIItem(@Item),
IIMethod(DefId /* impl id */, bool /* is provided */, @Method),