about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-19 16:02:31 +0000
committerbors <bors@rust-lang.org>2014-12-19 16:02:31 +0000
commit95c2ed31aeb66b2662933200dbfd661a573b1f49 (patch)
tree3e397ee769c09211083f8aa12377e41104575f7f /src/libsyntax
parentbd90b936d73c0ea2c261cd8e7b9c43764cb2da05 (diff)
parentf975b10310b2f38a5ac1e50f30778b85ed963849 (diff)
downloadrust-95c2ed31aeb66b2662933200dbfd661a573b1f49.tar.gz
rust-95c2ed31aeb66b2662933200dbfd661a573b1f49.zip
auto merge of #19867 : japaric/rust/deriving-copy, r=acrichto
r? @alexcrichton 
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/abi.rs19
-rw-r--r--src/libsyntax/ast.rs120
-rw-r--r--src/libsyntax/ast_map/blocks.rs6
-rw-r--r--src/libsyntax/ast_map/mod.rs12
-rw-r--r--src/libsyntax/ast_util.rs4
-rw-r--r--src/libsyntax/attr.rs16
-rw-r--r--src/libsyntax/codemap.rs27
-rw-r--r--src/libsyntax/diagnostic.rs18
-rw-r--r--src/libsyntax/ext/base.rs3
-rw-r--r--src/libsyntax/ext/deriving/cmp/ord.rs3
-rw-r--r--src/libsyntax/ext/mtwt.rs4
-rw-r--r--src/libsyntax/feature_gate.rs3
-rw-r--r--src/libsyntax/parse/lexer/comments.rs4
-rw-r--r--src/libsyntax/parse/obsolete.rs4
-rw-r--r--src/libsyntax/parse/parser.rs4
-rw-r--r--src/libsyntax/parse/token.rs19
-rw-r--r--src/libsyntax/print/pp.rs18
-rw-r--r--src/libsyntax/print/pprust.rs6
-rw-r--r--src/libsyntax/visit.rs3
19 files changed, 77 insertions, 216 deletions
diff --git a/src/libsyntax/abi.rs b/src/libsyntax/abi.rs
index 71d29bca401..70bad90aea1 100644
--- a/src/libsyntax/abi.rs
+++ b/src/libsyntax/abi.rs
@@ -15,7 +15,7 @@ pub use self::AbiArchitecture::*;
 
 use std::fmt;
 
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 pub enum Os {
     OsWindows,
     OsMacos,
@@ -26,9 +26,7 @@ pub enum Os {
     OsDragonfly,
 }
 
-impl Copy for Os {}
-
-#[deriving(PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
+#[deriving(Copy, PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
 pub enum Abi {
     // NB: This ordering MUST match the AbiDatas array below.
     // (This is ensured by the test indices_are_correct().)
@@ -48,10 +46,8 @@ pub enum Abi {
     RustCall,
 }
 
-impl Copy for Abi {}
-
 #[allow(non_camel_case_types)]
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 pub enum Architecture {
     X86,
     X86_64,
@@ -60,8 +56,7 @@ pub enum Architecture {
     Mipsel
 }
 
-impl Copy for Architecture {}
-
+#[deriving(Copy)]
 pub struct AbiData {
     abi: Abi,
 
@@ -69,8 +64,7 @@ pub struct AbiData {
     name: &'static str,
 }
 
-impl Copy for AbiData {}
-
+#[deriving(Copy)]
 pub enum AbiArchitecture {
     /// Not a real ABI (e.g., intrinsic)
     RustArch,
@@ -81,9 +75,6 @@ pub enum AbiArchitecture {
 }
 
 #[allow(non_upper_case_globals)]
-impl Copy for AbiArchitecture {}
-
-#[allow(non_upper_case_globals)]
 static AbiDatas: &'static [AbiData] = &[
     // Platform-specific ABIs
     AbiData {abi: Cdecl, name: "cdecl" },
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index d4860766d47..be8f32bc4d5 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -80,14 +80,12 @@ use serialize::{Encodable, Decodable, Encoder, Decoder};
 /// table) and a SyntaxContext to track renaming and
 /// macro expansion per Flatt et al., "Macros
 /// That Work Together"
-#[deriving(Clone, Hash, PartialOrd, Eq, Ord)]
+#[deriving(Clone, Copy, Hash, PartialOrd, Eq, Ord)]
 pub struct Ident {
     pub name: Name,
     pub ctxt: SyntaxContext
 }
 
-impl Copy for Ident {}
-
 impl Ident {
     /// Construct an identifier with the given name and an empty context:
     pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}}
@@ -160,11 +158,9 @@ pub const ILLEGAL_CTXT : SyntaxContext = 1;
 
 /// A name is a part of an identifier, representing a string or gensym. It's
 /// the result of interning.
-#[deriving(Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone)]
+#[deriving(Copy, Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone)]
 pub struct Name(pub u32);
 
-impl Copy for Name {}
-
 impl Name {
     pub fn as_str<'a>(&'a self) -> &'a str {
         unsafe {
@@ -201,15 +197,13 @@ 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, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct Lifetime {
     pub id: NodeId,
     pub span: Span,
     pub name: Name
 }
 
-impl Copy for Lifetime {}
-
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct LifetimeDef {
     pub lifetime: Lifetime,
@@ -353,14 +347,12 @@ pub type CrateNum = u32;
 
 pub type NodeId = u32;
 
-#[deriving(Clone, Eq, Ord, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, Eq, Ord, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)]
 pub struct DefId {
     pub krate: CrateNum,
     pub node: NodeId,
 }
 
-impl Copy for DefId {}
-
 /// Item definitions in the currently-compiled crate would have the CrateNum
 /// LOCAL_CRATE in their DefId.
 pub const LOCAL_CRATE: CrateNum = 0;
@@ -513,15 +505,13 @@ pub struct FieldPat {
     pub is_shorthand: bool,
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum BindingMode {
     BindByRef(Mutability),
     BindByValue(Mutability),
 }
 
-impl Copy for BindingMode {}
-
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum PatWildKind {
     /// Represents the wildcard pattern `_`
     PatWildSingle,
@@ -530,8 +520,6 @@ pub enum PatWildKind {
     PatWildMulti,
 }
 
-impl Copy for PatWildKind {}
-
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum Pat_ {
     /// Represents a wildcard pattern (either `_` or `..`)
@@ -561,15 +549,13 @@ pub enum Pat_ {
     PatMac(Mac),
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum Mutability {
     MutMutable,
     MutImmutable,
 }
 
-impl Copy for Mutability {}
-
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum BinOp {
     BiAdd,
     BiSub,
@@ -591,9 +577,7 @@ pub enum BinOp {
     BiGt,
 }
 
-impl Copy for BinOp {}
-
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum UnOp {
     UnUniq,
     UnDeref,
@@ -601,8 +585,6 @@ pub enum UnOp {
     UnNeg
 }
 
-impl Copy for UnOp {}
-
 pub type Stmt = Spanned<Stmt_>;
 
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
@@ -634,14 +616,12 @@ pub enum MacStmtStyle {
 
 /// Where a local declaration came from: either a true `let ... =
 /// ...;`, or one desugared from the pattern of a for loop.
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum LocalSource {
     LocalLet,
     LocalFor,
 }
 
-impl Copy for 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>;`
@@ -683,22 +663,18 @@ pub struct Field {
 
 pub type SpannedIdent = Spanned<Ident>;
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum BlockCheckMode {
     DefaultBlock,
     UnsafeBlock(UnsafeSource),
 }
 
-impl Copy for BlockCheckMode {}
-
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum UnsafeSource {
     CompilerGenerated,
     UserProvided,
 }
 
-impl Copy for UnsafeSource {}
-
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct Expr {
     pub id: NodeId,
@@ -775,23 +751,19 @@ pub struct QPath {
     pub item_name: Ident,
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum MatchSource {
     MatchNormal,
     MatchIfLetDesugar,
     MatchWhileLetDesugar,
 }
 
-impl Copy for MatchSource {}
-
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum CaptureClause {
     CaptureByValue,
     CaptureByRef,
 }
 
-impl Copy for CaptureClause {}
-
 /// A delimited sequence of token trees
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct Delimited {
@@ -842,14 +814,12 @@ pub struct SequenceRepetition {
 
 /// A Kleene-style [repetition operator](http://en.wikipedia.org/wiki/Kleene_star)
 /// for token sequences.
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum KleeneOp {
     ZeroOrMore,
     OneOrMore,
 }
 
-impl Copy for KleeneOp {}
-
 /// When the main rust parser encounters a syntax-extension invocation, it
 /// parses the arguments to the invocation as a token-tree. This is a very
 /// loose structure, such that all sorts of different AST-fragments can
@@ -959,24 +929,20 @@ pub enum Mac_ {
     MacInvocTT(Path, Vec<TokenTree> , SyntaxContext),   // new macro-invocation
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum StrStyle {
     CookedStr,
     RawStr(uint)
 }
 
-impl Copy for StrStyle {}
-
 pub type Lit = Spanned<Lit_>;
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum Sign {
     Minus,
     Plus
 }
 
-impl Copy for Sign {}
-
 impl<T> Sign where T: Int {
     pub fn new(n: T) -> Sign {
         if n < Int::zero() {
@@ -987,15 +953,13 @@ impl<T> Sign where T: Int {
     }
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum LitIntType {
     SignedIntLit(IntTy, Sign),
     UnsignedIntLit(UintTy),
     UnsuffixedIntLit(Sign)
 }
 
-impl Copy for LitIntType {}
-
 impl LitIntType {
     pub fn suffix_len(&self) -> uint {
         match *self {
@@ -1082,7 +1046,7 @@ pub struct Typedef {
     pub typ: P<Ty>,
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
 pub enum IntTy {
     TyI,
     TyI8,
@@ -1091,8 +1055,6 @@ pub enum IntTy {
     TyI64,
 }
 
-impl Copy for IntTy {}
-
 impl fmt::Show for IntTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "{}", ast_util::int_ty_to_string(*self, None))
@@ -1109,7 +1071,7 @@ impl IntTy {
     }
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
 pub enum UintTy {
     TyU,
     TyU8,
@@ -1118,8 +1080,6 @@ pub enum UintTy {
     TyU64,
 }
 
-impl Copy for UintTy {}
-
 impl UintTy {
     pub fn suffix_len(&self) -> uint {
         match *self {
@@ -1136,14 +1096,12 @@ impl fmt::Show for UintTy {
     }
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
 pub enum FloatTy {
     TyF32,
     TyF64,
 }
 
-impl Copy for FloatTy {}
-
 impl fmt::Show for FloatTy {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         write!(f, "{}", ast_util::float_ty_to_string(*self))
@@ -1177,7 +1135,7 @@ pub struct Ty {
 }
 
 /// Not represented directly in the AST, referred to by name through a ty_path.
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum PrimTy {
     TyInt(IntTy),
     TyUint(UintTy),
@@ -1187,16 +1145,12 @@ pub enum PrimTy {
     TyChar
 }
 
-impl Copy for PrimTy {}
-
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
 pub enum Onceness {
     Once,
     Many
 }
 
-impl Copy for Onceness {}
-
 impl fmt::Show for Onceness {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         match *self {
@@ -1259,14 +1213,12 @@ pub enum Ty_ {
     TyInfer,
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum AsmDialect {
     AsmAtt,
     AsmIntel
 }
 
-impl Copy for AsmDialect {}
-
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct InlineAsm {
     pub asm: InternedString,
@@ -1433,14 +1385,12 @@ pub struct Variant_ {
 
 pub type Variant = Spanned<Variant_>;
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum PathListItem_ {
     PathListIdent { name: Ident, id: NodeId },
     PathListMod { id: NodeId }
 }
 
-impl Copy for PathListItem_ {}
-
 impl PathListItem_ {
     pub fn id(&self) -> NodeId {
         match *self {
@@ -1494,19 +1444,15 @@ 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, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum AttrStyle {
     AttrOuter,
     AttrInner,
 }
 
-impl Copy for AttrStyle {}
-
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct AttrId(pub uint);
 
-impl Copy for AttrId {}
-
 /// Doc-comments are promoted to attributes that have is_sugared_doc = true
 #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct Attribute_ {
@@ -1536,14 +1482,12 @@ pub struct PolyTraitRef {
     pub trait_ref: TraitRef
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum Visibility {
     Public,
     Inherited,
 }
 
-impl Copy for Visibility {}
-
 impl Visibility {
     pub fn inherit_from(&self, parent_visibility: Visibility) -> Visibility {
         match self {
@@ -1572,15 +1516,13 @@ impl StructField_ {
 
 pub type StructField = Spanned<StructField_>;
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum StructFieldKind {
     NamedField(Ident, Visibility),
     /// Element of a tuple-like struct
     UnnamedField(Visibility),
 }
 
-impl Copy for StructFieldKind {}
-
 impl StructFieldKind {
     pub fn is_unnamed(&self) -> bool {
         match *self {
@@ -1682,15 +1624,13 @@ impl ForeignItem_ {
     }
 }
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub enum UnboxedClosureKind {
     FnUnboxedClosureKind,
     FnMutUnboxedClosureKind,
     FnOnceUnboxedClosureKind,
 }
 
-impl Copy for UnboxedClosureKind {}
-
 /// 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.
diff --git a/src/libsyntax/ast_map/blocks.rs b/src/libsyntax/ast_map/blocks.rs
index 6decfd1c3ad..7c89245f53e 100644
--- a/src/libsyntax/ast_map/blocks.rs
+++ b/src/libsyntax/ast_map/blocks.rs
@@ -41,10 +41,9 @@ use visit;
 ///   - The default implementation for a trait method.
 ///
 /// To construct one, use the `Code::from_node` function.
+#[deriving(Copy)]
 pub struct FnLikeNode<'a> { node: ast_map::Node<'a> }
 
-impl<'a> Copy for FnLikeNode<'a> {}
-
 /// MaybeFnLike wraps a method that indicates if an object
 /// corresponds to some FnLikeNode.
 pub trait MaybeFnLike { fn is_fn_like(&self) -> bool; }
@@ -82,13 +81,12 @@ impl MaybeFnLike for ast::Expr {
 /// Carries either an FnLikeNode or a Block, as these are the two
 /// constructs that correspond to "code" (as in, something from which
 /// we can construct a control-flow graph).
+#[deriving(Copy)]
 pub enum Code<'a> {
     FnLikeCode(FnLikeNode<'a>),
     BlockCode(&'a Block),
 }
 
-impl<'a> Copy for Code<'a> {}
-
 impl<'a> Code<'a> {
     pub fn id(&self) -> ast::NodeId {
         match *self {
diff --git a/src/libsyntax/ast_map/mod.rs b/src/libsyntax/ast_map/mod.rs
index 6089f39e828..a95c9e19906 100644
--- a/src/libsyntax/ast_map/mod.rs
+++ b/src/libsyntax/ast_map/mod.rs
@@ -32,14 +32,12 @@ use std::slice;
 
 pub mod blocks;
 
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, Copy, PartialEq)]
 pub enum PathElem {
     PathMod(Name),
     PathName(Name)
 }
 
-impl Copy for PathElem {}
-
 impl PathElem {
     pub fn name(&self) -> Name {
         match *self {
@@ -102,7 +100,7 @@ pub fn path_to_string<PI: Iterator<PathElem>>(path: PI) -> String {
     }).to_string()
 }
 
-#[deriving(Show)]
+#[deriving(Copy, Show)]
 pub enum Node<'ast> {
     NodeItem(&'ast Item),
     NodeForeignItem(&'ast ForeignItem),
@@ -122,11 +120,9 @@ pub enum Node<'ast> {
     NodeLifetime(&'ast Lifetime),
 }
 
-impl<'ast> Copy for Node<'ast> {}
-
 /// Represents an entry and its parent Node ID
 /// The odd layout is to bring down the total size.
-#[deriving(Show)]
+#[deriving(Copy, Show)]
 enum MapEntry<'ast> {
     /// Placeholder for holes in the map.
     NotPresent,
@@ -151,8 +147,6 @@ enum MapEntry<'ast> {
     RootInlinedParent(&'ast InlinedParent)
 }
 
-impl<'ast> Copy for MapEntry<'ast> {}
-
 impl<'ast> Clone for MapEntry<'ast> {
     fn clone(&self) -> MapEntry<'ast> {
         *self
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index 5243f07f327..02771809ae6 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -343,14 +343,12 @@ pub fn empty_generics() -> Generics {
 // ______________________________________________________________________
 // Enumerating the IDs which appear in an AST
 
-#[deriving(Encodable, Decodable, Show)]
+#[deriving(Copy, Encodable, Decodable, Show)]
 pub struct IdRange {
     pub min: NodeId,
     pub max: NodeId,
 }
 
-impl Copy for IdRange {}
-
 impl IdRange {
     pub fn max() -> IdRange {
         IdRange {
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 598da6a5df0..127cc5ed51d 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -277,7 +277,7 @@ pub fn find_crate_name(attrs: &[Attribute]) -> Option<InternedString> {
     first_attr_value_str_by_name(attrs, "crate_name")
 }
 
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 pub enum InlineAttr {
     InlineNone,
     InlineHint,
@@ -285,8 +285,6 @@ pub enum InlineAttr {
     InlineNever,
 }
 
-impl Copy for InlineAttr {}
-
 /// Determine what `#[inline]` attribute is present in `attrs`, if any.
 pub fn find_inline_attr(attrs: &[Attribute]) -> InlineAttr {
     // FIXME (#2809)---validate the usage of #[inline] and #[inline]
@@ -349,7 +347,7 @@ pub struct Stability {
 }
 
 /// The available stability levels.
-#[deriving(Encodable,Decodable,PartialEq,PartialOrd,Clone,Show)]
+#[deriving(Copy,Encodable,Decodable,PartialEq,PartialOrd,Clone,Show)]
 pub enum StabilityLevel {
     Deprecated,
     Experimental,
@@ -359,8 +357,6 @@ pub enum StabilityLevel {
     Locked
 }
 
-impl Copy for StabilityLevel {}
-
 pub fn find_stability_generic<'a,
                               AM: AttrMetaMethods,
                               I: Iterator<&'a AM>>
@@ -468,7 +464,7 @@ fn int_type_of_word(s: &str) -> Option<IntType> {
     }
 }
 
-#[deriving(PartialEq, Show, Encodable, Decodable)]
+#[deriving(Copy, PartialEq, Show, Encodable, Decodable)]
 pub enum ReprAttr {
     ReprAny,
     ReprInt(Span, IntType),
@@ -476,8 +472,6 @@ pub enum ReprAttr {
     ReprPacked,
 }
 
-impl Copy for ReprAttr {}
-
 impl ReprAttr {
     pub fn is_ffi_safe(&self) -> bool {
         match *self {
@@ -489,14 +483,12 @@ impl ReprAttr {
     }
 }
 
-#[deriving(Eq, Hash, PartialEq, Show, Encodable, Decodable)]
+#[deriving(Copy, Eq, Hash, PartialEq, Show, Encodable, Decodable)]
 pub enum IntType {
     SignedInt(ast::IntTy),
     UnsignedInt(ast::UintTy)
 }
 
-impl Copy for IntType {}
-
 impl IntType {
     #[inline]
     pub fn is_signed(self) -> bool {
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 17cafc2441f..b7c0678cf13 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -31,19 +31,15 @@ pub trait Pos {
 
 /// A byte offset. Keep this small (currently 32-bits), as AST contains
 /// a lot of them.
-#[deriving(Clone, PartialEq, Eq, Hash, PartialOrd, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Show)]
 pub struct BytePos(pub u32);
 
-impl Copy for BytePos {}
-
 /// A character offset. Because of multibyte utf8 characters, a byte offset
 /// is not equivalent to a character offset. The CodeMap will convert BytePos
 /// values to CharPos values as necessary.
-#[deriving(PartialEq, Hash, PartialOrd, Show)]
+#[deriving(Copy, PartialEq, Hash, PartialOrd, Show)]
 pub struct CharPos(pub uint);
 
-impl Copy for CharPos {}
-
 // FIXME: Lots of boilerplate in these impls, but so far my attempts to fix
 // have been unsuccessful
 
@@ -121,7 +117,7 @@ impl Sub<CharPos, CharPos> for CharPos {
 /// are *absolute* positions from the beginning of the codemap, not positions
 /// relative to FileMaps. Methods on the CodeMap can be used to relate spans back
 /// to the original source.
-#[deriving(Clone, Show, Hash)]
+#[deriving(Clone, Copy, Show, Hash)]
 pub struct Span {
     pub lo: BytePos,
     pub hi: BytePos,
@@ -130,18 +126,14 @@ pub struct Span {
     pub expn_id: ExpnId
 }
 
-impl Copy for Span {}
-
 pub const DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: NO_EXPANSION };
 
-#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
+#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
 pub struct Spanned<T> {
     pub node: T,
     pub span: Span,
 }
 
-impl<T:Copy> Copy for Spanned<T> {}
-
 impl PartialEq for Span {
     fn eq(&self, other: &Span) -> bool {
         return (*self).lo == (*other).lo && (*self).hi == (*other).hi;
@@ -219,7 +211,7 @@ pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: uint }
 pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
 
 /// The syntax with which a macro was invoked.
-#[deriving(Clone, Hash, Show)]
+#[deriving(Clone, Copy, Hash, Show)]
 pub enum MacroFormat {
     /// e.g. #[deriving(...)] <item>
     MacroAttribute,
@@ -227,8 +219,6 @@ pub enum MacroFormat {
     MacroBang
 }
 
-impl Copy for MacroFormat {}
-
 #[deriving(Clone, Hash, Show)]
 pub struct NameAndSpan {
     /// The name of the macro that was invoked to create the thing
@@ -264,11 +254,9 @@ pub struct ExpnInfo {
     pub callee: NameAndSpan
 }
 
-#[deriving(PartialEq, Eq, Clone, Show, Hash, Encodable, Decodable)]
+#[deriving(Copy, PartialEq, Eq, Clone, Show, Hash, Encodable, Decodable)]
 pub struct ExpnId(u32);
 
-impl Copy for ExpnId {}
-
 pub const NO_EXPANSION: ExpnId = ExpnId(-1);
 
 impl ExpnId {
@@ -290,6 +278,7 @@ pub struct FileLines {
 }
 
 /// Identifies an offset of a multi-byte character in a FileMap
+#[deriving(Copy)]
 pub struct MultiByteChar {
     /// The absolute offset of the character in the CodeMap
     pub pos: BytePos,
@@ -297,8 +286,6 @@ pub struct MultiByteChar {
     pub bytes: uint,
 }
 
-impl Copy for MultiByteChar {}
-
 /// A single source in the CodeMap
 pub struct FileMap {
     /// The name of the file that the source came from, source that doesn't
diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs
index 3a816987922..4d765f49aca 100644
--- a/src/libsyntax/diagnostic.rs
+++ b/src/libsyntax/diagnostic.rs
@@ -28,7 +28,7 @@ use term;
 /// maximum number of lines we will print for each error; arbitrary.
 static MAX_LINES: uint = 6u;
 
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub enum RenderSpan {
     /// A FullSpan renders with both with an initial line for the
     /// message, prefixed by file:linenum, followed by a summary of
@@ -40,8 +40,6 @@ pub enum RenderSpan {
     FileLine(Span),
 }
 
-impl Copy for RenderSpan {}
-
 impl RenderSpan {
     fn span(self) -> Span {
         match self {
@@ -56,15 +54,13 @@ impl RenderSpan {
     }
 }
 
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub enum ColorConfig {
     Auto,
     Always,
     Never
 }
 
-impl Copy for ColorConfig {}
-
 pub trait Emitter {
     fn emit(&mut self, cmsp: Option<(&codemap::CodeMap, Span)>,
             msg: &str, code: Option<&str>, lvl: Level);
@@ -75,16 +71,14 @@ pub trait Emitter {
 /// This structure is used to signify that a task has panicked with a fatal error
 /// from the diagnostics. You can use this with the `Any` trait to figure out
 /// how a rustc task died (if so desired).
+#[deriving(Copy)]
 pub struct FatalError;
 
-impl Copy for FatalError {}
-
 /// Signifies that the compiler died with an explicit call to `.bug`
 /// or `.span_bug` rather than a failed assertion, etc.
+#[deriving(Copy)]
 pub struct ExplicitBug;
 
-impl Copy for ExplicitBug {}
-
 /// A span-handler is like a handler but also
 /// accepts span information for source-location
 /// reporting.
@@ -228,7 +222,7 @@ pub fn mk_handler(e: Box<Emitter + Send>) -> Handler {
     }
 }
 
-#[deriving(PartialEq, Clone)]
+#[deriving(Copy, PartialEq, Clone)]
 pub enum Level {
     Bug,
     Fatal,
@@ -238,8 +232,6 @@ pub enum Level {
     Help,
 }
 
-impl Copy for Level {}
-
 impl fmt::Show for Level {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         use std::fmt::Show;
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index 354b53bfc01..3947a602809 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -223,13 +223,12 @@ impl MacResult for MacItems {
 
 /// Fill-in macro expansion result, to allow compilation to continue
 /// after hitting errors.
+#[deriving(Copy)]
 pub struct DummyResult {
     expr_only: bool,
     span: Span
 }
 
-impl Copy for DummyResult {}
-
 impl DummyResult {
     /// Create a default MacResult that can be anything.
     ///
diff --git a/src/libsyntax/ext/deriving/cmp/ord.rs b/src/libsyntax/ext/deriving/cmp/ord.rs
index bd1962de56e..10e14e0c975 100644
--- a/src/libsyntax/ext/deriving/cmp/ord.rs
+++ b/src/libsyntax/ext/deriving/cmp/ord.rs
@@ -83,12 +83,11 @@ pub fn expand_deriving_ord<F>(cx: &mut ExtCtxt,
     trait_def.expand(cx, mitem, item, push)
 }
 
+#[deriving(Copy)]
 pub enum OrderingOp {
     PartialCmpOp, LtOp, LeOp, GtOp, GeOp,
 }
 
-impl Copy for OrderingOp {}
-
 pub fn some_ordering_collapsed(cx: &mut ExtCtxt,
                                span: Span,
                                op: OrderingOp,
diff --git a/src/libsyntax/ext/mtwt.rs b/src/libsyntax/ext/mtwt.rs
index 33936e6213f..ae979020bc7 100644
--- a/src/libsyntax/ext/mtwt.rs
+++ b/src/libsyntax/ext/mtwt.rs
@@ -39,7 +39,7 @@ pub struct SCTable {
     rename_memo: RefCell<HashMap<(SyntaxContext,Ident,Name),SyntaxContext>>,
 }
 
-#[deriving(PartialEq, Encodable, Decodable, Hash, Show)]
+#[deriving(Copy, PartialEq, Encodable, Decodable, Hash, Show)]
 pub enum SyntaxContext_ {
     EmptyCtxt,
     Mark (Mrk,SyntaxContext),
@@ -56,8 +56,6 @@ pub enum SyntaxContext_ {
     IllegalCtxt
 }
 
-impl Copy for SyntaxContext_ {}
-
 /// A list of ident->name renamings
 pub type RenameList = Vec<(Ident, Name)>;
 
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 9656629e14d..0e0a87c74f8 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -97,6 +97,7 @@ enum Status {
 }
 
 /// A set of features to be used by later passes.
+#[deriving(Copy)]
 pub struct Features {
     pub default_type_params: bool,
     pub unboxed_closures: bool,
@@ -107,8 +108,6 @@ pub struct Features {
     pub opt_out_copy: bool,
 }
 
-impl Copy for Features {}
-
 impl Features {
     pub fn new() -> Features {
         Features {
diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs
index a17d66476c0..95bae63f58f 100644
--- a/src/libsyntax/parse/lexer/comments.rs
+++ b/src/libsyntax/parse/lexer/comments.rs
@@ -24,7 +24,7 @@ use std::str;
 use std::string::String;
 use std::uint;
 
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, Copy, PartialEq)]
 pub enum CommentStyle {
     /// No code on either side of each line of the comment
     Isolated,
@@ -36,8 +36,6 @@ pub enum CommentStyle {
     BlankLine,
 }
 
-impl Copy for CommentStyle {}
-
 #[deriving(Clone)]
 pub struct Comment {
     pub style: CommentStyle,
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index 3a7cc77515d..a6ddcbf9ac4 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -22,7 +22,7 @@ use parse::token;
 use ptr::P;
 
 /// The specific types of unsupported syntax
-#[deriving(PartialEq, Eq, Hash)]
+#[deriving(Copy, PartialEq, Eq, Hash)]
 pub enum ObsoleteSyntax {
     ObsoleteOwnedType,
     ObsoleteOwnedExpr,
@@ -36,8 +36,6 @@ pub enum ObsoleteSyntax {
     ObsoleteProcExpr,
 }
 
-impl Copy for ObsoleteSyntax {}
-
 pub trait ParserObsoleteMethods {
     /// Reports an obsolete syntax non-fatal error.
     fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax);
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index c234c172fd8..3ad224b93ce 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -104,7 +104,7 @@ type ItemInfo = (Ident, Item_, Option<Vec<Attribute> >);
 
 /// How to parse a path. There are four different kinds of paths, all of which
 /// are parsed somewhat differently.
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 pub enum PathParsingMode {
     /// A path with no type parameters; e.g. `foo::bar::Baz`
     NoTypesAllowed,
@@ -116,8 +116,6 @@ pub enum PathParsingMode {
     LifetimeAndTypesWithColons,
 }
 
-impl Copy for PathParsingMode {}
-
 enum ItemOrViewItem {
     /// Indicates a failure to parse any kind of item. The attributes are
     /// returned.
diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs
index 641239f1f8b..dad369792d7 100644
--- a/src/libsyntax/parse/token.rs
+++ b/src/libsyntax/parse/token.rs
@@ -28,7 +28,7 @@ use std::path::BytesContainer;
 use std::rc::Rc;
 
 #[allow(non_camel_case_types)]
-#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
+#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
 pub enum BinOpToken {
     Plus,
     Minus,
@@ -42,10 +42,8 @@ pub enum BinOpToken {
     Shr,
 }
 
-impl Copy for BinOpToken {}
-
 /// A delimeter token
-#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
+#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
 pub enum DelimToken {
     /// A round parenthesis: `(` or `)`
     Paren,
@@ -55,16 +53,14 @@ pub enum DelimToken {
     Brace,
 }
 
-impl Copy for DelimToken {}
-
-#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
+#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
 pub enum IdentStyle {
     /// `::` follows the identifier with no whitespace in-between.
     ModName,
     Plain,
 }
 
-#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
+#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
 pub enum Lit {
     Byte(ast::Name),
     Char(ast::Name),
@@ -89,10 +85,6 @@ impl Lit {
     }
 }
 
-impl Copy for Lit {}
-
-impl Copy for IdentStyle {}
-
 #[allow(non_camel_case_types)]
 #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
 pub enum Token {
@@ -438,13 +430,12 @@ macro_rules! declare_special_idents_and_keywords {(
         pub use self::Keyword::*;
         use ast;
 
+        #[deriving(Copy)]
         pub enum Keyword {
             $( $sk_variant, )*
             $( $rk_variant, )*
         }
 
-        impl Copy for Keyword {}
-
         impl Keyword {
             pub fn to_name(&self) -> ast::Name {
                 match *self {
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs
index c4e040a0f7c..bfa47a46e74 100644
--- a/src/libsyntax/print/pp.rs
+++ b/src/libsyntax/print/pp.rs
@@ -66,30 +66,24 @@ pub use self::Token::*;
 use std::io;
 use std::string;
 
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, Copy, PartialEq)]
 pub enum Breaks {
     Consistent,
     Inconsistent,
 }
 
-impl Copy for Breaks {}
-
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct BreakToken {
     offset: int,
     blank_space: int
 }
 
-impl Copy for BreakToken {}
-
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct BeginToken {
     offset: int,
     breaks: Breaks
 }
 
-impl Copy for BeginToken {}
-
 #[deriving(Clone)]
 pub enum Token {
     String(string::String, int),
@@ -153,20 +147,18 @@ pub fn buf_str(toks: Vec<Token>,
     return s.into_string();
 }
 
+#[deriving(Copy)]
 pub enum PrintStackBreak {
     Fits,
     Broken(Breaks),
 }
 
-impl Copy for PrintStackBreak {}
-
+#[deriving(Copy)]
 pub struct PrintStackElem {
     offset: int,
     pbreak: PrintStackBreak
 }
 
-impl Copy for PrintStackElem {}
-
 static SIZE_INFINITY: int = 0xffff;
 
 pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: uint) -> Printer {
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 1dd61a5ce19..d2cc0cba317 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -45,19 +45,17 @@ pub trait PpAnn {
     fn post(&self, _state: &mut State, _node: AnnNode) -> IoResult<()> { Ok(()) }
 }
 
+#[deriving(Copy)]
 pub struct NoAnn;
 
-impl Copy for NoAnn {}
-
 impl PpAnn for NoAnn {}
 
+#[deriving(Copy)]
 pub struct CurrentCommentAndLiteral {
     cur_cmnt: uint,
     cur_lit: uint,
 }
 
-impl Copy for CurrentCommentAndLiteral {}
-
 pub struct State<'a> {
     pub s: pp::Printer,
     cm: Option<&'a CodeMap>,
diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs
index 5a1a186c74c..b89e9a59349 100644
--- a/src/libsyntax/visit.rs
+++ b/src/libsyntax/visit.rs
@@ -32,6 +32,7 @@ use codemap::Span;
 use ptr::P;
 use owned_slice::OwnedSlice;
 
+#[deriving(Copy)]
 pub enum FnKind<'a> {
     /// fn foo() or extern "Abi" fn foo()
     FkItemFn(Ident, &'a Generics, Unsafety, Abi),
@@ -44,8 +45,6 @@ pub enum FnKind<'a> {
     FkFnBlock,
 }
 
-impl<'a> Copy for FnKind<'a> {}
-
 /// Each method of the Visitor trait is a hook to be potentially
 /// overridden.  Each method's default implementation recursively visits
 /// the substructure of the input via the corresponding `walk` method;