about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-14 23:14:38 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-19 10:51:00 -0500
commit5e2bca9e86ee6e40d6aaf6e4f4ba60a6e71b01e4 (patch)
tree45a3432c1335fa6ef038ef334862b9463b08e746 /src
parent463475b7fa95cfeddbe9e153b1fdf408965252da (diff)
librustc_trans: use `#[deriving(Copy)]`
Diffstat (limited to 'src')
-rw-r--r--src/librustc_trans/back/write.rs4
-rw-r--r--src/librustc_trans/save/recorder.rs3
-rw-r--r--src/librustc_trans/trans/_match.rs16
-rw-r--r--src/librustc_trans/trans/adt.rs4
-rw-r--r--src/librustc_trans/trans/base.rs10
-rw-r--r--src/librustc_trans/trans/basic_block.rs3
-rw-r--r--src/librustc_trans/trans/cabi.rs8
-rw-r--r--src/librustc_trans/trans/cabi_x86_64.rs4
-rw-r--r--src/librustc_trans/trans/callee.rs6
-rw-r--r--src/librustc_trans/trans/cleanup.rs31
-rw-r--r--src/librustc_trans/trans/closure.rs3
-rw-r--r--src/librustc_trans/trans/common.rs10
-rw-r--r--src/librustc_trans/trans/datum.rs12
-rw-r--r--src/librustc_trans/trans/debuginfo.rs11
-rw-r--r--src/librustc_trans/trans/expr.rs8
-rw-r--r--src/librustc_trans/trans/mod.rs3
-rw-r--r--src/librustc_trans/trans/tvec.rs3
-rw-r--r--src/librustc_trans/trans/type_.rs4
-rw-r--r--src/librustc_trans/trans/type_of.rs3
-rw-r--r--src/librustc_trans/trans/value.rs6
20 files changed, 43 insertions, 109 deletions
diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs
index df7df2f08d9..489d29492c2 100644
--- a/src/librustc_trans/back/write.rs
+++ b/src/librustc_trans/back/write.rs
@@ -33,7 +33,7 @@ use std::sync::{Arc, Mutex};
 use std::thread;
 use libc::{c_uint, c_int, c_void};
 
