about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-14 23:06:50 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-19 10:51:00 -0500
commit392ea799b8c19e79ed65228841fc47da8660d74a (patch)
treef81442eeaf5f228287fc5c43e2931e31541db2cb /src
parente64a0072d66f0071f47325711a226f34d7b76f05 (diff)
downloadrust-392ea799b8c19e79ed65228841fc47da8660d74a.tar.gz
rust-392ea799b8c19e79ed65228841fc47da8660d74a.zip
librustc_borrowck: use `#[deriving(Copy)]`
Diffstat (limited to 'src')
-rw-r--r--src/librustc_borrowck/borrowck/mod.rs15
-rw-r--r--src/librustc_borrowck/borrowck/move_data.rs29
-rw-r--r--src/librustc_borrowck/graphviz.rs4
3 files changed, 13 insertions, 35 deletions
diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs
index 7f469db3186..9be87b533f2 100644
--- a/src/librustc_borrowck/borrowck/mod.rs
+++ b/src/librustc_borrowck/borrowck/mod.rs
@@ -56,11 +56,9 @@ pub mod gather_loans;
 
 pub mod move_data;
 
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct LoanDataFlowOperator;
 
-impl Copy for LoanDataFlowOperator {}
-
 pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator>;
 
 impl<'a, 'tcx, 'v> Visitor<'v> for BorrowckCtxt<'a, 'tcx> {
@@ -325,14 +323,12 @@ impl<'tcx> LoanPath<'tcx> {
 //     b2b39e8700e37ad32b486b9a8409b50a8a53aa51#commitcomment-7892003
 static DOWNCAST_PRINTED_OPERATOR : &'static str = " as ";
 
-#[deriving(PartialEq, Eq, Hash, Show)]
+#[deriving(Copy, PartialEq, Eq, Hash, Show)]
 pub enum LoanPathElem {
     LpDeref(mc::PointerKind),    // `*LV` in doc.rs
     LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
 }
 
-impl Copy for LoanPathElem {}
-
 pub fn closure_to_block(closure_id: ast::NodeId,
                         tcx: &ty::ctxt) -> ast::NodeId {
     match tcx.map.get(closure_id) {
@@ -494,21 +490,18 @@ pub struct BckError<'tcx> {
     code: bckerr_code
 }
 
+#[deriving(Copy)]
 pub enum AliasableViolationKind {
     MutabilityViolation,
     BorrowViolation(euv::LoanCause)
 }
 
-impl Copy for AliasableViolationKind {}
-
-#[deriving(Show)]
+#[deriving(Copy, Show)]
 pub enum MovedValueUseKind {
     MovedInUse,
     MovedInCapture,
 }
 
-impl Copy for MovedValueUseKind {}
-
 ///////////////////////////////////////////////////////////////////////////
 // Misc
 
diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs
index 00b1377af73..d033fd808aa 100644
--- a/src/librustc_borrowck/borrowck/move_data.rs
+++ b/src/librustc_borrowck/borrowck/move_data.rs
@@ -78,11 +78,9 @@ pub struct FlowedMoveData<'a, 'tcx: 'a> {
 }
 
 /// Index into `MoveData.paths`, used like a pointer
-#[deriving(PartialEq, Eq, PartialOrd, Ord, Show)]
+#[deriving(Copy, PartialEq, Eq, PartialOrd, Ord, Show)]
 pub struct MovePathIndex(uint);
 
-impl Copy for MovePathIndex {}
-
 impl MovePathIndex {
     fn get(&self) -> uint {
         let MovePathIndex(v) = *self; v
@@ -100,11 +98,9 @@ static InvalidMovePathIndex: MovePathIndex =
     MovePathIndex(uint::MAX);
 
 /// Index into `MoveData.moves`, used like a pointer
-#[deriving(PartialEq)]
+#[deriving(Copy, PartialEq)]
 pub struct MoveIndex(uint);
 
-impl Copy for MoveIndex {}
-
 impl MoveIndex {
     fn get(&self) -> uint {
         let MoveIndex(v) = *self; v
@@ -134,7 +130,7 @@ pub struct MovePath<'tcx> {
     pub next_sibling: MovePathIndex,
 }
 
-#[deriving(PartialEq, Show)]
+#[deriving(Copy, PartialEq, Show)]
 pub enum MoveKind {
     Declared,   // When declared, variables start out "moved".
     MoveExpr,   // Expression or binding that moves a variable
@@ -142,8 +138,7 @@ pub enum MoveKind {
     Captured    // Closure creation that moves a value
 }
 
-impl Copy for MoveKind {}
-
+#[deriving(Copy)]
 pub struct Move {
     /// Path being moved.
     pub path: MovePathIndex,
@@ -158,8 +153,7 @@ pub struct Move {
     pub next_move: MoveIndex
 }
 
-impl Copy for Move {}
-
+#[deriving(Copy)]
 pub struct Assignment {
     /// Path being assigned.
     pub path: MovePathIndex,
@@ -171,8 +165,7 @@ pub struct Assignment {
     pub span: Span,
 }
 
-impl Copy for Assignment {}
-
+#[deriving(Copy)]
 pub struct VariantMatch {
     /// downcast to the variant.
     pub path: MovePathIndex,
@@ -187,20 +180,14 @@ pub struct VariantMatch {
     pub mode: euv::MatchMode
 }
 
-impl Copy for VariantMatch {}
-
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct MoveDataFlowOperator;
 
-impl Copy for MoveDataFlowOperator {}
-
 pub type MoveDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, MoveDataFlowOperator>;
 
-#[deriving(Clone)]
+#[deriving(Clone, Copy)]
 pub struct AssignDataFlowOperator;
 
-impl Copy for AssignDataFlowOperator {}
-
 pub type AssignDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, AssignDataFlowOperator>;
 
 fn loan_path_is_precise(loan_path: &LoanPath) -> bool {
diff --git a/src/librustc_borrowck/graphviz.rs b/src/librustc_borrowck/graphviz.rs
index 9d41efd678c..3427be1443b 100644
--- a/src/librustc_borrowck/graphviz.rs
+++ b/src/librustc_borrowck/graphviz.rs
@@ -25,15 +25,13 @@ use rustc::middle::dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
 use rustc::middle::dataflow;
 use std::rc::Rc;
 
-#[deriving(Show)]
+#[deriving(Show, Copy)]
 pub enum Variant {
     Loans,
     Moves,
     Assigns,
 }
 
-impl Copy for Variant {}
-
 impl Variant {
     pub fn short_name(&self) -> &'static str {
         match *self {