1
Fork 0

librustc_trans: use #[deriving(Copy)]

This commit is contained in:
Jorge Aparicio 2014-12-14 23:14:38 -05:00
parent 463475b7fa
commit 5e2bca9e86
20 changed files with 43 additions and 109 deletions

View file

@ -33,7 +33,7 @@ use std::sync::{Arc, Mutex};
use std::thread; use std::thread;
use libc::{c_uint, c_int, c_void}; use libc::{c_uint, c_int, c_void};
#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)] #[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
pub enum OutputType { pub enum OutputType {
OutputTypeBitcode, OutputTypeBitcode,
OutputTypeAssembly, OutputTypeAssembly,
@ -42,8 +42,6 @@ pub enum OutputType {
OutputTypeExe, OutputTypeExe,
} }
impl Copy for OutputType {}
pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! { pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! {
unsafe { unsafe {
let cstr = llvm::LLVMRustGetLastError(); let cstr = llvm::LLVMRustGetLastError();

View file

@ -61,6 +61,7 @@ macro_rules! svec {
}) })
} }
#[deriving(Copy)]
pub enum Row { pub enum Row {
Variable, Variable,
Enum, Enum,
@ -87,8 +88,6 @@ pub enum Row {
FnRef, FnRef,
} }
impl Copy for Row {}
impl<'a> FmtStrs<'a> { impl<'a> FmtStrs<'a> {
pub fn new(rec: Box<Recorder>, span: SpanUtils<'a>, krate: String) -> FmtStrs<'a> { pub fn new(rec: Box<Recorder>, span: SpanUtils<'a>, krate: String) -> FmtStrs<'a> {
FmtStrs { FmtStrs {

View file

@ -228,11 +228,9 @@ use syntax::codemap::Span;
use syntax::fold::Folder; use syntax::fold::Folder;
use syntax::ptr::P; use syntax::ptr::P;
#[deriving(Show)] #[deriving(Copy, Show)]
struct ConstantExpr<'a>(&'a ast::Expr); struct ConstantExpr<'a>(&'a ast::Expr);
impl<'a> Copy for ConstantExpr<'a> {}
impl<'a> ConstantExpr<'a> { impl<'a> ConstantExpr<'a> {
fn eq(self, other: ConstantExpr<'a>, tcx: &ty::ctxt) -> bool { fn eq(self, other: ConstantExpr<'a>, tcx: &ty::ctxt) -> bool {
let ConstantExpr(expr) = self; let ConstantExpr(expr) = self;
@ -301,7 +299,7 @@ impl<'a, 'tcx> Opt<'a, 'tcx> {
} }
} }
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum BranchKind { pub enum BranchKind {
NoBranch, NoBranch,
Single, Single,
@ -310,23 +308,19 @@ pub enum BranchKind {
CompareSliceLength CompareSliceLength
} }
impl Copy for BranchKind {}
pub enum OptResult<'blk, 'tcx: 'blk> { pub enum OptResult<'blk, 'tcx: 'blk> {
SingleResult(Result<'blk, 'tcx>), SingleResult(Result<'blk, 'tcx>),
RangeResult(Result<'blk, 'tcx>, Result<'blk, 'tcx>), RangeResult(Result<'blk, 'tcx>, Result<'blk, 'tcx>),
LowerBound(Result<'blk, 'tcx>) LowerBound(Result<'blk, 'tcx>)
} }
#[deriving(Clone)] #[deriving(Clone, Copy)]
pub enum TransBindingMode { pub enum TransBindingMode {
TrByCopy(/* llbinding */ ValueRef), TrByCopy(/* llbinding */ ValueRef),
TrByMove, TrByMove,
TrByRef, TrByRef,
} }
impl Copy for TransBindingMode {}
/// Information about a pattern binding: /// Information about a pattern binding:
/// - `llmatch` is a pointer to a stack slot. The stack slot contains a /// - `llmatch` is a pointer to a stack slot. The stack slot contains a
/// pointer into the value being matched. Hence, llmatch has type `T**` /// 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 /// - `trmode` is the trans binding mode
/// - `id` is the node id of the binding /// - `id` is the node id of the binding
/// - `ty` is the Rust type of the binding /// - `ty` is the Rust type of the binding
#[deriving(Clone)] #[deriving(Clone, Copy)]
pub struct BindingInfo<'tcx> { pub struct BindingInfo<'tcx> {
pub llmatch: ValueRef, pub llmatch: ValueRef,
pub trmode: TransBindingMode, pub trmode: TransBindingMode,
@ -343,8 +337,6 @@ pub struct BindingInfo<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
} }
impl<'tcx> Copy for BindingInfo<'tcx> {}
type BindingsMap<'tcx> = FnvHashMap<Ident, BindingInfo<'tcx>>; type BindingsMap<'tcx> = FnvHashMap<Ident, BindingInfo<'tcx>>;
struct ArmData<'p, 'blk, 'tcx: 'blk> { struct ArmData<'p, 'blk, 'tcx: 'blk> {

View file

@ -281,14 +281,12 @@ struct Case<'tcx> {
} }
#[deriving(Eq, PartialEq, Show)] #[deriving(Copy, Eq, PartialEq, Show)]
pub enum PointerField { pub enum PointerField {
ThinPointer(uint), ThinPointer(uint),
FatPointer(uint) FatPointer(uint)
} }
impl Copy for PointerField {}
impl<'tcx> Case<'tcx> { impl<'tcx> Case<'tcx> {
fn is_zerolen<'a>(&self, cx: &CrateContext<'a, 'tcx>, scapegoat: Ty<'tcx>) fn is_zerolen<'a>(&self, cx: &CrateContext<'a, 'tcx>, scapegoat: Ty<'tcx>)
-> bool { -> bool {

View file

@ -565,10 +565,9 @@ pub fn maybe_name_value(cx: &CrateContext, v: ValueRef, s: &str) {
// Used only for creating scalar comparison glue. // Used only for creating scalar comparison glue.
#[deriving(Copy)]
pub enum scalar_type { nil_type, signed_int, unsigned_int, floating_point, } 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>, pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
lhs: ValueRef, lhs: ValueRef,
rhs: 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 { pub enum IsUnboxedClosureFlag {
NotUnboxedClosure, NotUnboxedClosure,
IsUnboxedClosure, IsUnboxedClosure,
} }
impl Copy for IsUnboxedClosureFlag {}
// trans_closure: Builds an LLVM function out of a source function. // trans_closure: Builds an LLVM function out of a source function.
// If the function closes over its environment a closure will be // If the function closes over its environment a closure will be
// returned. // 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. /// Enum describing the origin of an LLVM `Value`, for linkage purposes.
#[deriving(Copy)]
pub enum ValueOrigin { pub enum ValueOrigin {
/// The LLVM `Value` is in this context because the corresponding item was /// The LLVM `Value` is in this context because the corresponding item was
/// assigned to the current compilation unit. /// assigned to the current compilation unit.
@ -2204,8 +2202,6 @@ pub enum ValueOrigin {
InlinedCopy, InlinedCopy,
} }
impl Copy for ValueOrigin {}
/// Set the appropriate linkage for an LLVM `ValueRef` (function or global). /// Set the appropriate linkage for an LLVM `ValueRef` (function or global).
/// If the `llval` is the direct translation of a specific Rust item, `id` /// 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 /// should be set to the `NodeId` of that item. (This mapping should be

View file

@ -13,10 +13,9 @@ use llvm::{BasicBlockRef};
use trans::value::{Users, Value}; use trans::value::{Users, Value};
use std::iter::{Filter, Map}; use std::iter::{Filter, Map};
#[deriving(Copy)]
pub struct BasicBlock(pub BasicBlockRef); pub struct BasicBlock(pub BasicBlockRef);
impl Copy for BasicBlock {}
pub type Preds = Map< pub type Preds = Map<
Value, Value,
BasicBlock, BasicBlock,

View file

@ -20,7 +20,7 @@ use trans::cabi_arm;
use trans::cabi_mips; use trans::cabi_mips;
use trans::type_::Type; use trans::type_::Type;
#[deriving(Clone, PartialEq)] #[deriving(Clone, Copy, PartialEq)]
pub enum ArgKind { pub enum ArgKind {
/// Pass the argument directly using the normal converted /// Pass the argument directly using the normal converted
/// LLVM type or by coercing to another specified type /// LLVM type or by coercing to another specified type
@ -31,13 +31,11 @@ pub enum ArgKind {
Ignore, Ignore,
} }
impl Copy for ArgKind {}
/// Information about how a specific C type /// Information about how a specific C type
/// should be passed to or returned from a function /// should be passed to or returned from a function
/// ///
/// This is borrowed from clang's ABIInfo.h /// This is borrowed from clang's ABIInfo.h
#[deriving(Clone)] #[deriving(Clone, Copy)]
pub struct ArgType { pub struct ArgType {
pub kind: ArgKind, pub kind: ArgKind,
/// Original LLVM type /// Original LLVM type
@ -50,8 +48,6 @@ pub struct ArgType {
pub attr: option::Option<Attribute> pub attr: option::Option<Attribute>
} }
impl Copy for ArgType {}
impl ArgType { impl ArgType {
pub fn direct(ty: Type, cast: option::Option<Type>, pub fn direct(ty: Type, cast: option::Option<Type>,
pad: option::Option<Type>, pad: option::Option<Type>,

View file

@ -24,7 +24,7 @@ use trans::type_::Type;
use std::cmp; use std::cmp;
#[deriving(Clone, PartialEq)] #[deriving(Clone, Copy, PartialEq)]
enum RegClass { enum RegClass {
NoClass, NoClass,
Int, Int,
@ -40,8 +40,6 @@ enum RegClass {
Memory Memory
} }
impl Copy for RegClass {}
trait TypeMethods { trait TypeMethods {
fn is_reg_ty(&self) -> bool; fn is_reg_ty(&self) -> bool;
} }

View file

@ -57,13 +57,12 @@ use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use syntax::ptr::P; use syntax::ptr::P;
#[deriving(Copy)]
pub struct MethodData { pub struct MethodData {
pub llfn: ValueRef, pub llfn: ValueRef,
pub llself: ValueRef, pub llself: ValueRef,
} }
impl Copy for MethodData {}
pub enum CalleeData<'tcx> { pub enum CalleeData<'tcx> {
Closure(Datum<'tcx, Lvalue>), Closure(Datum<'tcx, Lvalue>),
@ -1049,13 +1048,12 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
bcx bcx
} }
#[deriving(Copy)]
pub enum AutorefArg { pub enum AutorefArg {
DontAutorefArg, DontAutorefArg,
DoAutorefArg(ast::NodeId) DoAutorefArg(ast::NodeId)
} }
impl Copy for AutorefArg {}
pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
formal_arg_ty: Ty<'tcx>, formal_arg_ty: Ty<'tcx>,
arg_datum: Datum<'tcx, Expr>, arg_datum: Datum<'tcx, Expr>,

View file

@ -50,13 +50,11 @@ pub struct CleanupScope<'blk, 'tcx: 'blk> {
cached_landing_pad: Option<BasicBlockRef>, cached_landing_pad: Option<BasicBlockRef>,
} }
#[deriving(Show)] #[deriving(Copy, Show)]
pub struct CustomScopeIndex { pub struct CustomScopeIndex {
index: uint index: uint
} }
impl Copy for CustomScopeIndex {}
pub const EXIT_BREAK: uint = 0; pub const EXIT_BREAK: uint = 0;
pub const EXIT_LOOP: uint = 1; pub const EXIT_LOOP: uint = 1;
pub const EXIT_MAX: uint = 2; 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 { pub enum EarlyExitLabel {
UnwindExit, UnwindExit,
ReturnExit, ReturnExit,
LoopExit(ast::NodeId, uint) LoopExit(ast::NodeId, uint)
} }
impl Copy for EarlyExitLabel {} #[deriving(Copy)]
pub struct CachedEarlyExit { pub struct CachedEarlyExit {
label: EarlyExitLabel, label: EarlyExitLabel,
cleanup_block: BasicBlockRef, cleanup_block: BasicBlockRef,
} }
impl Copy for CachedEarlyExit {}
pub trait Cleanup<'tcx> { pub trait Cleanup<'tcx> {
fn must_unwind(&self) -> bool; fn must_unwind(&self) -> bool;
fn clean_on_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>; pub type CleanupObj<'tcx> = Box<Cleanup<'tcx>+'tcx>;
#[deriving(Show)] #[deriving(Copy, Show)]
pub enum ScopeId { pub enum ScopeId {
AstScope(ast::NodeId), AstScope(ast::NodeId),
CustomScope(CustomScopeIndex) CustomScope(CustomScopeIndex)
} }
impl Copy for ScopeId {}
impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> { impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
/// Invoked when we start to trans the code contained within a new cleanup scope. /// Invoked when we start to trans the code contained within a new cleanup scope.
fn push_ast_cleanup_scope(&self, debug_loc: NodeInfo) { fn push_ast_cleanup_scope(&self, debug_loc: NodeInfo) {
@ -876,6 +869,7 @@ impl EarlyExitLabel {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Cleanup types // Cleanup types
#[deriving(Copy)]
pub struct DropValue<'tcx> { pub struct DropValue<'tcx> {
is_immediate: bool, is_immediate: bool,
must_unwind: bool, must_unwind: bool,
@ -884,8 +878,6 @@ pub struct DropValue<'tcx> {
zero: bool zero: bool
} }
impl<'tcx> Copy for DropValue<'tcx> {}
impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> { impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
fn must_unwind(&self) -> bool { fn must_unwind(&self) -> bool {
self.must_unwind self.must_unwind
@ -915,21 +907,18 @@ impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
} }
} }
#[deriving(Show)] #[deriving(Copy, Show)]
pub enum Heap { pub enum Heap {
HeapExchange HeapExchange
} }
impl Copy for Heap {} #[deriving(Copy)]
pub struct FreeValue<'tcx> { pub struct FreeValue<'tcx> {
ptr: ValueRef, ptr: ValueRef,
heap: Heap, heap: Heap,
content_ty: Ty<'tcx> content_ty: Ty<'tcx>
} }
impl<'tcx> Copy for FreeValue<'tcx> {}
impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> { impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
fn must_unwind(&self) -> bool { fn must_unwind(&self) -> bool {
true true
@ -957,6 +946,7 @@ impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
} }
} }
#[deriving(Copy)]
pub struct FreeSlice { pub struct FreeSlice {
ptr: ValueRef, ptr: ValueRef,
size: ValueRef, size: ValueRef,
@ -964,8 +954,6 @@ pub struct FreeSlice {
heap: Heap, heap: Heap,
} }
impl Copy for FreeSlice {}
impl<'tcx> Cleanup<'tcx> for FreeSlice { impl<'tcx> Cleanup<'tcx> for FreeSlice {
fn must_unwind(&self) -> bool { fn must_unwind(&self) -> bool {
true true
@ -993,12 +981,11 @@ impl<'tcx> Cleanup<'tcx> for FreeSlice {
} }
} }
#[deriving(Copy)]
pub struct LifetimeEnd { pub struct LifetimeEnd {
ptr: ValueRef, ptr: ValueRef,
} }
impl Copy for LifetimeEnd {}
impl<'tcx> Cleanup<'tcx> for LifetimeEnd { impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
fn must_unwind(&self) -> bool { fn must_unwind(&self) -> bool {
false false

View file

@ -102,13 +102,12 @@ use syntax::ast_util;
// //
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#[deriving(Copy)]
pub struct EnvValue<'tcx> { pub struct EnvValue<'tcx> {
action: ast::CaptureClause, action: ast::CaptureClause,
datum: Datum<'tcx, Lvalue> datum: Datum<'tcx, Lvalue>
} }
impl<'tcx> Copy for EnvValue<'tcx> {}
impl<'tcx> EnvValue<'tcx> { impl<'tcx> EnvValue<'tcx> {
pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String { pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
format!("{}({})", self.action, self.datum.to_string(ccx)) format!("{}({})", self.action, self.datum.to_string(ccx))

View file

@ -119,6 +119,7 @@ pub fn gensym_name(name: &str) -> PathElem {
PathName(token::gensym(format!("{}:{}", name, num).as_slice())) PathName(token::gensym(format!("{}:{}", name, num).as_slice()))
} }
#[deriving(Copy)]
pub struct tydesc_info<'tcx> { pub struct tydesc_info<'tcx> {
pub ty: Ty<'tcx>, pub ty: Ty<'tcx>,
pub tydesc: ValueRef, pub tydesc: ValueRef,
@ -127,8 +128,6 @@ pub struct tydesc_info<'tcx> {
pub name: ValueRef, pub name: ValueRef,
} }
impl<'tcx> Copy for tydesc_info<'tcx> {}
/* /*
* A note on nomenclature of linking: "extern", "foreign", and "upcall". * 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 struct NodeInfo {
pub id: ast::NodeId, pub id: ast::NodeId,
pub span: Span, pub span: Span,
} }
impl Copy for NodeInfo {}
pub fn expr_info(expr: &ast::Expr) -> NodeInfo { pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
NodeInfo { id: expr.id, span: expr.span } 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. // Key used to lookup values supplied for type parameters in an expr.
#[deriving(PartialEq, Show)] #[deriving(Copy, PartialEq, Show)]
pub enum ExprOrMethodCall { pub enum ExprOrMethodCall {
// Type parameters for a path like `None::<int>` // Type parameters for a path like `None::<int>`
ExprId(ast::NodeId), ExprId(ast::NodeId),
@ -872,8 +870,6 @@ pub enum ExprOrMethodCall {
MethodCall(ty::MethodCall) MethodCall(ty::MethodCall)
} }
impl Copy for ExprOrMethodCall {}
pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
node: ExprOrMethodCall) node: ExprOrMethodCall)
-> subst::Substs<'tcx> { -> subst::Substs<'tcx> {

View file

@ -33,7 +33,7 @@ use syntax::ast;
/// describes where the value is stored, what Rust type the value has, /// describes where the value is stored, what Rust type the value has,
/// whether it is addressed by reference, and so forth. Please refer /// whether it is addressed by reference, and so forth. Please refer
/// the section on datums in `doc.rs` for more details. /// the section on datums in `doc.rs` for more details.
#[deriving(Clone)] #[deriving(Clone, Copy)]
pub struct Datum<'tcx, K> { pub struct Datum<'tcx, K> {
/// The llvm value. This is either a pointer to the Rust value or /// The llvm value. This is either a pointer to the Rust value or
/// the value itself, depending on `kind` below. /// the value itself, depending on `kind` below.
@ -46,8 +46,6 @@ pub struct Datum<'tcx, K> {
pub kind: K, pub kind: K,
} }
impl<'tcx,K:Copy> Copy for Datum<'tcx,K> {}
pub struct DatumBlock<'blk, 'tcx: 'blk, K> { pub struct DatumBlock<'blk, 'tcx: 'blk, K> {
pub bcx: Block<'blk, 'tcx>, pub bcx: Block<'blk, 'tcx>,
pub datum: Datum<'tcx, K>, pub datum: Datum<'tcx, K>,
@ -65,11 +63,9 @@ pub enum Expr {
LvalueExpr, LvalueExpr,
} }
#[deriving(Clone, Show)] #[deriving(Clone, Copy, Show)]
pub struct Lvalue; pub struct Lvalue;
impl Copy for Lvalue {}
#[deriving(Show)] #[deriving(Show)]
pub struct Rvalue { pub struct Rvalue {
pub mode: RvalueMode pub mode: RvalueMode
@ -86,7 +82,7 @@ impl Drop for Rvalue {
fn drop(&mut self) { } fn drop(&mut self) { }
} }
#[deriving(PartialEq, Eq, Hash, Show)] #[deriving(Copy, PartialEq, Eq, Hash, Show)]
pub enum RvalueMode { pub enum RvalueMode {
/// `val` is a pointer to the actual value (and thus has type *T) /// `val` is a pointer to the actual value (and thus has type *T)
ByRef, ByRef,
@ -95,8 +91,6 @@ pub enum RvalueMode {
ByValue, ByValue,
} }
impl Copy for RvalueMode {}
pub fn immediate_rvalue<'tcx>(val: ValueRef, ty: Ty<'tcx>) -> Datum<'tcx, Rvalue> { pub fn immediate_rvalue<'tcx>(val: ValueRef, ty: Ty<'tcx>) -> Datum<'tcx, Rvalue> {
return Datum::new(val, ty, Rvalue::new(ByValue)); return Datum::new(val, ty, Rvalue::new(ByValue));
} }

View file

@ -248,11 +248,9 @@ static FLAGS_NONE: c_uint = 0;
// Public Interface of debuginfo module // Public Interface of debuginfo module
//=----------------------------------------------------------------------------- //=-----------------------------------------------------------------------------
#[deriving(Show, Hash, Eq, PartialEq, Clone)] #[deriving(Copy, Show, Hash, Eq, PartialEq, Clone)]
struct UniqueTypeId(ast::Name); struct UniqueTypeId(ast::Name);
impl Copy for UniqueTypeId {}
// The TypeMap is where the CrateDebugContext holds the type metadata nodes // The TypeMap is where the CrateDebugContext holds the type metadata nodes
// created so far. The metadata nodes are indexed by UniqueTypeId, and, for // created so far. The metadata nodes are indexed by UniqueTypeId, and, for
// faster lookup, also by Ty. The TypeMap is responsible for creating // faster lookup, also by Ty. The TypeMap is responsible for creating
@ -2320,14 +2318,13 @@ impl<'tcx> VariantMemberDescriptionFactory<'tcx> {
} }
} }
#[deriving(Copy)]
enum EnumDiscriminantInfo { enum EnumDiscriminantInfo {
RegularDiscriminant(DIType), RegularDiscriminant(DIType),
OptimizedDiscriminant(adt::PointerField), OptimizedDiscriminant(adt::PointerField),
NoDiscriminant NoDiscriminant
} }
impl Copy for EnumDiscriminantInfo {}
// Returns a tuple of (1) type_metadata_stub of the variant, (2) the llvm_type // 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 // of the variant, and (3) a MemberDescriptionFactory for producing the
// descriptions of the fields of the variant. This is a rudimentary version of a // 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 { enum DebugLocation {
KnownLocation { scope: DIScope, line: uint, col: uint }, KnownLocation { scope: DIScope, line: uint, col: uint },
UnknownLocation UnknownLocation
} }
impl Copy for DebugLocation {}
impl DebugLocation { impl DebugLocation {
fn new(scope: DIScope, line: uint, col: uint) -> DebugLocation { fn new(scope: DIScope, line: uint, col: uint) -> DebugLocation {
KnownLocation { KnownLocation {

View file

@ -73,14 +73,12 @@ use std::rc::Rc;
// These are passed around by the code generating functions to track the // These are passed around by the code generating functions to track the
// destination of a computation's value. // destination of a computation's value.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Dest { pub enum Dest {
SaveIn(ValueRef), SaveIn(ValueRef),
Ignore, Ignore,
} }
impl Copy for Dest {}
impl Dest { impl Dest {
pub fn to_string(&self, ccx: &CrateContext) -> String { pub fn to_string(&self, ccx: &CrateContext) -> String {
match *self { match *self {
@ -1889,7 +1887,7 @@ fn float_cast(bcx: Block,
} else { llsrc }; } else { llsrc };
} }
#[deriving(PartialEq, Show)] #[deriving(Copy, PartialEq, Show)]
pub enum cast_kind { pub enum cast_kind {
cast_pointer, cast_pointer,
cast_integral, cast_integral,
@ -1898,8 +1896,6 @@ pub enum cast_kind {
cast_other, cast_other,
} }
impl Copy for cast_kind {}
pub fn cast_type_kind<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> cast_kind { pub fn cast_type_kind<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> cast_kind {
match t.sty { match t.sty {
ty::ty_char => cast_integral, ty::ty_char => cast_integral,

View file

@ -54,13 +54,12 @@ mod basic_block;
mod llrepr; mod llrepr;
mod cleanup; mod cleanup;
#[deriving(Copy)]
pub struct ModuleTranslation { pub struct ModuleTranslation {
pub llcx: ContextRef, pub llcx: ContextRef,
pub llmod: ModuleRef, pub llmod: ModuleRef,
} }
impl Copy for ModuleTranslation {}
pub struct CrateTranslation { pub struct CrateTranslation {
pub modules: Vec<ModuleTranslation>, pub modules: Vec<ModuleTranslation>,
pub metadata_module: ModuleTranslation, pub metadata_module: ModuleTranslation,

View file

@ -89,6 +89,7 @@ pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
}) })
} }
#[deriving(Copy)]
pub struct VecTypes<'tcx> { pub struct VecTypes<'tcx> {
pub unit_ty: Ty<'tcx>, pub unit_ty: Ty<'tcx>,
pub llunit_ty: Type, pub llunit_ty: Type,
@ -96,8 +97,6 @@ pub struct VecTypes<'tcx> {
pub llunit_alloc_size: u64 pub llunit_alloc_size: u64
} }
impl<'tcx> Copy for VecTypes<'tcx> {}
impl<'tcx> VecTypes<'tcx> { impl<'tcx> VecTypes<'tcx> {
pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String { pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
format!("VecTypes {{unit_ty={}, llunit_ty={}, \ format!("VecTypes {{unit_ty={}, llunit_ty={}, \

View file

@ -25,14 +25,12 @@ use std::cell::RefCell;
use libc::c_uint; use libc::c_uint;
#[deriving(Clone, PartialEq, Show)] #[deriving(Clone, Copy, PartialEq, Show)]
#[repr(C)] #[repr(C)]
pub struct Type { pub struct Type {
rf: TypeRef rf: TypeRef
} }
impl Copy for Type {}
macro_rules! ty { macro_rules! ty {
($e:expr) => ( Type::from_ref(unsafe { $e })) ($e:expr) => ( Type::from_ref(unsafe { $e }))
} }

View 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 // Want refinements! (Or case classes, I guess
#[deriving(Copy)]
pub enum named_ty { pub enum named_ty {
a_struct, a_struct,
an_enum, an_enum,
an_unboxed_closure, an_unboxed_closure,
} }
impl Copy for named_ty {}
pub fn llvm_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, pub fn llvm_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
what: named_ty, what: named_ty,
did: ast::DefId, did: ast::DefId,

View file

@ -14,10 +14,9 @@ use trans::basic_block::BasicBlock;
use trans::common::Block; use trans::common::Block;
use libc::c_uint; use libc::c_uint;
#[deriving(Copy)]
pub struct Value(pub ValueRef); pub struct Value(pub ValueRef);
impl Copy for Value {}
macro_rules! opt_val { ($e:expr) => ( macro_rules! opt_val { ($e:expr) => (
unsafe { unsafe {
match $e { match $e {
@ -126,10 +125,9 @@ impl Value {
} }
/// Wrapper for LLVM UseRef /// Wrapper for LLVM UseRef
#[deriving(Copy)]
pub struct Use(UseRef); pub struct Use(UseRef);
impl Copy for Use {}
impl Use { impl Use {
pub fn get(&self) -> UseRef { pub fn get(&self) -> UseRef {
let Use(v) = *self; v let Use(v) = *self; v