-#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
+#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
 pub enum OutputType {
     OutputTypeBitcode,
     OutputTypeAssembly,
@@ -42,8 +42,6 @@ pub enum OutputType {
     OutputTypeExe,
 }
 
-impl Copy for OutputType {}
-
 pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! {
     unsafe {
         let cstr = llvm::LLVMRustGetLastError();
diff --git a/src/librustc_trans/save/recorder.rs b/src/librustc_trans/save/recorder.rs
index c15ff1d7f0a..37d9e5d9940 100644
--- a/src/librustc_trans/save/recorder.rs
+++ b/src/librustc_trans/save/recorder.rs
@@ -61,6 +61,7 @@ macro_rules! svec {
     })
 }
 
+#[deriving(Copy)]
 pub enum Row {
     Variable,
     Enum,
@@ -87,8 +88,6 @@ pub enum Row {
     FnRef,
 }
 
-impl Copy for Row {}
-
 impl<'a> FmtStrs<'a> {
     pub fn new(rec: Box<Recorder>, span: SpanUtils<'a>, krate: String) -> FmtStrs<'a> {
         FmtStrs {
diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs
index bf17043f0e4..1401f1ad1f5 100644
--- a/src/librustc_trans/trans/_match.rs
+++ b/src/librustc_trans/trans/_match.rs
@@ -228,11 +228,9 @@ use syntax::codemap::Span;
 use syntax::fold::Folder;
 use syntax::ptr::P;
 
-#[deriving(Show)]
+#[deriving(Copy, Show)]
 struct ConstantExpr<'a>(&'a ast::Expr);
 
-impl<'a> Copy for ConstantExpr<'a> {}
-
 impl<'a> ConstantExpr<'a> {
     fn eq(self, other: ConstantExpr<'a>, tcx: &ty::ctxt) -> bool {
         let ConstantExpr(expr) = self;
@@ -301,7 +299,7 @@ impl<'a, 'tcx> Opt<'a, 'tcx> {
     }
 }
 
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 pub enum BranchKind {
     NoBranch,
     Single,
@@ -310,23 +308,19 @@ pub enum BranchKind {
     CompareSliceLength
 }
 
-impl Copy for BranchKind {}
-
 pub enum OptResult<'blk, 'tcx: 'blk> {
     SingleResult(Result<'blk, 'tcx>),
     RangeResult(Result<'blk, 'tcx>, Result<'blk, 'tcx>),
     LowerBound(Result<'blk, 'tcx>)
 }
 
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub enum TransBindingMode {
     TrByCopy(/* llbinding */ ValueRef),
     TrByMove,
     TrByRef,
 }
 
-impl Copy for TransBindingMode {}
-
 /// Information about a pattern binding:
 /// - `llmatch` is a pointer to a stack slot.  The stack slot contains a
 ///   pointer into the value being matched.  Hence, llmatch has type `T**`
@@ -334,7 +328,7 @@ impl Copy for TransBindingMode {}
 /// - `trmode` is the trans binding mode
 /// - `id` is the node id of the binding
 /// - `ty` is the Rust type of the binding
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct BindingInfo<'tcx> {
     pub llmatch: ValueRef,
     pub trmode: TransBindingMode,
@@ -343,8 +337,6 @@ pub struct BindingInfo<'tcx> {
     pub ty: Ty<'tcx>,
 }
 
-impl<'tcx> Copy for BindingInfo<'tcx> {}
-
 type BindingsMap<'tcx> = FnvHashMap<Ident, BindingInfo<'tcx>>;
 
 struct ArmData<'p, 'blk, 'tcx: 'blk> {
diff --git a/src/librustc_trans/trans/adt.rs b/src/librustc_trans/trans/adt.rs
index 0c2c86fc32d..f7edb281b9e 100644
--- a/src/librustc_trans/trans/adt.rs
+++ b/src/librustc_trans/trans/adt.rs
@@ -281,14 +281,12 @@ struct Case<'tcx> {
 }
 
 
-#[deriving(Eq, PartialEq, Show)]
+#[deriving(Copy, Eq, PartialEq, Show)]
 pub enum PointerField {
     ThinPointer(uint),
     FatPointer(uint)
 }
 
-impl Copy for PointerField {}
-
 impl<'tcx> Case<'tcx> {
     fn is_zerolen<'a>(&self, cx: &CrateContext<'a, 'tcx>, scapegoat: Ty<'tcx>)
                       -> bool {
diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs
index b947b1746fc..25fbaa66776 100644
--- a/src/librustc_trans/trans/base.rs
+++ b/src/librustc_trans/trans/base.rs
@@ -565,10 +565,9 @@ pub fn maybe_name_value(cx: &CrateContext, v: ValueRef, s: &str) {
 
 
 // Used only for creating scalar comparison glue.
+#[deriving(Copy)]
 pub enum scalar_type { nil_type, signed_int, unsigned_int, floating_point, }
 
-impl Copy for scalar_type {}
-
 pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
                                         lhs: ValueRef,
                                         rhs: ValueRef,
@@ -1792,14 +1791,12 @@ pub fn build_return_block<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>,
     }
 }
 
-#[deriving(Clone, Eq, PartialEq)]
+#[deriving(Clone, Copy, Eq, PartialEq)]
 pub enum IsUnboxedClosureFlag {
     NotUnboxedClosure,
     IsUnboxedClosure,
 }
 
-impl Copy for IsUnboxedClosureFlag {}
-
 // trans_closure: Builds an LLVM function out of a source function.
 // If the function closes over its environment a closure will be
 // returned.
@@ -2194,6 +2191,7 @@ pub fn llvm_linkage_by_name(name: &str) -> Option<Linkage> {
 
 
 /// Enum describing the origin of an LLVM `Value`, for linkage purposes.
+#[deriving(Copy)]
 pub enum ValueOrigin {
     /// The LLVM `Value` is in this context because the corresponding item was
     /// assigned to the current compilation unit.
@@ -2204,8 +2202,6 @@ pub enum ValueOrigin {
     InlinedCopy,
 }
 
-impl Copy for ValueOrigin {}
-
 /// Set the appropriate linkage for an LLVM `ValueRef` (function or global).
 /// If the `llval` is the direct translation of a specific Rust item, `id`
 /// should be set to the `NodeId` of that item.  (This mapping should be
diff --git a/src/librustc_trans/trans/basic_block.rs b/src/librustc_trans/trans/basic_block.rs
index dca106a3897..476f5e2d618 100644
--- a/src/librustc_trans/trans/basic_block.rs
+++ b/src/librustc_trans/trans/basic_block.rs
@@ -13,10 +13,9 @@ use llvm::{BasicBlockRef};
 use trans::value::{Users, Value};
 use std::iter::{Filter, Map};
 
+#[deriving(Copy)]
 pub struct BasicBlock(pub BasicBlockRef);
 
-impl Copy for BasicBlock {}
-
 pub type Preds = Map<
     Value,
     BasicBlock,
diff --git a/src/librustc_trans/trans/cabi.rs b/src/librustc_trans/trans/cabi.rs
index 7aabd998f7a..ad2a6db1222 100644
--- a/src/librustc_trans/trans/cabi.rs
+++ b/src/librustc_trans/trans/cabi.rs
@@ -20,7 +20,7 @@ use trans::cabi_arm;
 use trans::cabi_mips;
 use trans::type_::Type;
 
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, Copy, PartialEq)]
 pub enum ArgKind {
     /// Pass the argument directly using the normal converted
     /// LLVM type or by coercing to another specified type
@@ -31,13 +31,11 @@ pub enum ArgKind {
     Ignore,
 }
 
-impl Copy for ArgKind {}
-
 /// Information about how a specific C type
 /// should be passed to or returned from a function
 ///
 /// This is borrowed from clang's ABIInfo.h
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct ArgType {
     pub kind: ArgKind,
     /// Original LLVM type
@@ -50,8 +48,6 @@ pub struct ArgType {
     pub attr: option::Option<Attribute>
 }
 
-impl Copy for ArgType {}
-
 impl ArgType {
     pub fn direct(ty: Type, cast: option::Option<Type>,
                             pad: option::Option<Type>,
diff --git a/src/librustc_trans/trans/cabi_x86_64.rs b/src/librustc_trans/trans/cabi_x86_64.rs
index 4a6bc58051c..9b678a4f3ae 100644
--- a/src/librustc_trans/trans/cabi_x86_64.rs
+++ b/src/librustc_trans/trans/cabi_x86_64.rs
@@ -24,7 +24,7 @@ use trans::type_::Type;
 
 use std::cmp;
 
-#[deriving(Clone, PartialEq)]
+#[deriving(Clone, Copy, PartialEq)]
 enum RegClass {
     NoClass,
     Int,
@@ -40,8 +40,6 @@ enum RegClass {
     Memory
 }
 
-impl Copy for RegClass {}
-
 trait TypeMethods {
     fn is_reg_ty(&self) -> bool;
 }
diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs
index f8303a6f030..3376479b7a4 100644
--- a/src/librustc_trans/trans/callee.rs
+++ b/src/librustc_trans/trans/callee.rs
@@ -57,13 +57,12 @@ use syntax::ast;
 use syntax::ast_map;
 use syntax::ptr::P;
 
+#[deriving(Copy)]
 pub struct MethodData {
     pub llfn: ValueRef,
     pub llself: ValueRef,
 }
 
-impl Copy for MethodData {}
-
 pub enum CalleeData<'tcx> {
     Closure(Datum<'tcx, Lvalue>),
 
@@ -1049,13 +1048,12 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
     bcx
 }
 
+#[deriving(Copy)]
 pub enum AutorefArg {
     DontAutorefArg,
     DoAutorefArg(ast::NodeId)
 }
 
-impl Copy for AutorefArg {}
-
 pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                    formal_arg_ty: Ty<'tcx>,
                                    arg_datum: Datum<'tcx, Expr>,
diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/trans/cleanup.rs
index e8857de7b73..fb2c432ef5c 100644
--- a/src/librustc_trans/trans/cleanup.rs
+++ b/src/librustc_trans/trans/cleanup.rs
@@ -50,13 +50,11 @@ pub struct CleanupScope<'blk, 'tcx: 'blk> {
     cached_landing_pad: Option<BasicBlockRef>,
 }
 
-#[deriving(Show)]
+#[deriving(Copy, Show)]
 pub struct CustomScopeIndex {
     index: uint
 }
 
-impl Copy for CustomScopeIndex {}
-
 pub const EXIT_BREAK: uint = 0;
 pub const EXIT_LOOP: uint = 1;
 pub const EXIT_MAX: uint = 2;
@@ -83,22 +81,19 @@ impl<'blk, 'tcx: 'blk> fmt::Show for CleanupScopeKind<'blk, 'tcx> {
     }
 }
 
-#[deriving(PartialEq, Show)]
+#[deriving(Copy, PartialEq, Show)]
 pub enum EarlyExitLabel {
     UnwindExit,
     ReturnExit,
     LoopExit(ast::NodeId, uint)
 }
 
-impl Copy for EarlyExitLabel {}
-
+#[deriving(Copy)]
 pub struct CachedEarlyExit {
     label: EarlyExitLabel,
     cleanup_block: BasicBlockRef,
 }
 
-impl Copy for CachedEarlyExit {}
-
 pub trait Cleanup<'tcx> {
     fn must_unwind(&self) -> bool;
     fn clean_on_unwind(&self) -> bool;
@@ -111,14 +106,12 @@ pub trait Cleanup<'tcx> {
 
 pub type CleanupObj<'tcx> = Box<Cleanup<'tcx>+'tcx>;
 
-#[deriving(Show)]
+#[deriving(Copy, Show)]
 pub enum ScopeId {
     AstScope(ast::NodeId),
     CustomScope(CustomScopeIndex)
 }
 
-impl Copy for ScopeId {}
-
 impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
     /// Invoked when we start to trans the code contained within a new cleanup scope.
     fn push_ast_cleanup_scope(&self, debug_loc: NodeInfo) {
@@ -876,6 +869,7 @@ impl EarlyExitLabel {
 ///////////////////////////////////////////////////////////////////////////
 // Cleanup types
 
+#[deriving(Copy)]
 pub struct DropValue<'tcx> {
     is_immediate: bool,
     must_unwind: bool,
@@ -884,8 +878,6 @@ pub struct DropValue<'tcx> {
     zero: bool
 }
 
-impl<'tcx> Copy for DropValue<'tcx> {}
-
 impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
     fn must_unwind(&self) -> bool {
         self.must_unwind
@@ -915,21 +907,18 @@ impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
     }
 }
 
-#[deriving(Show)]
+#[deriving(Copy, Show)]
 pub enum Heap {
     HeapExchange
 }
 
-impl Copy for Heap {}
-
+#[deriving(Copy)]
 pub struct FreeValue<'tcx> {
     ptr: ValueRef,
     heap: Heap,
     content_ty: Ty<'tcx>
 }
 
-impl<'tcx> Copy for FreeValue<'tcx> {}
-
 impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
     fn must_unwind(&self) -> bool {
         true
@@ -957,6 +946,7 @@ impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
     }
 }
 
+#[deriving(Copy)]
 pub struct FreeSlice {
     ptr: ValueRef,
     size: ValueRef,
@@ -964,8 +954,6 @@ pub struct FreeSlice {
     heap: Heap,
 }
 
-impl Copy for FreeSlice {}
-
 impl<'tcx> Cleanup<'tcx> for FreeSlice {
     fn must_unwind(&self) -> bool {
         true
@@ -993,12 +981,11 @@ impl<'tcx> Cleanup<'tcx> for FreeSlice {
     }
 }
 
+#[deriving(Copy)]
 pub struct LifetimeEnd {
     ptr: ValueRef,
 }
 
-impl Copy for LifetimeEnd {}
-
 impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
     fn must_unwind(&self) -> bool {
         false
diff --git a/src/librustc_trans/trans/closure.rs b/src/librustc_trans/trans/closure.rs
index af3daf224e3..d5d954f5a90 100644
--- a/src/librustc_trans/trans/closure.rs
+++ b/src/librustc_trans/trans/closure.rs
@@ -102,13 +102,12 @@ use syntax::ast_util;
 //
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+#[deriving(Copy)]
 pub struct EnvValue<'tcx> {
     action: ast::CaptureClause,
     datum: Datum<'tcx, Lvalue>
 }
 
-impl<'tcx> Copy for EnvValue<'tcx> {}
-
 impl<'tcx> EnvValue<'tcx> {
     pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
         format!("{}({})", self.action, self.datum.to_string(ccx))
diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs
index a8e88eca0e1..4dd4e27c9c0 100644
--- a/src/librustc_trans/trans/common.rs
+++ b/src/librustc_trans/trans/common.rs
@@ -119,6 +119,7 @@ pub fn gensym_name(name: &str) -> PathElem {
     PathName(token::gensym(format!("{}:{}", name, num).as_slice()))
 }
 
+#[deriving(Copy)]
 pub struct tydesc_info<'tcx> {
     pub ty: Ty<'tcx>,
     pub tydesc: ValueRef,
@@ -127,8 +128,6 @@ pub struct tydesc_info<'tcx> {
     pub name: ValueRef,
 }
 
-impl<'tcx> Copy for tydesc_info<'tcx> {}
-
 /*
  * A note on nomenclature of linking: "extern", "foreign", and "upcall".
  *
@@ -155,13 +154,12 @@ impl<'tcx> Copy for tydesc_info<'tcx> {}
  *
  */
 
+#[deriving(Copy)]
 pub struct NodeInfo {
     pub id: ast::NodeId,
     pub span: Span,
 }
 
-impl Copy for NodeInfo {}
-
 pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
     NodeInfo { id: expr.id, span: expr.span }
 }
@@ -863,7 +861,7 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
 }
 
 // Key used to lookup values supplied for type parameters in an expr.
-#[deriving(PartialEq, Show)]
+#[deriving(Copy, PartialEq, Show)]
 pub enum ExprOrMethodCall {
     // Type parameters for a path like `None::<int>`
     ExprId(ast::NodeId),
@@ -872,8 +870,6 @@ pub enum ExprOrMethodCall {
     MethodCall(ty::MethodCall)
 }
 
-impl Copy for ExprOrMethodCall {}
-
 pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
                                   node: ExprOrMethodCall)
                                   -> subst::Substs<'tcx> {
diff --git a/src/librustc_trans/trans/datum.rs b/src/librustc_trans/trans/datum.rs
index e32b5792e5d..75473dc58bf 100644
--- a/src/librustc_trans/trans/datum.rs
+++ b/src/librustc_trans/trans/datum.rs
@@ -33,7 +33,7 @@ use syntax::ast;
 /// describes where the value is stored, what Rust type the value has,
 /// whether it is addressed by reference, and so forth. Please refer
 /// the section on datums in `doc.rs` for more details.
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct Datum<'tcx, K> {
     /// The llvm value.  This is either a pointer to the Rust value or
     /// the value itself, depending on `kind` below.
@@ -46,8 +46,6 @@ pub struct Datum<'tcx, K> {
     pub kind: K,
 }
 
-impl<'tcx,K:Copy> Copy for Datum<'tcx,K> {}
-
 pub struct DatumBlock<'blk, 'tcx: 'blk, K> {
     pub bcx: Block<'blk, 'tcx>,
     pub datum: Datum<'tcx, K>,
@@ -65,11 +63,9 @@ pub enum Expr {
     LvalueExpr,
 }
 
-#[deriving(Clone, Show)]
+#[deriving(Clone, Copy, Show)]
 pub struct Lvalue;
 
-impl Copy for Lvalue {}
-
 #[deriving(Show)]
 pub struct Rvalue {
     pub mode: RvalueMode
@@ -86,7 +82,7 @@ impl Drop for Rvalue {
     fn drop(&mut self) { }
 }
 
-#[deriving(PartialEq, Eq, Hash, Show)]
+#[deriving(Copy, PartialEq, Eq, Hash, Show)]
 pub enum RvalueMode {
     /// `val` is a pointer to the actual value (and thus has type *T)
     ByRef,
@@ -95,8 +91,6 @@ pub enum RvalueMode {
     ByValue,
 }
 
-impl Copy for RvalueMode {}
-
 pub fn immediate_rvalue<'tcx>(val: ValueRef, ty: Ty<'tcx>) -> Datum<'tcx, Rvalue> {
     return Datum::new(val, ty, Rvalue::new(ByValue));
 }
diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs
index 96c39b5796e..9a5e6830da1 100644
--- a/src/librustc_trans/trans/debuginfo.rs
+++ b/src/librustc_trans/trans/debuginfo.rs
@@ -248,11 +248,9 @@ static FLAGS_NONE: c_uint = 0;
 //  Public Interface of debuginfo module
 //=-----------------------------------------------------------------------------
 
-#[deriving(Show, Hash, Eq, PartialEq, Clone)]
+#[deriving(Copy, Show, Hash, Eq, PartialEq, Clone)]
 struct UniqueTypeId(ast::Name);
 
-impl Copy for UniqueTypeId {}
-
 // The TypeMap is where the CrateDebugContext holds the type metadata nodes
 // created so far. The metadata nodes are indexed by UniqueTypeId, and, for
 // faster lookup, also by Ty. The TypeMap is responsible for creating
@@ -2320,14 +2318,13 @@ impl<'tcx> VariantMemberDescriptionFactory<'tcx> {
     }
 }
 
+#[deriving(Copy)]
 enum EnumDiscriminantInfo {
     RegularDiscriminant(DIType),
     OptimizedDiscriminant(adt::PointerField),
     NoDiscriminant
 }
 
-impl Copy for EnumDiscriminantInfo {}
-
 // Returns a tuple of (1) type_metadata_stub of the variant, (2) the llvm_type
 // of the variant, and (3) a MemberDescriptionFactory for producing the
 // descriptions of the fields of the variant. This is a rudimentary version of a
@@ -3047,14 +3044,12 @@ impl MetadataCreationResult {
     }
 }
 
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 enum DebugLocation {
     KnownLocation { scope: DIScope, line: uint, col: uint },
     UnknownLocation
 }
 
-impl Copy for DebugLocation {}
-
 impl DebugLocation {
     fn new(scope: DIScope, line: uint, col: uint) -> DebugLocation {
         KnownLocation {
diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs
index db44e0ce271..dd87879b737 100644
--- a/src/librustc_trans/trans/expr.rs
+++ b/src/librustc_trans/trans/expr.rs
@@ -73,14 +73,12 @@ use std::rc::Rc;
 // These are passed around by the code generating functions to track the
 // destination of a computation's value.
 
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 pub enum Dest {
     SaveIn(ValueRef),
     Ignore,
 }
 
-impl Copy for Dest {}
-
 impl Dest {
     pub fn to_string(&self, ccx: &CrateContext) -> String {
         match *self {
@@ -1889,7 +1887,7 @@ fn float_cast(bcx: Block,
     } else { llsrc };
 }
 
-#[deriving(PartialEq, Show)]
+#[deriving(Copy, PartialEq, Show)]
 pub enum cast_kind {
     cast_pointer,
     cast_integral,
@@ -1898,8 +1896,6 @@ pub enum cast_kind {
     cast_other,
 }
 
-impl Copy for cast_kind {}
-
 pub fn cast_type_kind<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> cast_kind {
     match t.sty {
         ty::ty_char        => cast_integral,
diff --git a/src/librustc_trans/trans/mod.rs b/src/librustc_trans/trans/mod.rs
index 9234dfc48bd..05797d74fee 100644
--- a/src/librustc_trans/trans/mod.rs
+++ b/src/librustc_trans/trans/mod.rs
@@ -54,13 +54,12 @@ mod basic_block;
 mod llrepr;
 mod cleanup;
 
+#[deriving(Copy)]
 pub struct ModuleTranslation {
     pub llcx: ContextRef,
     pub llmod: ModuleRef,
 }
 
-impl Copy for ModuleTranslation {}
-
 pub struct CrateTranslation {
     pub modules: Vec<ModuleTranslation>,
     pub metadata_module: ModuleTranslation,
diff --git a/src/librustc_trans/trans/tvec.rs b/src/librustc_trans/trans/tvec.rs
index 18ea8055a4e..e09032ac2d0 100644
--- a/src/librustc_trans/trans/tvec.rs
+++ b/src/librustc_trans/trans/tvec.rs
@@ -89,6 +89,7 @@ pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
     })
 }
 
+#[deriving(Copy)]
 pub struct VecTypes<'tcx> {
     pub unit_ty: Ty<'tcx>,
     pub llunit_ty: Type,
@@ -96,8 +97,6 @@ pub struct VecTypes<'tcx> {
     pub llunit_alloc_size: u64
 }
 
-impl<'tcx> Copy for VecTypes<'tcx> {}
-
 impl<'tcx> VecTypes<'tcx> {
     pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
         format!("VecTypes {{unit_ty={}, llunit_ty={}, \
diff --git a/src/librustc_trans/trans/type_.rs b/src/librustc_trans/trans/type_.rs
index 70b1e99ce8e..51a0533a7bb 100644
--- a/src/librustc_trans/trans/type_.rs
+++ b/src/librustc_trans/trans/type_.rs
@@ -25,14 +25,12 @@ use std::cell::RefCell;
 
 use libc::c_uint;
 
-#[deriving(Clone, PartialEq, Show)]
+#[deriving(Clone, Copy, PartialEq, Show)]
 #[repr(C)]
 pub struct Type {
     rf: TypeRef
 }
 
-impl Copy for Type {}
-
 macro_rules! ty {
     ($e:expr) => ( Type::from_ref(unsafe { $e }))
 }
diff --git a/src/librustc_trans/trans/type_of.rs b/src/librustc_trans/trans/type_of.rs
index aa6fd7f0b39..2801e0ccead 100644
--- a/src/librustc_trans/trans/type_of.rs
+++ b/src/librustc_trans/trans/type_of.rs
@@ -443,14 +443,13 @@ pub fn align_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>)
 }
 
 // Want refinements! (Or case classes, I guess
+#[deriving(Copy)]
 pub enum named_ty {
     a_struct,
     an_enum,
     an_unboxed_closure,
 }
 
-impl Copy for named_ty {}
-
 pub fn llvm_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
                                 what: named_ty,
                                 did: ast::DefId,
diff --git a/src/librustc_trans/trans/value.rs b/src/librustc_trans/trans/value.rs
index c7cf86fb184..4f9b8c5ea37 100644
--- a/src/librustc_trans/trans/value.rs
+++ b/src/librustc_trans/trans/value.rs
@@ -14,10 +14,9 @@ use trans::basic_block::BasicBlock;
 use trans::common::Block;
 use libc::c_uint;
 
+#[deriving(Copy)]
 pub struct Value(pub ValueRef);
 
-impl Copy for Value {}
-
 macro_rules! opt_val { ($e:expr) => (
     unsafe {
         match $e {
@@ -126,10 +125,9 @@ impl Value {
 }
 
 /// Wrapper for LLVM UseRef
+#[deriving(Copy)]
 pub struct Use(UseRef);
 
-impl Copy for Use {}
-
 impl Use {
     pub fn get(&self) -> UseRef {
         let Use(v) = *self; v