]> git.lizzy.rs Git - rust.git/commitdiff
librustc_trans: use `#[deriving(Copy)]`
authorJorge Aparicio <japaricious@gmail.com>
Mon, 15 Dec 2014 04:14:38 +0000 (23:14 -0500)
committerJorge Aparicio <japaricious@gmail.com>
Fri, 19 Dec 2014 15:51:00 +0000 (10:51 -0500)
20 files changed:
src/librustc_trans/back/write.rs
src/librustc_trans/save/recorder.rs
src/librustc_trans/trans/_match.rs
src/librustc_trans/trans/adt.rs
src/librustc_trans/trans/base.rs
src/librustc_trans/trans/basic_block.rs
src/librustc_trans/trans/cabi.rs
src/librustc_trans/trans/cabi_x86_64.rs
src/librustc_trans/trans/callee.rs
src/librustc_trans/trans/cleanup.rs
src/librustc_trans/trans/closure.rs
src/librustc_trans/trans/common.rs
src/librustc_trans/trans/datum.rs
src/librustc_trans/trans/debuginfo.rs
src/librustc_trans/trans/expr.rs
src/librustc_trans/trans/mod.rs
src/librustc_trans/trans/tvec.rs
src/librustc_trans/trans/type_.rs
src/librustc_trans/trans/type_of.rs
src/librustc_trans/trans/value.rs

index df7df2f08d9839f84b8ac6b7bd5ce77f340d6f33..489d29492c227827165d597d182262575c2c0b86 100644 (file)
@@ -33,7 +33,7 @@
 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();
index c15ff1d7f0a9d2fc00098d5766dc64ae6be60446..37d9e5d9940730fbc3b19cf123290301a04daad5 100644 (file)
@@ -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 {
index bf17043f0e4eeaccde6cfd950b580a63a44f86b8..1401f1ad1f551352fbde3a6a5655ec1082d4f061 100644 (file)
 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 @@ fn trans<'blk>(&self, mut bcx: Block<'blk, 'tcx>) -> OptResult<'blk, '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> {
index 0c2c86fc32dd43bde446218b70d7eac57d606dee..f7edb281b9eda7a18fa2320b482893dec800083a 100644 (file)
@@ -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 {
index b947b1746fcab26b35dfd012cac62ac8ca3595d9..25fbaa6677684af6496ec59333c61721ebe8f071 100644 (file)
@@ -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
index dca106a3897fb3fc68eeb52a254b4f2254dce8e2..476f5e2d618fe751deb7147807a0c7fb7636b21c 100644 (file)
 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,
index 7aabd998f7aaeac5cd2021ce8735ede3d2c1c7e7..ad2a6db1222c2dacbca9e47eeceec8763ef0db1d 100644 (file)
@@ -20,7 +20,7 @@
 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>,
index 4a6bc58051c57aa9b4132d56b332c0d9c2d2c690..9b678a4f3ae9b7d502a1b8d370d1e19e7329f48e 100644 (file)
@@ -24,7 +24,7 @@
 
 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;
 }
index f8303a6f030809effcfc022516fb2a46eb022dcb..3376479b7a42dce40792de933778ba630150c132 100644 (file)
 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>,
index e8857de7b73bcc97bc47bbd05f3cf65da6f1fbd3..fb2c432ef5cf4be7dca42d7039e490628bcbaa2a 100644 (file)
@@ -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 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
     }
 }
 
-#[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 @@ fn trans<'blk>(&self,
 
 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 @@ fn is_unwind(&self) -> bool {
 ///////////////////////////////////////////////////////////////////////////
 // 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 @@ fn trans<'blk>(&self,
     }
 }
 
-#[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 @@ fn trans<'blk>(&self,
     }
 }
 
+#[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 @@ fn trans<'blk>(&self,
     }
 }
 
+#[deriving(Copy)]
 pub struct LifetimeEnd {
     ptr: ValueRef,
 }
 
-impl Copy for LifetimeEnd {}
-
 impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
     fn must_unwind(&self) -> bool {
         false
index af3daf224e3265afb21e5dc3d440d80189dce8bc..d5d954f5a907bbe9164e5bae2da131b5dad26bc3 100644 (file)
 //
 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
+#[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))
index a8e88eca0e19f1f49216bf8d44d71d9628377fb2..4dd4e27c9c0d4255dd052271fbebb39c87139e07 100644 (file)
@@ -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> {
index e32b5792e5da49e14239d34cde2b33175b19e8f2..75473dc58bf479fe38173d6a05a13cb385ac1e44 100644 (file)
@@ -33,7 +33,7 @@
 /// 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));
 }
index 96c39b5796ec4ccb7a0f5b010d85350d1195d13d..9a5e6830da194b33998b58917e5612495bfc5f22 100644 (file)
 //  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 @@ fn create_member_descriptions<'a>(&self, cx: &CrateContext<'a, '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 @@ fn new(metadata: DIType, already_stored_in_typemap: bool) -> MetadataCreationRes
     }
 }
 
-#[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 {
index db44e0ce27197c9a99be286d0625e2f8e381947f..dd87879b7375506d7e2a5c4256aafd1b627fb1a5 100644 (file)
 // 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,
index 9234dfc48bd66dee344d6f4c5c8ff38278103bc1..05797d74feefc50343348d8d3c50072eda0a81f6 100644 (file)
 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,
index 18ea8055a4eb5367d2b719ecf78387d20cd92f08..e09032ac2d04f1607f8d1f32f53b5230c0d9a2d3 100644 (file)
@@ -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={}, \
index 70b1e99ce8e28e6c23c93c2e17d345615bb84f07..51a0533a7bb63665437923be568343b43129952b 100644 (file)
 
 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 }))
 }
index aa6fd7f0b39417d1ec74bf32554b4d7f88579a40..2801e0ccead6db69331983c84ada8478a0ecaf41 100644 (file)
@@ -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,
index c7cf86fb1843a009e36d962c1165e4540566a923..4f9b8c5ea37c973cb9c3822cd4d49904b344a942 100644 (file)
 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 @@ pub fn is_a_terminator_inst(self) -> bool {
 }
 
 /// 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