diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index 9093cd00ca00..495044f94594 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -113,7 +113,7 @@ declare_lint! { } /// Does nothing as a lint pass, but registers some `Lint`s /// which are used by other parts of the compiler. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct HardwiredLints; impl LintPass for HardwiredLints { diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 23f9cbc3a4b9..498b2ce518c1 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -41,7 +41,7 @@ pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_a GatherNodeLevels}; /// Specification of a single lint. -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub struct Lint { /// A string identifier for the lint. /// diff --git a/src/librustc/metadata/common.rs b/src/librustc/metadata/common.rs index e4c0eda0448b..cda008476864 100644 --- a/src/librustc/metadata/common.rs +++ b/src/librustc/metadata/common.rs @@ -116,7 +116,7 @@ pub const tag_items_data_item_reexport_def_id: usize = 0x47; pub const tag_items_data_item_reexport_name: usize = 0x48; // used to encode crate_ctxt side tables -#[derive(Copy, PartialEq, FromPrimitive)] +#[derive(Copy, Clone, PartialEq, FromPrimitive)] #[repr(usize)] pub enum astencode_tag { // Reserves 0x50 -- 0x6f tag_ast = 0x50, diff --git a/src/librustc/metadata/csearch.rs b/src/librustc/metadata/csearch.rs index ebc3a6fd52c9..d528e38d341c 100644 --- a/src/librustc/metadata/csearch.rs +++ b/src/librustc/metadata/csearch.rs @@ -29,7 +29,7 @@ use syntax::parse::token; use std::collections::hash_map::HashMap; -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct MethodInfo { pub name: ast::Name, pub def_id: ast::DefId, diff --git a/src/librustc/metadata/filesearch.rs b/src/librustc/metadata/filesearch.rs index 284e76b328a6..1567f4b99475 100644 --- a/src/librustc/metadata/filesearch.rs +++ b/src/librustc/metadata/filesearch.rs @@ -21,7 +21,7 @@ use std::path::{Path, PathBuf}; use util::fs as myfs; use session::search_paths::{SearchPaths, PathKind}; -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum FileMatch { FileMatches, FileDoesntMatch, diff --git a/src/librustc/metadata/tydecode.rs b/src/librustc/metadata/tydecode.rs index e2eebbfdc724..3fb128b1881f 100644 --- a/src/librustc/metadata/tydecode.rs +++ b/src/librustc/metadata/tydecode.rs @@ -43,7 +43,7 @@ use syntax::parse::token; // def-id will depend on where it originated from. Therefore, the conversion // function is given an indicator of the source of the def-id. See // astencode.rs for more information. -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum DefIdSource { // Identifies a struct, trait, enum, etc. NominalType, diff --git a/src/librustc/middle/cfg/construct.rs b/src/librustc/middle/cfg/construct.rs index 24c54b53590c..cbc2ef1535ea 100644 --- a/src/librustc/middle/cfg/construct.rs +++ b/src/librustc/middle/cfg/construct.rs @@ -25,7 +25,7 @@ struct CFGBuilder<'a, 'tcx: 'a> { loop_scopes: Vec, } -#[derive(Copy)] +#[derive(Copy, Clone)] struct LoopScope { loop_id: ast::NodeId, // id of loop/while node continue_index: CFGIndex, // where to go on a `loop` diff --git a/src/librustc/middle/cfg/mod.rs b/src/librustc/middle/cfg/mod.rs index e8a99f59b1e9..ad4fdcd7b834 100644 --- a/src/librustc/middle/cfg/mod.rs +++ b/src/librustc/middle/cfg/mod.rs @@ -24,7 +24,7 @@ pub struct CFG { pub exit: CFGIndex, } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum CFGNodeData { AST(ast::NodeId), Entry, diff --git a/src/librustc/middle/check_const.rs b/src/librustc/middle/check_const.rs index 497022ac6ac4..ce011f2561b7 100644 --- a/src/librustc/middle/check_const.rs +++ b/src/librustc/middle/check_const.rs @@ -76,7 +76,7 @@ bitflags! { } } -#[derive(Copy, Eq, PartialEq)] +#[derive(Copy, Clone, Eq, PartialEq)] enum Mode { Const, Static, diff --git a/src/librustc/middle/check_loop.rs b/src/librustc/middle/check_loop.rs index ea584407944a..bf6829d96765 100644 --- a/src/librustc/middle/check_loop.rs +++ b/src/librustc/middle/check_loop.rs @@ -21,7 +21,7 @@ enum Context { Normal, Loop, Closure } -#[derive(Copy)] +#[derive(Copy, Clone)] struct CheckLoopVisitor<'a> { sess: &'a Session, cx: Context diff --git a/src/librustc/middle/check_match.rs b/src/librustc/middle/check_match.rs index 01692158c17f..79f4d62b45e7 100644 --- a/src/librustc/middle/check_match.rs +++ b/src/librustc/middle/check_match.rs @@ -128,7 +128,7 @@ enum Usefulness { NotUseful } -#[derive(Copy)] +#[derive(Copy, Clone)] enum WitnessPreference { ConstructWitness, LeaveOutWitness diff --git a/src/librustc/middle/dataflow.rs b/src/librustc/middle/dataflow.rs index a112ce6bd287..7e0eebe3993d 100644 --- a/src/librustc/middle/dataflow.rs +++ b/src/librustc/middle/dataflow.rs @@ -28,7 +28,7 @@ use syntax::visit; use syntax::print::{pp, pprust}; use util::nodemap::NodeMap; -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum EntryOrExit { Entry, Exit, diff --git a/src/librustc/middle/def.rs b/src/librustc/middle/def.rs index 1a054c0f464a..019cba410836 100644 --- a/src/librustc/middle/def.rs +++ b/src/librustc/middle/def.rs @@ -65,7 +65,7 @@ pub enum Def { /// ::AssocX::AssocY::MethodOrAssocType /// ^~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~ /// base_def depth = 2 -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub struct PathResolution { pub base_def: Def, pub last_private: LastPrivate, @@ -93,7 +93,7 @@ pub type DefMap = RefCell>; // within. pub type ExportMap = NodeMap>; -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct Export { pub name: ast::Name, // The name of the target. pub def_id: ast::DefId, // The definition of the target. diff --git a/src/librustc/middle/effect.rs b/src/librustc/middle/effect.rs index 5d970c59f639..814492cbef1d 100644 --- a/src/librustc/middle/effect.rs +++ b/src/librustc/middle/effect.rs @@ -22,7 +22,7 @@ use syntax::codemap::Span; use syntax::visit; use syntax::visit::Visitor; -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] enum UnsafeContext { SafeContext, UnsafeFn, diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index e98b438d370c..2fa9c7c8fbeb 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -94,7 +94,7 @@ pub trait Delegate<'tcx> { mode: MutateMode); } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum LoanCause { ClosureCapture(Span), AddrOf, @@ -106,20 +106,20 @@ pub enum LoanCause { MatchDiscriminant } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum ConsumeMode { Copy, // reference to x where x has a type that copies Move(MoveReason), // reference to x where x has a type that moves } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum MoveReason { DirectRefMove, PatBindingMove, CaptureMove, } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum MatchMode { NonBindingMatch, BorrowingMatch, @@ -127,7 +127,7 @@ pub enum MatchMode { MovingMatch, } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] enum TrackMatchMode { Unknown, Definite(MatchMode), @@ -194,14 +194,14 @@ impl TrackMatchMode { } } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum MutateMode { Init, JustWrite, // x = y WriteAndRead, // x += y } -#[derive(Copy)] +#[derive(Copy, Clone)] enum OverloadedCallType { FnOverloadedCall, FnMutOverloadedCall, diff --git a/src/librustc/middle/graph.rs b/src/librustc/middle/graph.rs index 8673273f9b3c..a9ac61b49eca 100644 --- a/src/librustc/middle/graph.rs +++ b/src/librustc/middle/graph.rs @@ -66,13 +66,13 @@ pub struct NodeIndex(pub usize); #[allow(non_upper_case_globals)] pub const InvalidNodeIndex: NodeIndex = NodeIndex(usize::MAX); -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub struct EdgeIndex(pub usize); #[allow(non_upper_case_globals)] pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(usize::MAX); // Use a private field here to guarantee no more instances are created: -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub struct Direction { repr: usize } #[allow(non_upper_case_globals)] pub const Outgoing: Direction = Direction { repr: 0 }; diff --git a/src/librustc/middle/infer/mod.rs b/src/librustc/middle/infer/mod.rs index 4cc9b65c2dab..5e426444cb1a 100644 --- a/src/librustc/middle/infer/mod.rs +++ b/src/librustc/middle/infer/mod.rs @@ -294,7 +294,7 @@ pub enum RegionVariableOrigin<'tcx> { BoundRegionInCoherence(ast::Name), } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum fixup_err { unresolved_int_ty(IntVid), unresolved_float_ty(FloatVid), diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs index c432d114b6ee..3009b99df144 100644 --- a/src/librustc/middle/infer/region_inference/mod.rs +++ b/src/librustc/middle/infer/region_inference/mod.rs @@ -74,13 +74,13 @@ pub enum GenericKind<'tcx> { Projection(ty::ProjectionTy<'tcx>), } -#[derive(Copy, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct TwoRegions { a: Region, b: Region, } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum UndoLogEntry { OpenSnapshot, CommitedSnapshot, @@ -91,7 +91,7 @@ pub enum UndoLogEntry { AddCombination(CombineMapType, TwoRegions) } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum CombineMapType { Lub, Glb } @@ -944,10 +944,10 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { // ______________________________________________________________________ -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] enum Classification { Expanding, Contracting } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum VarValue { NoValue, Value(Region), ErrorValue } struct VarData { diff --git a/src/librustc/middle/infer/type_variable.rs b/src/librustc/middle/infer/type_variable.rs index 553ef9afc281..03612a6c1ae5 100644 --- a/src/librustc/middle/infer/type_variable.rs +++ b/src/librustc/middle/infer/type_variable.rs @@ -47,7 +47,7 @@ struct Delegate<'tcx>(PhantomData<&'tcx ()>); type Relation = (RelationDir, ty::TyVid); -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum RelationDir { SubtypeOf, SupertypeOf, EqTo, BiTo } diff --git a/src/librustc/middle/infer/unify.rs b/src/librustc/middle/infer/unify.rs index 8a736d47b5d8..0797fd89302f 100644 --- a/src/librustc/middle/infer/unify.rs +++ b/src/librustc/middle/infer/unify.rs @@ -92,7 +92,7 @@ pub struct Node { pub rank: usize, } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct Delegate(PhantomData); // We can't use V:LatticeValue, much as I would like to, diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index b9a82669f65d..a08de58f909d 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -46,7 +46,7 @@ macro_rules! lets_do_this { $( $variant:ident, $name:expr, $method:ident; )* ) => { -#[derive(Copy, FromPrimitive, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, FromPrimitive, PartialEq, Eq, Hash)] pub enum LangItem { $($variant),* } diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 705f20559afd..d7161607b61e 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -139,7 +139,7 @@ enum LoopKind<'a> { WhileLoop(&'a Expr), } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] struct Variable(usize); #[derive(Copy, PartialEq)] @@ -159,7 +159,7 @@ impl Clone for LiveNode { } } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] enum LiveNodeKind { FreeVarNode(Span), ExprNode(Span), @@ -245,13 +245,13 @@ struct CaptureInfo { var_nid: NodeId } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] struct LocalInfo { id: NodeId, ident: ast::Ident } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] enum VarKind { Arg(NodeId, ast::Ident), Local(LocalInfo), @@ -534,7 +534,7 @@ fn invalid_users() -> Users { } } -#[derive(Copy)] +#[derive(Copy, Clone)] struct Specials { exit_ln: LiveNode, fallthrough_ln: LiveNode, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index 3738e38f6870..85255d04df43 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -199,7 +199,7 @@ pub type cmt<'tcx> = Rc>; // We pun on *T to mean both actual deref of a ptr as well // as accessing of components: -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum deref_kind { deref_ptr(PointerKind), deref_interior(InteriorKind), @@ -263,6 +263,9 @@ pub struct MemCategorizationContext<'t,TYPER:'t> { } impl<'t,TYPER:'t> Copy for MemCategorizationContext<'t,TYPER> {} +impl<'t,TYPER:'t> Clone for MemCategorizationContext<'t,TYPER> { + fn clone(&self) -> MemCategorizationContext<'t,TYPER> { *self } +} pub type McResult = Result; diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs index 3a253735f925..d8efb5655aaa 100644 --- a/src/librustc/middle/privacy.rs +++ b/src/librustc/middle/privacy.rs @@ -32,7 +32,7 @@ pub type ExternalExports = DefIdSet; /// reexporting a public struct doesn't inline the doc). pub type PublicItems = NodeSet; -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum LastPrivate { LastMod(PrivateDep), // `use` directives (imports) can refer to two separate definitions in the @@ -46,14 +46,14 @@ pub enum LastPrivate { type_used: ImportUse}, } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum PrivateDep { AllPublic, DependsOn(ast::DefId), } // How an import is used. -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum ImportUse { Unused, // The import is not used. Used, // The import is used. diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index d8c5f89325b3..a2e502b78d25 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -255,7 +255,7 @@ pub struct RegionMaps { /// Carries the node id for the innermost block or match expression, /// for building up the `var_map` which maps ids to the blocks in /// which they were declared. -#[derive(PartialEq, Eq, Debug, Copy)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] enum InnermostDeclaringBlock { None, Block(ast::NodeId), @@ -280,7 +280,7 @@ impl InnermostDeclaringBlock { /// Contextual information for declarations introduced by a statement /// (i.e. `let`). It carries node-id's for statement and enclosing /// block both, as well as the statement's index within the block. -#[derive(PartialEq, Eq, Debug, Copy)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] struct DeclaringStatementContext { stmt_id: ast::NodeId, block_id: ast::NodeId, @@ -296,7 +296,7 @@ impl DeclaringStatementContext { } } -#[derive(PartialEq, Eq, Debug, Copy)] +#[derive(PartialEq, Eq, Debug, Copy, Clone)] enum InnermostEnclosingExpr { None, Some(ast::NodeId), @@ -318,7 +318,7 @@ impl InnermostEnclosingExpr { } } -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub struct Context { /// the scope that contains any new variables declared var_parent: InnermostDeclaringBlock, diff --git a/src/librustc/middle/traits/select.rs b/src/librustc/middle/traits/select.rs index 9e4f63dca456..a405c5bda7d8 100644 --- a/src/librustc/middle/traits/select.rs +++ b/src/librustc/middle/traits/select.rs @@ -96,7 +96,7 @@ pub enum MethodMatchResult { MethodDidNotMatch, } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum MethodMatchedData { // In the case of a precise match, we don't really need to store // how the match was found. So don't. diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 6e81d14d73ca..9abdd4517050 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -261,7 +261,7 @@ pub struct field_ty { // Contains information needed to resolve types and (in the future) look up // the types of AST nodes. -#[derive(Copy, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] pub struct creader_cache_key { pub cnum: CrateNum, pub pos: usize, @@ -595,7 +595,7 @@ pub type ObjectCastMap<'tcx> = RefCell>>; /// will push one or more such restriction into the /// `transmute_restrictions` vector during `intrinsicck`. They are /// then checked during `trans` by the fn `check_intrinsics`. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct TransmuteRestriction<'tcx> { /// The span whence the restriction comes. pub span: Span, @@ -885,7 +885,7 @@ macro_rules! sty_debug_print { // variable names. mod inner { use middle::ty; - #[derive(Copy)] + #[derive(Copy, Clone)] struct DebugStat { total: usize, region_infer: usize, @@ -4012,7 +4012,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool { /// /// The ordering of the cases is significant. They are sorted so that cmp::max /// will keep the "more erroneous" of two values. -#[derive(Copy, PartialOrd, Ord, Eq, PartialEq, Debug)] +#[derive(Copy, Clone, PartialOrd, Ord, Eq, PartialEq, Debug)] pub enum Representability { Representable, ContainsRecursive, @@ -4743,7 +4743,7 @@ pub fn expr_is_lval(tcx: &ctxt, e: &ast::Expr) -> bool { /// two kinds of rvalues is an artifact of trans which reflects how we will /// generate code for that kind of expression. See trans/expr.rs for more /// information. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum ExprKind { LvalueExpr, RvalueDpsExpr, @@ -5439,7 +5439,7 @@ pub fn item_path_str(cx: &ctxt, id: ast::DefId) -> String { with_path(cx, id, |path| ast_map::path_to_string(path)).to_string() } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum DtorKind { NoDtor, TraitDtor(DefId, bool) @@ -7163,7 +7163,7 @@ pub fn make_substs_for_receiver_types<'tcx>(tcx: &ty::ctxt<'tcx>, trait_ref.substs.clone().with_method(meth_tps, meth_regions) } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum CopyImplementationError { FieldDoesNotImplementCopy(ast::Name), VariantDoesNotImplementCopy(ast::Name), diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index c67819ab7e3c..2e8b135f5afa 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -247,7 +247,7 @@ pub fn basic_options() -> Options { // users can have their own entry // functions that don't start a // scheduler -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum EntryFnType { EntryMain, EntryStart, diff --git a/src/librustc_back/target/apple_ios_base.rs b/src/librustc_back/target/apple_ios_base.rs index 42cbdd7577d8..7dcd6ba6cd11 100644 --- a/src/librustc_back/target/apple_ios_base.rs +++ b/src/librustc_back/target/apple_ios_base.rs @@ -15,7 +15,7 @@ use target::TargetOptions; use self::Arch::*; #[allow(non_camel_case_types)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum Arch { Armv7, Armv7s, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 268e469b7f91..f8da075e4bdc 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -334,7 +334,7 @@ impl ToInteriorKind for mc::InteriorKind { } } -#[derive(Copy, PartialEq, Eq, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub enum LoanPathElem { LpDeref(mc::PointerKind), // `*LV` in README.md LpInterior(InteriorKind), // `LV.f` in README.md @@ -500,13 +500,13 @@ pub struct BckError<'tcx> { code: bckerr_code } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum AliasableViolationKind { MutabilityViolation, BorrowViolation(euv::LoanCause) } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum MovedValueUseKind { MovedInUse, MovedInCapture, diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index a4470acbe4d2..2d1b57243d1c 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -94,7 +94,7 @@ impl Clone for MovePathIndex { const InvalidMovePathIndex: MovePathIndex = MovePathIndex(usize::MAX); /// Index into `MoveData.moves`, used like a pointer -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub struct MoveIndex(usize); impl MoveIndex { @@ -125,7 +125,7 @@ pub struct MovePath<'tcx> { pub next_sibling: MovePathIndex, } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum MoveKind { Declared, // When declared, variables start out "moved". MoveExpr, // Expression or binding that moves a variable @@ -133,7 +133,7 @@ pub enum MoveKind { Captured // Closure creation that moves a value } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct Move { /// Path being moved. pub path: MovePathIndex, @@ -148,7 +148,7 @@ pub struct Move { pub next_move: MoveIndex } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct Assignment { /// Path being assigned. pub path: MovePathIndex, @@ -160,7 +160,7 @@ pub struct Assignment { pub span: Span, } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct VariantMatch { /// downcast to the variant. pub path: MovePathIndex, diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs index fb8afa83d864..ade52bfde35e 100644 --- a/src/librustc_borrowck/graphviz.rs +++ b/src/librustc_borrowck/graphviz.rs @@ -26,7 +26,7 @@ use rustc::middle::dataflow; use std::rc::Rc; use std::borrow::IntoCow; -#[derive(Debug, Copy)] +#[derive(Debug, Copy, Clone)] pub enum Variant { Loans, Moves, diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index be416327dad3..b32c6829a221 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -182,7 +182,7 @@ fn make_input(free_matches: &[String]) -> Option<(Input, Option)> { } // Whether to stop or continue compilation. -#[derive(Copy, Debug, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Compilation { Stop, Continue, @@ -265,7 +265,7 @@ pub trait CompilerCalls<'a> { } // CompilerCalls instance for a regular rustc build. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct RustcDefaultCalls; impl<'a> CompilerCalls<'a> for RustcDefaultCalls { diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index fe55ca3b73bf..0d9bd50927ba 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -44,7 +44,7 @@ use std::option; use std::path::PathBuf; use std::str::FromStr; -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum PpSourceMode { PpmNormal, PpmEveryBodyLoops, @@ -56,7 +56,7 @@ pub enum PpSourceMode { } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum PpFlowGraphMode { Default, /// Drops the labels from the edges in the flowgraph output. This @@ -65,7 +65,7 @@ pub enum PpFlowGraphMode { /// have become a pain to maintain. UnlabelledEdges, } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum PpMode { PpmSource(PpSourceMode), PpmFlowGraph(PpFlowGraphMode), diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index e7443af3013a..7b66f3fe7d05 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -63,7 +63,7 @@ declare_lint! { "suggest using `loop { }` instead of `while true { }`" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct WhileTrue; impl LintPass for WhileTrue { @@ -107,7 +107,7 @@ declare_lint! { "shift exceeds the type's number of bits" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct TypeLimits { /// Id of the last visited negated expression negated_expr_id: ast::NodeId, @@ -431,7 +431,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ImproperCTypesVisitor<'a, 'tcx> { } } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct ImproperCTypes; impl LintPass for ImproperCTypes { @@ -474,7 +474,7 @@ declare_lint! { "use of owned (Box type) heap memory" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct BoxPointers; impl BoxPointers { @@ -621,7 +621,7 @@ declare_lint! { "detects attributes that were not used by the compiler" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnusedAttributes; impl LintPass for UnusedAttributes { @@ -662,7 +662,7 @@ declare_lint! { "path statements with no effect" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct PathStatements; impl LintPass for PathStatements { @@ -696,7 +696,7 @@ declare_lint! { "unused result of an expression in a statement" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnusedResults; impl LintPass for UnusedResults { @@ -764,7 +764,7 @@ declare_lint! { "types, variants, traits and type parameters should have camel case names" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct NonCamelCaseTypes; impl NonCamelCaseTypes { @@ -874,7 +874,7 @@ declare_lint! { "methods, functions, lifetime parameters and modules should have snake case names" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct NonSnakeCase; impl NonSnakeCase { @@ -1014,7 +1014,7 @@ declare_lint! { "static constants should have uppercase identifiers" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct NonUpperCaseGlobals; impl NonUpperCaseGlobals { @@ -1072,7 +1072,7 @@ declare_lint! { "`if`, `match`, `while` and `return` do not need parentheses" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnusedParens; impl UnusedParens { @@ -1166,7 +1166,7 @@ declare_lint! { "unnecessary braces around an imported item" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnusedImportBraces; impl LintPass for UnusedImportBraces { @@ -1196,7 +1196,7 @@ declare_lint! { "using `Struct { x: x }` instead of `Struct { x }`" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct NonShorthandFieldPatterns; impl LintPass for NonShorthandFieldPatterns { @@ -1233,7 +1233,7 @@ declare_lint! { "unnecessary use of an `unsafe` block" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnusedUnsafe; impl LintPass for UnusedUnsafe { @@ -1258,7 +1258,7 @@ declare_lint! { "usage of `unsafe` code" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnsafeCode; impl LintPass for UnsafeCode { @@ -1319,7 +1319,7 @@ declare_lint! { "detect mut variables which don't need to be mutable" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnusedMut; impl UnusedMut { @@ -1388,7 +1388,7 @@ declare_lint! { "detects unnecessary allocations that can be eliminated" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnusedAllocation; impl LintPass for UnusedAllocation { @@ -1625,7 +1625,7 @@ declare_lint! { "detects potentially-forgotten implementations of `Copy`" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct MissingCopyImplementations; impl LintPass for MissingCopyImplementations { @@ -1740,7 +1740,7 @@ declare_lint! { } /// Checks for use of items with `#[deprecated]` attributes -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct Stability; impl Stability { @@ -1800,7 +1800,7 @@ declare_lint! { "functions that cannot return without calling themselves" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnconditionalRecursion; @@ -1991,7 +1991,7 @@ declare_lint! { "compiler plugin used as ordinary library in non-plugin crate" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct PluginAsLibrary; impl LintPass for PluginAsLibrary { @@ -2045,7 +2045,7 @@ declare_lint! { "const items will not have their symbols exported" } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct InvalidNoMangleItems; impl LintPass for InvalidNoMangleItems { @@ -2088,7 +2088,7 @@ impl LintPass for InvalidNoMangleItems { } /// Forbids using the `#[feature(...)]` attribute -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct UnstableFeatures; declare_lint! { diff --git a/src/librustc_llvm/diagnostic.rs b/src/librustc_llvm/diagnostic.rs index aca4d265bc96..e6350ae44d43 100644 --- a/src/librustc_llvm/diagnostic.rs +++ b/src/librustc_llvm/diagnostic.rs @@ -18,7 +18,7 @@ use std::ptr; use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef}; -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum OptimizationDiagnosticKind { OptimizationRemark, OptimizationMissed, @@ -38,7 +38,7 @@ impl OptimizationDiagnosticKind { } #[allow(raw_pointer_derive)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct OptimizationDiagnostic { pub kind: OptimizationDiagnosticKind, pub pass_name: *const c_char, @@ -69,14 +69,13 @@ impl OptimizationDiagnostic { } } +#[derive(Copy, Clone)] pub struct InlineAsmDiagnostic { pub cookie: c_uint, pub message: TwineRef, pub instruction: ValueRef, } -impl Copy for InlineAsmDiagnostic {} - impl InlineAsmDiagnostic { unsafe fn unpack(di: DiagnosticInfoRef) -> InlineAsmDiagnostic { @@ -96,7 +95,7 @@ impl InlineAsmDiagnostic { } } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum Diagnostic { Optimization(OptimizationDiagnostic), InlineAsm(InlineAsmDiagnostic), diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index cdafa4a16d07..9b0ae2e9ef85 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -76,7 +76,7 @@ pub const False: Bool = 0 as Bool; // Consts for the LLVM CallConv type, pre-cast to usize. -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum CallConv { CCallConv = 0, FastCallConv = 8, @@ -86,7 +86,7 @@ pub enum CallConv { X86_64_Win64 = 79, } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum Visibility { LLVMDefaultVisibility = 0, HiddenVisibility = 1, @@ -97,7 +97,7 @@ pub enum Visibility { // DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage. // LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either; // they've been removed in upstream LLVM commit r203866. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum Linkage { ExternalLinkage = 0, AvailableExternallyLinkage = 1, @@ -113,7 +113,7 @@ pub enum Linkage { } #[repr(C)] -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum DiagnosticSeverity { Error, Warning, @@ -154,7 +154,7 @@ bitflags! { #[repr(u64)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum OtherAttribute { // The following are not really exposed in // the LLVM c api so instead to add these @@ -175,13 +175,13 @@ pub enum OtherAttribute { NonNullAttribute = 1 << 44, } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum SpecialAttribute { DereferenceableAttribute(u64) } #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum AttributeSet { ReturnIndex = 0, FunctionIndex = !0 @@ -273,7 +273,7 @@ impl AttrBuilder { } // enum for the LLVM IntPredicate type -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum IntPredicate { IntEQ = 32, IntNE = 33, @@ -288,7 +288,7 @@ pub enum IntPredicate { } // enum for the LLVM RealPredicate type -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum RealPredicate { RealPredicateFalse = 0, RealOEQ = 1, @@ -310,7 +310,7 @@ pub enum RealPredicate { // The LLVM TypeKind type - must stay in sync with the def of // LLVMTypeKind in llvm/include/llvm-c/Core.h -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] #[repr(C)] pub enum TypeKind { Void = 0, @@ -332,7 +332,7 @@ pub enum TypeKind { } #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum AtomicBinOp { AtomicXchg = 0, AtomicAdd = 1, @@ -348,7 +348,7 @@ pub enum AtomicBinOp { } #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum AtomicOrdering { NotAtomic = 0, Unordered = 1, @@ -362,13 +362,13 @@ pub enum AtomicOrdering { // Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h) #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum FileType { AssemblyFileType = 0, ObjectFileType = 1 } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum MetadataType { MD_dbg = 0, MD_tbaa = 1, @@ -385,13 +385,13 @@ pub enum MetadataType { } // Inline Asm Dialect -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum AsmDialect { AD_ATT = 0, AD_Intel = 1 } -#[derive(Copy, PartialEq, Clone)] +#[derive(Copy, Clone, PartialEq)] #[repr(C)] pub enum CodeGenOptLevel { CodeGenLevelNone = 0, @@ -400,7 +400,7 @@ pub enum CodeGenOptLevel { CodeGenLevelAggressive = 3, } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] #[repr(C)] pub enum RelocMode { RelocDefault = 0, @@ -410,7 +410,7 @@ pub enum RelocMode { } #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum CodeGenModel { CodeModelDefault = 0, CodeModelJITDefault = 1, @@ -421,7 +421,7 @@ pub enum CodeGenModel { } #[repr(C)] -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum DiagnosticKind { DK_InlineAsm = 0, DK_StackSize, @@ -533,7 +533,7 @@ pub mod debuginfo { pub type DIEnumerator = DIDescriptor; pub type DITemplateTypeParameter = DIDescriptor; - #[derive(Copy)] + #[derive(Copy, Clone)] pub enum DIDescriptorFlags { FlagPrivate = 1 << 0, FlagProtected = 1 << 1, diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 5bff5479e2ea..52db6013f4d5 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -61,7 +61,7 @@ use std::rc::Rc; // Specifies how duplicates should be handled when adding a child item if // another item exists with the same name in some namespace. -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] enum DuplicateCheckingMode { ForbidDuplicateModules, ForbidDuplicateTypesAndModules, @@ -70,7 +70,7 @@ enum DuplicateCheckingMode { OverwriteDuplicates } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] enum NamespaceError { NoError, ModuleError, diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index ff635a6c46b2..7ba386932ebc 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -107,7 +107,7 @@ mod record_exports; mod build_reduced_graph; mod resolve_imports; -#[derive(Copy)] +#[derive(Copy, Clone)] struct BindingInfo { span: Span, binding_mode: BindingMode, @@ -116,14 +116,14 @@ struct BindingInfo { // Map from the name in a pattern to its binding mode. type BindingMap = HashMap; -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] enum PatternBindingMode { RefutableMode, LocalIrrefutableMode, ArgumentIrrefutableMode, } -#[derive(Copy, PartialEq, Eq, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] enum Namespace { TypeNS, ValueNS @@ -277,7 +277,7 @@ enum FallbackSuggestion { TraitMethod(String), } -#[derive(Copy)] +#[derive(Copy, Clone)] enum TypeParameters<'a> { NoTypeParameters, HasTypeParameters( @@ -294,7 +294,7 @@ enum TypeParameters<'a> { // The rib kind controls the translation of local // definitions (`DefLocal`) to upvars (`DefUpvar`). -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] enum RibKind { // No translation needs to be applied. NormalRibKind, @@ -316,7 +316,7 @@ enum RibKind { ConstantItemRibKind } -#[derive(Copy)] +#[derive(Copy, Clone)] enum UseLexicalScopeFlag { DontUseLexicalScope, UseLexicalScope @@ -327,7 +327,7 @@ enum ModulePrefixResult { PrefixFound(Rc, usize) } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] enum NameSearchType { /// We're doing a name search in order to resolve a `use` directive. ImportSearch, @@ -337,7 +337,7 @@ enum NameSearchType { PathSearch, } -#[derive(Copy)] +#[derive(Copy, Clone)] enum BareIdentifierPatternResolution { FoundStructOrEnumVariant(Def, LastPrivate), FoundConst(Def, LastPrivate), @@ -369,7 +369,7 @@ enum ParentLink { } /// The type of module this is. -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] enum ModuleKind { NormalModuleKind, TraitModuleKind, @@ -3539,7 +3539,7 @@ pub struct CrateMap { pub glob_map: Option } -#[derive(PartialEq,Copy)] +#[derive(PartialEq,Copy, Clone)] pub enum MakeGlobMap { Yes, No diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 44c803c77656..f1a8507b1781 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -37,7 +37,7 @@ use std::rc::Rc; /// Contains data for specific types of import directives. -#[derive(Copy,Debug)] +#[derive(Copy, Clone,Debug)] pub enum ImportDirectiveSubclass { SingleImport(Name /* target */, Name /* source */), GlobImport diff --git a/src/librustc_trans/save/recorder.rs b/src/librustc_trans/save/recorder.rs index f7c0d6a983fb..db724b0ef6b6 100644 --- a/src/librustc_trans/save/recorder.rs +++ b/src/librustc_trans/save/recorder.rs @@ -62,7 +62,7 @@ macro_rules! svec { }) } -#[derive(Copy, Debug, Eq, PartialEq)] +#[derive(Copy, Clone, Debug, Eq, PartialEq)] pub enum Row { Variable, Enum, diff --git a/src/librustc_trans/trans/_match.rs b/src/librustc_trans/trans/_match.rs index ea8197d0c407..ef599a01e7c4 100644 --- a/src/librustc_trans/trans/_match.rs +++ b/src/librustc_trans/trans/_match.rs @@ -228,7 +228,7 @@ use syntax::codemap::Span; use syntax::fold::Folder; use syntax::ptr::P; -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] struct ConstantExpr<'a>(&'a ast::Expr); impl<'a> ConstantExpr<'a> { @@ -311,7 +311,7 @@ impl<'a, 'tcx> Opt<'a, 'tcx> { } } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum BranchKind { NoBranch, Single, diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index 20677ab93fc5..e027ea4b045a 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -2112,7 +2112,7 @@ pub fn llvm_linkage_by_name(name: &str) -> Option { /// Enum describing the origin of an LLVM `Value`, for linkage purposes. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum ValueOrigin { /// The LLVM `Value` is in this context because the corresponding item was /// assigned to the current compilation unit. diff --git a/src/librustc_trans/trans/basic_block.rs b/src/librustc_trans/trans/basic_block.rs index a0aca17538fa..d3d055cda120 100644 --- a/src/librustc_trans/trans/basic_block.rs +++ b/src/librustc_trans/trans/basic_block.rs @@ -13,7 +13,7 @@ use llvm::BasicBlockRef; use trans::value::{Users, Value}; use std::iter::{Filter, Map}; -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct BasicBlock(pub BasicBlockRef); pub type Preds = Map bool>, fn(Value) -> BasicBlock>; diff --git a/src/librustc_trans/trans/callee.rs b/src/librustc_trans/trans/callee.rs index e33ec29017cc..9eb46d3ff549 100644 --- a/src/librustc_trans/trans/callee.rs +++ b/src/librustc_trans/trans/callee.rs @@ -60,7 +60,7 @@ use syntax::ast; use syntax::ast_map; use syntax::ptr::P; -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct MethodData { pub llfn: ValueRef, pub llself: ValueRef, @@ -1110,7 +1110,7 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>, bcx } -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum AutorefArg { DontAutorefArg, DoAutorefArg(ast::NodeId) diff --git a/src/librustc_trans/trans/cleanup.rs b/src/librustc_trans/trans/cleanup.rs index 4897ae286d3e..19891e930722 100644 --- a/src/librustc_trans/trans/cleanup.rs +++ b/src/librustc_trans/trans/cleanup.rs @@ -153,7 +153,7 @@ pub struct CleanupScope<'blk, 'tcx: 'blk> { cached_landing_pad: Option, } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub struct CustomScopeIndex { index: usize } @@ -184,14 +184,14 @@ impl<'blk, 'tcx: 'blk> fmt::Debug for CleanupScopeKind<'blk, 'tcx> { } } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum EarlyExitLabel { UnwindExit, ReturnExit, LoopExit(ast::NodeId, usize) } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct CachedEarlyExit { label: EarlyExitLabel, cleanup_block: BasicBlockRef, @@ -209,7 +209,7 @@ pub trait Cleanup<'tcx> { pub type CleanupObj<'tcx> = Box+'tcx>; -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum ScopeId { AstScope(ast::NodeId), CustomScope(CustomScopeIndex) @@ -982,7 +982,7 @@ impl EarlyExitLabel { /////////////////////////////////////////////////////////////////////////// // Cleanup types -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct DropValue<'tcx> { is_immediate: bool, must_unwind: bool, @@ -1021,12 +1021,12 @@ impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> { } } -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] pub enum Heap { HeapExchange } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct FreeValue<'tcx> { ptr: ValueRef, heap: Heap, @@ -1061,7 +1061,7 @@ impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> { } } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct FreeSlice { ptr: ValueRef, size: ValueRef, @@ -1098,7 +1098,7 @@ impl<'tcx> Cleanup<'tcx> for FreeSlice { } } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct LifetimeEnd { ptr: ValueRef, } diff --git a/src/librustc_trans/trans/common.rs b/src/librustc_trans/trans/common.rs index 995f3caf5887..c5985e930e97 100644 --- a/src/librustc_trans/trans/common.rs +++ b/src/librustc_trans/trans/common.rs @@ -343,7 +343,7 @@ pub fn gensym_name(name: &str) -> PathElem { * */ -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct NodeIdAndSpan { pub id: ast::NodeId, pub span: Span, @@ -1225,7 +1225,7 @@ pub fn drain_fulfillment_cx<'a,'tcx,T>(infcx: &infer::InferCtxt<'a,'tcx>, } // Key used to lookup values supplied for type parameters in an expr. -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum ExprOrMethodCall { // Type parameters for a path like `None::` ExprId(ast::NodeId), diff --git a/src/librustc_trans/trans/datum.rs b/src/librustc_trans/trans/datum.rs index 7b983ca4ac6a..a736a9fe88a1 100644 --- a/src/librustc_trans/trans/datum.rs +++ b/src/librustc_trans/trans/datum.rs @@ -172,7 +172,7 @@ impl Drop for Rvalue { fn drop(&mut self) { } } -#[derive(Copy, PartialEq, Eq, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub enum RvalueMode { /// `val` is a pointer to the actual value (and thus has type *T) ByRef, diff --git a/src/librustc_trans/trans/debuginfo.rs b/src/librustc_trans/trans/debuginfo.rs index 8e9ae2eba0bc..2747288b6075 100644 --- a/src/librustc_trans/trans/debuginfo.rs +++ b/src/librustc_trans/trans/debuginfo.rs @@ -2382,7 +2382,7 @@ impl<'tcx> VariantMemberDescriptionFactory<'tcx> { } } -#[derive(Copy)] +#[derive(Copy, Clone)] enum EnumDiscriminantInfo { RegularDiscriminant(DIType), OptimizedDiscriminant, @@ -3106,7 +3106,7 @@ impl MetadataCreationResult { } } -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] enum InternalDebugLocation { KnownLocation { scope: DIScope, line: usize, col: usize }, UnknownLocation diff --git a/src/librustc_trans/trans/expr.rs b/src/librustc_trans/trans/expr.rs index 46cbd1936002..5a79aa35bfae 100644 --- a/src/librustc_trans/trans/expr.rs +++ b/src/librustc_trans/trans/expr.rs @@ -94,7 +94,7 @@ use std::rc::Rc; // These are passed around by the code generating functions to track the // destination of a computation's value. -#[derive(Copy, PartialEq)] +#[derive(Copy, Clone, PartialEq)] pub enum Dest { SaveIn(ValueRef), Ignore, @@ -2038,7 +2038,7 @@ fn float_cast(bcx: Block, } else { llsrc }; } -#[derive(Copy, PartialEq, Debug)] +#[derive(Copy, Clone, PartialEq, Debug)] pub enum cast_kind { cast_pointer, cast_integral, diff --git a/src/librustc_trans/trans/mod.rs b/src/librustc_trans/trans/mod.rs index f7433e6a7740..c7857d6a775f 100644 --- a/src/librustc_trans/trans/mod.rs +++ b/src/librustc_trans/trans/mod.rs @@ -57,7 +57,7 @@ mod basic_block; mod llrepr; mod cleanup; -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct ModuleTranslation { pub llcx: ContextRef, pub llmod: ModuleRef, diff --git a/src/librustc_trans/trans/tvec.rs b/src/librustc_trans/trans/tvec.rs index 34dfb0eebcf9..791b58d88a93 100644 --- a/src/librustc_trans/trans/tvec.rs +++ b/src/librustc_trans/trans/tvec.rs @@ -33,7 +33,7 @@ use util::ppaux::ty_to_string; use syntax::ast; use syntax::parse::token::InternedString; -#[derive(Copy)] +#[derive(Copy, Clone)] struct VecTypes<'tcx> { unit_ty: Ty<'tcx>, llunit_ty: Type diff --git a/src/librustc_trans/trans/value.rs b/src/librustc_trans/trans/value.rs index c2d91e4e1602..bc71278c1574 100644 --- a/src/librustc_trans/trans/value.rs +++ b/src/librustc_trans/trans/value.rs @@ -14,7 +14,7 @@ use trans::basic_block::BasicBlock; use trans::common::Block; use libc::c_uint; -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct Value(pub ValueRef); macro_rules! opt_val { ($e:expr) => ( @@ -125,7 +125,7 @@ impl Value { } /// Wrapper for LLVM UseRef -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct Use(UseRef); impl Use { diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index af33cdb39326..677ab5685243 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -52,7 +52,7 @@ pub enum MethodError { // A pared down enum describing just the places from which a method // candidate can arise. Used for error reporting only. -#[derive(Copy, PartialOrd, Ord, PartialEq, Eq)] +#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq)] pub enum CandidateSource { ImplSource(ast::DefId), TraitSource(/* trait id */ ast::DefId), diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 6349ea57f2ff..be3fcae9a151 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -109,7 +109,7 @@ pub enum PickAdjustment { AutoRef(ast::Mutability, Box), } -#[derive(PartialEq, Eq, Copy)] +#[derive(PartialEq, Eq, Copy, Clone)] pub enum Mode { // An expression of the form `receiver.method_name(...)`. // Autoderefs are performed on `receiver`, lookup is done based on the diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 9832fe1cb6ea..c5ff8a14bc1c 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -266,7 +266,7 @@ fn type_derefs_to_local<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, }).2.is_some() } -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct TraitInfo { pub def_id: ast::DefId, } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index fbff4e847888..f974c8df5553 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -204,7 +204,7 @@ struct CastCheck<'tcx> { /// When type-checking an expression, we propagate downward /// whatever type hint we are able in the form of an `Expectation`. -#[derive(Copy)] +#[derive(Copy, Clone)] pub enum Expectation<'tcx> { /// We know nothing about what type this expression should have. NoExpectation, @@ -1951,14 +1951,14 @@ impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> { } } -#[derive(Copy, Debug, PartialEq, Eq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum LvaluePreference { PreferMutLvalue, NoPreference } /// Whether `autoderef` requires types to resolve. -#[derive(Copy, Debug, PartialEq, Eq)] +#[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum UnresolvedTypeAction { /// Produce an error and return `ty_err` whenever a type cannot /// be resolved (i.e. it is `ty_infer`). diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 4d7a046fc607..37f43252483a 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -350,7 +350,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { /////////////////////////////////////////////////////////////////////////// // Resolution reason. -#[derive(Copy)] +#[derive(Copy, Clone)] enum ResolveReason { ResolvingExpr(Span), ResolvingLocal(Span), diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index dd306c4da862..8f1b8bf10921 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -135,7 +135,7 @@ struct ItemCtxt<'a,'tcx:'a> { param_bounds: &'a (GetTypeParameterBounds<'tcx>+'a), } -#[derive(Copy, PartialEq, Eq)] +#[derive(Copy, Clone, PartialEq, Eq)] enum AstConvRequest { GetItemTypeScheme(ast::DefId), GetTraitDef(ast::DefId), diff --git a/src/librustc_typeck/rscope.rs b/src/librustc_typeck/rscope.rs index f1050a936e27..c908e21626e5 100644 --- a/src/librustc_typeck/rscope.rs +++ b/src/librustc_typeck/rscope.rs @@ -40,7 +40,7 @@ pub trait RegionScope { // A scope in which all regions must be explicitly named. This is used // for types that appear in structs and so on. -#[derive(Copy)] +#[derive(Copy, Clone)] pub struct ExplicitRscope; impl RegionScope for ExplicitRscope { diff --git a/src/librustc_typeck/variance.rs b/src/librustc_typeck/variance.rs index b014238b6f28..b83d8fc6af7f 100644 --- a/src/librustc_typeck/variance.rs +++ b/src/librustc_typeck/variance.rs @@ -295,10 +295,10 @@ pub fn infer_variance(tcx: &ty::ctxt) { type VarianceTermPtr<'a> = &'a VarianceTerm<'a>; -#[derive(Copy, Debug)] +#[derive(Copy, Clone, Debug)] struct InferredIndex(usize); -#[derive(Copy)] +#[derive(Copy, Clone)] enum VarianceTerm<'a> { ConstantTerm(ty::Variance), TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>), @@ -336,7 +336,7 @@ struct TermsContext<'a, 'tcx: 'a> { inferred_infos: Vec> , } -#[derive(Copy, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq)] enum ParamKind { TypeParam, RegionParam, @@ -560,7 +560,7 @@ struct ConstraintContext<'a, 'tcx: 'a> { /// Declares that the variable `decl_id` appears in a location with /// variance `variance`. -#[derive(Copy)] +#[derive(Copy, Clone)] struct Constraint<'a> { inferred: InferredIndex, variance: &'a VarianceTerm<'a>,