1
Fork 0

rollup merge of #23860: nikomatsakis/copy-requires-clone

Conflicts:
	src/test/compile-fail/coherence-impls-copy.rs
This commit is contained in:
Alex Crichton 2015-04-01 18:37:54 -07:00
commit f92e7abefd
224 changed files with 624 additions and 583 deletions

View file

@ -1648,7 +1648,7 @@ specific type.
Implementations are defined with the keyword `impl`. Implementations are defined with the keyword `impl`.
``` ```
# #[derive(Copy)] # #[derive(Copy, Clone)]
# struct Point {x: f64, y: f64}; # struct Point {x: f64, y: f64};
# type Surface = i32; # type Surface = i32;
# struct BoundingBox {x: f64, y: f64, width: f64, height: f64}; # struct BoundingBox {x: f64, y: f64, width: f64, height: f64};
@ -1661,6 +1661,10 @@ struct Circle {
impl Copy for Circle {} impl Copy for Circle {}
impl Clone for Circle {
fn clone(&self) -> Circle { *self }
}
impl Shape for Circle { impl Shape for Circle {
fn draw(&self, s: Surface) { do_draw_circle(s, *self); } fn draw(&self, s: Surface) { do_draw_circle(s, *self); }
fn bounding_box(&self) -> BoundingBox { fn bounding_box(&self) -> BoundingBox {

View file

@ -30,7 +30,7 @@
//! use std::collections::BinaryHeap; //! use std::collections::BinaryHeap;
//! use std::usize; //! use std::usize;
//! //!
//! #[derive(Copy, Eq, PartialEq)] //! #[derive(Copy, Clone, Eq, PartialEq)]
//! struct State { //! struct State {
//! cost: usize, //! cost: usize,
//! position: usize, //! position: usize,

View file

@ -526,7 +526,7 @@ impl<K: Clone, V: Clone> Clone for Node<K, V> {
/// println!("Uninitialized memory: {:?}", handle.into_kv()); /// println!("Uninitialized memory: {:?}", handle.into_kv());
/// } /// }
/// ``` /// ```
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Handle<NodeRef, Type, NodeType> { pub struct Handle<NodeRef, Type, NodeType> {
node: NodeRef, node: NodeRef,
index: usize, index: usize,

View file

@ -21,7 +21,7 @@ use core::ops::{Sub, BitOr, BitAnd, BitXor};
// FIXME(contentions): implement union family of methods? (general design may be wrong here) // FIXME(contentions): implement union family of methods? (general design may be wrong here)
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] #[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
/// A specialized set implementation to use enum types. /// A specialized set implementation to use enum types.
/// ///
/// It is a logic error for an item to be modified in such a way that the transformation of the /// It is a logic error for an item to be modified in such a way that the transformation of the
@ -37,6 +37,10 @@ pub struct EnumSet<E> {
impl<E> Copy for EnumSet<E> {} impl<E> Copy for EnumSet<E> {}
impl<E> Clone for EnumSet<E> {
fn clone(&self) -> EnumSet<E> { *self }
}
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> { impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {

View file

@ -14,7 +14,7 @@ use collections::enum_set::{CLike, EnumSet};
use self::Foo::*; use self::Foo::*;
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[repr(usize)] #[repr(usize)]
enum Foo { enum Foo {
A, B, C A, B, C
@ -218,7 +218,7 @@ fn test_operators() {
#[should_panic] #[should_panic]
fn test_overflow() { fn test_overflow() {
#[allow(dead_code)] #[allow(dead_code)]
#[derive(Copy)] #[derive(Copy, Clone)]
#[repr(usize)] #[repr(usize)]
enum Bar { enum Bar {
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09, V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,

View file

@ -122,7 +122,7 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
/// Rust's memory orderings are [the same as /// Rust's memory orderings are [the same as
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync). /// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Ordering { pub enum Ordering {
/// No ordering constraints, only atomic operations. /// No ordering constraints, only atomic operations.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -14,6 +14,7 @@
use cell::{Cell, RefCell, Ref, RefMut, BorrowState}; use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
use char::CharExt; use char::CharExt;
use clone::Clone;
use iter::Iterator; use iter::Iterator;
use marker::{Copy, PhantomData, Sized}; use marker::{Copy, PhantomData, Sized};
use mem; use mem;
@ -53,7 +54,7 @@ pub type Result = result::Result<(), Error>;
/// occurred. Any extra information must be arranged to be transmitted through /// occurred. Any extra information must be arranged to be transmitted through
/// some other means. /// some other means.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub struct Error; pub struct Error;
/// A collection of methods that are required to format a message into a stream. /// A collection of methods that are required to format a message into a stream.
@ -140,6 +141,12 @@ pub struct ArgumentV1<'a> {
formatter: fn(&Void, &mut Formatter) -> Result, formatter: fn(&Void, &mut Formatter) -> Result,
} }
impl<'a> Clone for ArgumentV1<'a> {
fn clone(&self) -> ArgumentV1<'a> {
*self
}
}
impl<'a> ArgumentV1<'a> { impl<'a> ArgumentV1<'a> {
#[inline(never)] #[inline(never)]
fn show_usize(x: &usize, f: &mut Formatter) -> Result { fn show_usize(x: &usize, f: &mut Formatter) -> Result {
@ -174,7 +181,7 @@ impl<'a> ArgumentV1<'a> {
} }
// flags available in the v1 format of format_args // flags available in the v1 format of format_args
#[derive(Copy)] #[derive(Copy, Clone)]
#[allow(dead_code)] // SignMinus isn't currently used #[allow(dead_code)] // SignMinus isn't currently used
enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, } enum FlagV1 { SignPlus, SignMinus, Alternate, SignAwareZeroPad, }
@ -221,7 +228,7 @@ impl<'a> Arguments<'a> {
/// macro validates the format string at compile-time so usage of the `write` /// macro validates the format string at compile-time so usage of the `write`
/// and `format` functions can be safely performed. /// and `format` functions can be safely performed.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Arguments<'a> { pub struct Arguments<'a> {
// Format string pieces to print. // Format string pieces to print.
pieces: &'a [&'a str], pieces: &'a [&'a str],

View file

@ -139,7 +139,7 @@ impl GenericRadix for Radix {
/// A helper type for formatting radixes. /// A helper type for formatting radixes.
#[unstable(feature = "core", #[unstable(feature = "core",
reason = "may be renamed or move to a different module")] reason = "may be renamed or move to a different module")]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct RadixFmt<T, R>(T, R); pub struct RadixFmt<T, R>(T, R);
/// Constructs a radix formatter in the range of `2..36`. /// Constructs a radix formatter in the range of `2..36`.

View file

@ -16,7 +16,7 @@
#![stable(feature = "rust1", since = "1.0.0")] #![stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)] #[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct Argument { pub struct Argument {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -25,7 +25,7 @@ pub struct Argument {
pub format: FormatSpec, pub format: FormatSpec,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub struct FormatSpec { pub struct FormatSpec {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -41,7 +41,7 @@ pub struct FormatSpec {
} }
/// Possible alignments that can be requested as part of a formatting directive. /// Possible alignments that can be requested as part of a formatting directive.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum Alignment { pub enum Alignment {
/// Indication that contents should be left-aligned. /// Indication that contents should be left-aligned.
@ -58,7 +58,7 @@ pub enum Alignment {
Unknown, Unknown,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum Count { pub enum Count {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -71,7 +71,7 @@ pub enum Count {
Implied, Implied,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum Position { pub enum Position {
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]

View file

@ -76,7 +76,7 @@ pub trait Sized : MarkerTrait {
/// ///
/// ``` /// ```
/// // we can just derive a `Copy` implementation /// // we can just derive a `Copy` implementation
/// #[derive(Debug, Copy)] /// #[derive(Debug, Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// let x = Foo; /// let x = Foo;
@ -125,7 +125,7 @@ pub trait Sized : MarkerTrait {
/// There are two ways to implement `Copy` on your type: /// There are two ways to implement `Copy` on your type:
/// ///
/// ``` /// ```
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct MyStruct; /// struct MyStruct;
/// ``` /// ```
/// ///
@ -134,6 +134,7 @@ pub trait Sized : MarkerTrait {
/// ``` /// ```
/// struct MyStruct; /// struct MyStruct;
/// impl Copy for MyStruct {} /// impl Copy for MyStruct {}
/// impl Clone for MyStruct { fn clone(&self) -> MyStruct { *self } }
/// ``` /// ```
/// ///
/// There is a small difference between the two: the `derive` strategy will also place a `Copy` /// There is a small difference between the two: the `derive` strategy will also place a `Copy`
@ -155,7 +156,7 @@ pub trait Sized : MarkerTrait {
/// change: that second example would fail to compile if we made `Foo` non-`Copy`. /// change: that second example would fail to compile if we made `Foo` non-`Copy`.
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
#[lang="copy"] #[lang="copy"]
pub trait Copy : MarkerTrait { pub trait Copy : Clone {
// Empty. // Empty.
} }

View file

@ -2444,7 +2444,7 @@ impl_num_cast! { f32, to_f32 }
impl_num_cast! { f64, to_f64 } impl_num_cast! { f64, to_f64 }
/// Used for representing the classification of floating point numbers /// Used for representing the classification of floating point numbers
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
pub enum FpCategory { pub enum FpCategory {
/// "Not a Number", often obtained by dividing by zero /// "Not a Number", often obtained by dividing by zero

View file

@ -165,7 +165,7 @@ macro_rules! forward_ref_binop {
/// ``` /// ```
/// use std::ops::Add; /// use std::ops::Add;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Add for Foo { /// impl Add for Foo {
@ -219,7 +219,7 @@ add_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// ``` /// ```
/// use std::ops::Sub; /// use std::ops::Sub;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Sub for Foo { /// impl Sub for Foo {
@ -273,7 +273,7 @@ sub_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// ``` /// ```
/// use std::ops::Mul; /// use std::ops::Mul;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Mul for Foo { /// impl Mul for Foo {
@ -327,7 +327,7 @@ mul_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// ``` /// ```
/// use std::ops::Div; /// use std::ops::Div;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Div for Foo { /// impl Div for Foo {
@ -381,7 +381,7 @@ div_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// ``` /// ```
/// use std::ops::Rem; /// use std::ops::Rem;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Rem for Foo { /// impl Rem for Foo {
@ -454,7 +454,7 @@ rem_float_impl! { f64, fmod }
/// ``` /// ```
/// use std::ops::Neg; /// use std::ops::Neg;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Neg for Foo { /// impl Neg for Foo {
@ -527,7 +527,7 @@ neg_impl_numeric! { isize i8 i16 i32 i64 f32 f64 }
/// ``` /// ```
/// use std::ops::Not; /// use std::ops::Not;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Not for Foo { /// impl Not for Foo {
@ -581,7 +581,7 @@ not_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
/// ``` /// ```
/// use std::ops::BitAnd; /// use std::ops::BitAnd;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl BitAnd for Foo { /// impl BitAnd for Foo {
@ -635,7 +635,7 @@ bitand_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
/// ``` /// ```
/// use std::ops::BitOr; /// use std::ops::BitOr;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl BitOr for Foo { /// impl BitOr for Foo {
@ -689,7 +689,7 @@ bitor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
/// ``` /// ```
/// use std::ops::BitXor; /// use std::ops::BitXor;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl BitXor for Foo { /// impl BitXor for Foo {
@ -743,7 +743,7 @@ bitxor_impl! { bool usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
/// ``` /// ```
/// use std::ops::Shl; /// use std::ops::Shl;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Shl<Foo> for Foo { /// impl Shl<Foo> for Foo {
@ -815,7 +815,7 @@ shl_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
/// ``` /// ```
/// use std::ops::Shr; /// use std::ops::Shr;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// ///
/// impl Shr<Foo> for Foo { /// impl Shr<Foo> for Foo {
@ -887,7 +887,7 @@ shr_impl_all! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
/// ``` /// ```
/// use std::ops::Index; /// use std::ops::Index;
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// struct Bar; /// struct Bar;
/// ///
@ -928,7 +928,7 @@ pub trait Index<Idx: ?Sized> {
/// ``` /// ```
/// use std::ops::{Index, IndexMut}; /// use std::ops::{Index, IndexMut};
/// ///
/// #[derive(Copy)] /// #[derive(Copy, Clone)]
/// struct Foo; /// struct Foo;
/// struct Bar; /// struct Bar;
/// ///

View file

@ -18,6 +18,7 @@
//! //!
//! Their definition should always match the ABI defined in `rustc::back::abi`. //! Their definition should always match the ABI defined in `rustc::back::abi`.
use clone::Clone;
use marker::Copy; use marker::Copy;
use mem; use mem;
@ -63,6 +64,9 @@ pub struct Slice<T> {
} }
impl<T> Copy for Slice<T> {} impl<T> Copy for Slice<T> {}
impl<T> Clone for Slice<T> {
fn clone(&self) -> Slice<T> { *self }
}
/// The representation of a trait object like `&SomeTrait`. /// The representation of a trait object like `&SomeTrait`.
/// ///
@ -136,7 +140,7 @@ impl<T> Copy for Slice<T> {}
/// assert_eq!(synthesized.bar(), 457); /// assert_eq!(synthesized.bar(), 457);
/// ``` /// ```
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct TraitObject { pub struct TraitObject {
pub data: *mut (), pub data: *mut (),
pub vtable: *mut (), pub vtable: *mut (),

View file

@ -38,7 +38,7 @@
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct i8x16(pub i8, pub i8, pub i8, pub i8, pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8, pub i8,
@ -47,26 +47,26 @@ pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct i16x8(pub i16, pub i16, pub i16, pub i16, pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
pub i16, pub i16, pub i16, pub i16); pub i16, pub i16, pub i16, pub i16);
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct i32x4(pub i32, pub i32, pub i32, pub i32); pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct i64x2(pub i64, pub i64); pub struct i64x2(pub i64, pub i64);
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct u8x16(pub u8, pub u8, pub u8, pub u8, pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8, pub u8,
@ -75,31 +75,31 @@ pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct u16x8(pub u16, pub u16, pub u16, pub u16, pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
pub u16, pub u16, pub u16, pub u16); pub u16, pub u16, pub u16, pub u16);
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct u32x4(pub u32, pub u32, pub u32, pub u32); pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct u64x2(pub u64, pub u64); pub struct u64x2(pub u64, pub u64);
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct f32x4(pub f32, pub f32, pub f32, pub f32); pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[unstable(feature = "core")] #[unstable(feature = "core")]
#[simd] #[simd]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[repr(C)] #[repr(C)]
pub struct f64x2(pub f64, pub f64); pub struct f64x2(pub f64, pub f64);

View file

@ -1105,7 +1105,7 @@ static UTF8_CHAR_WIDTH: [u8; 256] = [
/// Struct that contains a `char` and the index of the first byte of /// Struct that contains a `char` and the index of the first byte of
/// the next `char` in a string. This can be used as a data structure /// the next `char` in a string. This can be used as a data structure
/// for iterating over the UTF-8 bytes of a string. /// for iterating over the UTF-8 bytes of a string.
#[derive(Copy)] #[derive(Copy, Clone)]
#[unstable(feature = "str_char", #[unstable(feature = "str_char",
reason = "existence of this struct is uncertain as it is frequently \ reason = "existence of this struct is uncertain as it is frequently \
able to be replaced with char.len_utf8() and/or \ able to be replaced with char.len_utf8() and/or \

View file

@ -40,7 +40,7 @@ use std::string;
/// A piece is a portion of the format string which represents the next part /// A piece is a portion of the format string which represents the next part
/// to emit. These are emitted as a stream by the `Parser` class. /// to emit. These are emitted as a stream by the `Parser` class.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum Piece<'a> { pub enum Piece<'a> {
/// A literal string which should directly be emitted /// A literal string which should directly be emitted
String(&'a str), String(&'a str),
@ -50,7 +50,7 @@ pub enum Piece<'a> {
} }
/// Representation of an argument specification. /// Representation of an argument specification.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct Argument<'a> { pub struct Argument<'a> {
/// Where to find this argument /// Where to find this argument
pub position: Position<'a>, pub position: Position<'a>,
@ -59,7 +59,7 @@ pub struct Argument<'a> {
} }
/// Specification for the formatting of an argument in the format string. /// Specification for the formatting of an argument in the format string.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct FormatSpec<'a> { pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with /// Optionally specified character to fill alignment with
pub fill: Option<char>, pub fill: Option<char>,
@ -78,7 +78,7 @@ pub struct FormatSpec<'a> {
} }
/// Enum describing where an argument for a format can be located. /// Enum describing where an argument for a format can be located.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum Position<'a> { pub enum Position<'a> {
/// The argument will be in the next position. This is the default. /// The argument will be in the next position. This is the default.
ArgumentNext, ArgumentNext,
@ -89,7 +89,7 @@ pub enum Position<'a> {
} }
/// Enum of alignments which are supported. /// Enum of alignments which are supported.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum Alignment { pub enum Alignment {
/// The value will be aligned to the left. /// The value will be aligned to the left.
AlignLeft, AlignLeft,
@ -103,7 +103,7 @@ pub enum Alignment {
/// Various flags which can be applied to format strings. The meaning of these /// Various flags which can be applied to format strings. The meaning of these
/// flags is defined by the formatters themselves. /// flags is defined by the formatters themselves.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum Flag { pub enum Flag {
/// A `+` will be used to denote positive numbers. /// A `+` will be used to denote positive numbers.
FlagSignPlus, FlagSignPlus,
@ -119,7 +119,7 @@ pub enum Flag {
/// A count is used for the precision and width parameters of an integer, and /// A count is used for the precision and width parameters of an integer, and
/// can reference either an argument or a literal integer. /// can reference either an argument or a literal integer.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum Count<'a> { pub enum Count<'a> {
/// The count is specified explicitly. /// The count is specified explicitly.
CountIs(usize), CountIs(usize),

View file

@ -213,7 +213,7 @@ pub enum Fail {
} }
/// The type of failure that occurred. /// The type of failure that occurred.
#[derive(Copy, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[allow(missing_docs)] #[allow(missing_docs)]
pub enum FailType { pub enum FailType {
ArgumentMissing_, ArgumentMissing_,
@ -843,18 +843,18 @@ pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> String {
line line
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum SplitWithinState { enum SplitWithinState {
A, // leading whitespace, initial state A, // leading whitespace, initial state
B, // words B, // words
C, // internal and trailing whitespace C, // internal and trailing whitespace
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum Whitespace { enum Whitespace {
Ws, // current char is whitespace Ws, // current char is whitespace
Cr // current char is not whitespace Cr // current char is not whitespace
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum LengthLimit { enum LengthLimit {
UnderLim, // current char makes current substring still fit in limit UnderLim, // current char makes current substring still fit in limit
OverLim // current char makes current substring no longer fit in limit OverLim // current char makes current substring no longer fit in limit

View file

@ -524,7 +524,7 @@ pub trait GraphWalk<'a, N, E> {
fn target(&'a self, edge: &E) -> N; fn target(&'a self, edge: &E) -> N;
} }
#[derive(Copy, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum RenderOption { pub enum RenderOption {
NoEdgeLabels, NoEdgeLabels,
NoNodeLabels, NoNodeLabels,

File diff suppressed because it is too large Load diff

View file

@ -239,7 +239,7 @@ pub trait Logger {
struct DefaultLogger { handle: Stderr } struct DefaultLogger { handle: Stderr }
/// Wraps the log level with fmt implementations. /// Wraps the log level with fmt implementations.
#[derive(Copy, PartialEq, PartialOrd, Debug)] #[derive(Copy, Clone, PartialEq, PartialOrd, Debug)]
pub struct LogLevel(pub u32); pub struct LogLevel(pub u32);
impl fmt::Display for LogLevel { impl fmt::Display for LogLevel {
@ -355,7 +355,7 @@ pub struct LogRecord<'a> {
} }
#[doc(hidden)] #[doc(hidden)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct LogLocation { pub struct LogLocation {
pub module_path: &'static str, pub module_path: &'static str,
pub file: &'static str, pub file: &'static str,

View file

@ -29,7 +29,7 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
/// Generate Normal Random /// Generate Normal Random
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield /// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
/// College, Oxford /// College, Oxford
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Exp1(pub f64); pub struct Exp1(pub f64);
// This could be done via `-rng.gen::<f64>().ln()` but that is slower. // This could be done via `-rng.gen::<f64>().ln()` but that is slower.
@ -68,7 +68,7 @@ impl Rand for Exp1 {
/// let v = exp.ind_sample(&mut rand::thread_rng()); /// let v = exp.ind_sample(&mut rand::thread_rng());
/// println!("{} is from a Exp(2) distribution", v); /// println!("{} is from a Exp(2) distribution", v);
/// ``` /// ```
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Exp { pub struct Exp {
/// `lambda` stored as `1/lambda`, since this is what we scale by. /// `lambda` stored as `1/lambda`, since this is what we scale by.
lambda_inverse: f64 lambda_inverse: f64

View file

@ -28,7 +28,7 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
/// Generate Normal Random /// Generate Normal Random
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield /// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
/// College, Oxford /// College, Oxford
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct StandardNormal(pub f64); pub struct StandardNormal(pub f64);
impl Rand for StandardNormal { impl Rand for StandardNormal {
@ -85,7 +85,7 @@ impl Rand for StandardNormal {
/// let v = normal.ind_sample(&mut rand::thread_rng()); /// let v = normal.ind_sample(&mut rand::thread_rng());
/// println!("{} is from a N(2, 9) distribution", v) /// println!("{} is from a N(2, 9) distribution", v)
/// ``` /// ```
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Normal { pub struct Normal {
mean: f64, mean: f64,
std_dev: f64, std_dev: f64,
@ -134,7 +134,7 @@ impl IndependentSample<f64> for Normal {
/// let v = log_normal.ind_sample(&mut rand::thread_rng()); /// let v = log_normal.ind_sample(&mut rand::thread_rng());
/// println!("{} is from an ln N(2, 9) distribution", v) /// println!("{} is from an ln N(2, 9) distribution", v)
/// ``` /// ```
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct LogNormal { pub struct LogNormal {
norm: Normal norm: Normal
} }

View file

@ -134,7 +134,7 @@ pub trait Reseeder<R> {
/// Reseed an RNG using a `Default` instance. This reseeds by /// Reseed an RNG using a `Default` instance. This reseeds by
/// replacing the RNG with the result of a `Default::default` call. /// replacing the RNG with the result of a `Default::default` call.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct ReseedWithDefault; pub struct ReseedWithDefault;
impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault { impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault {

View file

@ -175,7 +175,7 @@ pub struct TaggedDoc<'a> {
pub doc: Doc<'a>, pub doc: Doc<'a>,
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum EbmlEncoderTag { pub enum EbmlEncoderTag {
// tags 00..1f are reserved for auto-serialization. // tags 00..1f are reserved for auto-serialization.
// first NUM_IMPLICIT_TAGS tags are implicitly sized and lengths are not encoded. // first NUM_IMPLICIT_TAGS tags are implicitly sized and lengths are not encoded.
@ -265,7 +265,7 @@ pub mod reader {
) )
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Res { pub struct Res {
pub val: usize, pub val: usize,
pub next: usize pub next: usize

View file

@ -113,7 +113,7 @@ declare_lint! {
} }
/// Does nothing as a lint pass, but registers some `Lint`s /// Does nothing as a lint pass, but registers some `Lint`s
/// which are used by other parts of the compiler. /// which are used by other parts of the compiler.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct HardwiredLints; pub struct HardwiredLints;
impl LintPass for HardwiredLints { impl LintPass for HardwiredLints {

View file

@ -41,7 +41,7 @@ pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_a
GatherNodeLevels}; GatherNodeLevels};
/// Specification of a single lint. /// Specification of a single lint.
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub struct Lint { pub struct Lint {
/// A string identifier for the lint. /// A string identifier for the lint.
/// ///

View file

@ -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; pub const tag_items_data_item_reexport_name: usize = 0x48;
// used to encode crate_ctxt side tables // used to encode crate_ctxt side tables
#[derive(Copy, PartialEq, FromPrimitive)] #[derive(Copy, Clone, PartialEq, FromPrimitive)]
#[repr(usize)] #[repr(usize)]
pub enum astencode_tag { // Reserves 0x50 -- 0x6f pub enum astencode_tag { // Reserves 0x50 -- 0x6f
tag_ast = 0x50, tag_ast = 0x50,

View file

@ -29,7 +29,7 @@ use syntax::parse::token;
use std::collections::hash_map::HashMap; use std::collections::hash_map::HashMap;
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct MethodInfo { pub struct MethodInfo {
pub name: ast::Name, pub name: ast::Name,
pub def_id: ast::DefId, pub def_id: ast::DefId,

View file

@ -21,7 +21,7 @@ use std::path::{Path, PathBuf};
use util::fs as myfs; use util::fs as myfs;
use session::search_paths::{SearchPaths, PathKind}; use session::search_paths::{SearchPaths, PathKind};
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum FileMatch { pub enum FileMatch {
FileMatches, FileMatches,
FileDoesntMatch, FileDoesntMatch,

View file

@ -43,7 +43,7 @@ use syntax::parse::token;
// def-id will depend on where it originated from. Therefore, the conversion // 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 // function is given an indicator of the source of the def-id. See
// astencode.rs for more information. // astencode.rs for more information.
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum DefIdSource { pub enum DefIdSource {
// Identifies a struct, trait, enum, etc. // Identifies a struct, trait, enum, etc.
NominalType, NominalType,

View file

@ -25,7 +25,7 @@ struct CFGBuilder<'a, 'tcx: 'a> {
loop_scopes: Vec<LoopScope>, loop_scopes: Vec<LoopScope>,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
struct LoopScope { struct LoopScope {
loop_id: ast::NodeId, // id of loop/while node loop_id: ast::NodeId, // id of loop/while node
continue_index: CFGIndex, // where to go on a `loop` continue_index: CFGIndex, // where to go on a `loop`

View file

@ -24,7 +24,7 @@ pub struct CFG {
pub exit: CFGIndex, pub exit: CFGIndex,
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum CFGNodeData { pub enum CFGNodeData {
AST(ast::NodeId), AST(ast::NodeId),
Entry, Entry,

View file

@ -76,7 +76,7 @@ bitflags! {
} }
} }
#[derive(Copy, Eq, PartialEq)] #[derive(Copy, Clone, Eq, PartialEq)]
enum Mode { enum Mode {
Const, Const,
Static, Static,

View file

@ -21,7 +21,7 @@ enum Context {
Normal, Loop, Closure Normal, Loop, Closure
} }
#[derive(Copy)] #[derive(Copy, Clone)]
struct CheckLoopVisitor<'a> { struct CheckLoopVisitor<'a> {
sess: &'a Session, sess: &'a Session,
cx: Context cx: Context

View file

@ -128,7 +128,7 @@ enum Usefulness {
NotUseful NotUseful
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum WitnessPreference { enum WitnessPreference {
ConstructWitness, ConstructWitness,
LeaveOutWitness LeaveOutWitness

View file

@ -28,7 +28,7 @@ use syntax::visit;
use syntax::print::{pp, pprust}; use syntax::print::{pp, pprust};
use util::nodemap::NodeMap; use util::nodemap::NodeMap;
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum EntryOrExit { pub enum EntryOrExit {
Entry, Entry,
Exit, Exit,

View file

@ -104,7 +104,7 @@ pub type DefMap = RefCell<NodeMap<PathResolution>>;
// within. // within.
pub type ExportMap = NodeMap<Vec<Export>>; pub type ExportMap = NodeMap<Vec<Export>>;
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Export { pub struct Export {
pub name: ast::Name, // The name of the target. pub name: ast::Name, // The name of the target.
pub def_id: ast::DefId, // The definition of the target. pub def_id: ast::DefId, // The definition of the target.

View file

@ -22,7 +22,7 @@ use syntax::codemap::Span;
use syntax::visit; use syntax::visit;
use syntax::visit::Visitor; use syntax::visit::Visitor;
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
enum UnsafeContext { enum UnsafeContext {
SafeContext, SafeContext,
UnsafeFn, UnsafeFn,

View file

@ -94,7 +94,7 @@ pub trait Delegate<'tcx> {
mode: MutateMode); mode: MutateMode);
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum LoanCause { pub enum LoanCause {
ClosureCapture(Span), ClosureCapture(Span),
AddrOf, AddrOf,
@ -106,20 +106,20 @@ pub enum LoanCause {
MatchDiscriminant MatchDiscriminant
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum ConsumeMode { pub enum ConsumeMode {
Copy, // reference to x where x has a type that copies Copy, // reference to x where x has a type that copies
Move(MoveReason), // reference to x where x has a type that moves Move(MoveReason), // reference to x where x has a type that moves
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum MoveReason { pub enum MoveReason {
DirectRefMove, DirectRefMove,
PatBindingMove, PatBindingMove,
CaptureMove, CaptureMove,
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum MatchMode { pub enum MatchMode {
NonBindingMatch, NonBindingMatch,
BorrowingMatch, BorrowingMatch,
@ -127,7 +127,7 @@ pub enum MatchMode {
MovingMatch, MovingMatch,
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
enum TrackMatchMode { enum TrackMatchMode {
Unknown, Unknown,
Definite(MatchMode), Definite(MatchMode),
@ -194,14 +194,14 @@ impl TrackMatchMode {
} }
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum MutateMode { pub enum MutateMode {
Init, Init,
JustWrite, // x = y JustWrite, // x = y
WriteAndRead, // x += y WriteAndRead, // x += y
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum OverloadedCallType { enum OverloadedCallType {
FnOverloadedCall, FnOverloadedCall,
FnMutOverloadedCall, FnMutOverloadedCall,

View file

@ -66,13 +66,13 @@ pub struct NodeIndex(pub usize);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
pub const InvalidNodeIndex: NodeIndex = NodeIndex(usize::MAX); pub const InvalidNodeIndex: NodeIndex = NodeIndex(usize::MAX);
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub struct EdgeIndex(pub usize); pub struct EdgeIndex(pub usize);
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(usize::MAX); pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(usize::MAX);
// Use a private field here to guarantee no more instances are created: // Use a private field here to guarantee no more instances are created:
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub struct Direction { repr: usize } pub struct Direction { repr: usize }
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
pub const Outgoing: Direction = Direction { repr: 0 }; pub const Outgoing: Direction = Direction { repr: 0 };

View file

@ -290,7 +290,7 @@ pub enum RegionVariableOrigin {
BoundRegionInCoherence(ast::Name), BoundRegionInCoherence(ast::Name),
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum fixup_err { pub enum fixup_err {
unresolved_int_ty(IntVid), unresolved_int_ty(IntVid),
unresolved_float_ty(FloatVid), unresolved_float_ty(FloatVid),

View file

@ -74,13 +74,13 @@ pub enum GenericKind<'tcx> {
Projection(ty::ProjectionTy<'tcx>), Projection(ty::ProjectionTy<'tcx>),
} }
#[derive(Copy, PartialEq, Eq, Hash)] #[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct TwoRegions { pub struct TwoRegions {
a: Region, a: Region,
b: Region, b: Region,
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum UndoLogEntry { pub enum UndoLogEntry {
OpenSnapshot, OpenSnapshot,
CommitedSnapshot, CommitedSnapshot,
@ -91,7 +91,7 @@ pub enum UndoLogEntry {
AddCombination(CombineMapType, TwoRegions) AddCombination(CombineMapType, TwoRegions)
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum CombineMapType { pub enum CombineMapType {
Lub, Glb Lub, Glb
} }
@ -951,10 +951,10 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
// ______________________________________________________________________ // ______________________________________________________________________
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
enum Classification { Expanding, Contracting } enum Classification { Expanding, Contracting }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum VarValue { NoValue, Value(Region), ErrorValue } pub enum VarValue { NoValue, Value(Region), ErrorValue }
struct VarData { struct VarData {

View file

@ -47,7 +47,7 @@ struct Delegate<'tcx>(PhantomData<&'tcx ()>);
type Relation = (RelationDir, ty::TyVid); type Relation = (RelationDir, ty::TyVid);
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum RelationDir { pub enum RelationDir {
SubtypeOf, SupertypeOf, EqTo, BiTo SubtypeOf, SupertypeOf, EqTo, BiTo
} }

View file

@ -84,7 +84,7 @@ pub struct Node<K:UnifyKey> {
pub rank: usize, pub rank: usize,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Delegate<K>(PhantomData<K>); pub struct Delegate<K>(PhantomData<K>);
// We can't use V:LatticeValue, much as I would like to, // We can't use V:LatticeValue, much as I would like to,

View file

@ -46,7 +46,7 @@ macro_rules! lets_do_this {
$( $variant:ident, $name:expr, $method:ident; )* $( $variant:ident, $name:expr, $method:ident; )*
) => { ) => {
#[derive(Copy, FromPrimitive, PartialEq, Eq, Hash)] #[derive(Copy, Clone, FromPrimitive, PartialEq, Eq, Hash)]
pub enum LangItem { pub enum LangItem {
$($variant),* $($variant),*
} }

View file

@ -139,7 +139,7 @@ enum LoopKind<'a> {
WhileLoop(&'a Expr), WhileLoop(&'a Expr),
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
struct Variable(usize); struct Variable(usize);
#[derive(Copy, PartialEq)] #[derive(Copy, PartialEq)]
@ -159,7 +159,7 @@ impl Clone for LiveNode {
} }
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
enum LiveNodeKind { enum LiveNodeKind {
FreeVarNode(Span), FreeVarNode(Span),
ExprNode(Span), ExprNode(Span),
@ -245,13 +245,13 @@ struct CaptureInfo {
var_nid: NodeId var_nid: NodeId
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
struct LocalInfo { struct LocalInfo {
id: NodeId, id: NodeId,
ident: ast::Ident ident: ast::Ident
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
enum VarKind { enum VarKind {
Arg(NodeId, ast::Ident), Arg(NodeId, ast::Ident),
Local(LocalInfo), Local(LocalInfo),
@ -534,7 +534,7 @@ fn invalid_users() -> Users {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
struct Specials { struct Specials {
exit_ln: LiveNode, exit_ln: LiveNode,
fallthrough_ln: LiveNode, fallthrough_ln: LiveNode,

View file

@ -199,7 +199,7 @@ pub type cmt<'tcx> = Rc<cmt_<'tcx>>;
// We pun on *T to mean both actual deref of a ptr as well // We pun on *T to mean both actual deref of a ptr as well
// as accessing of components: // as accessing of components:
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum deref_kind { pub enum deref_kind {
deref_ptr(PointerKind), deref_ptr(PointerKind),
deref_interior(InteriorKind), 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> Copy for MemCategorizationContext<'t,TYPER> {}
impl<'t,TYPER:'t> Clone for MemCategorizationContext<'t,TYPER> {
fn clone(&self) -> MemCategorizationContext<'t,TYPER> { *self }
}
pub type McResult<T> = Result<T, ()>; pub type McResult<T> = Result<T, ()>;

View file

@ -271,7 +271,7 @@ pub struct RegionMaps {
/// Carries the node id for the innermost block or match expression, /// Carries the node id for the innermost block or match expression,
/// for building up the `var_map` which maps ids to the blocks in /// for building up the `var_map` which maps ids to the blocks in
/// which they were declared. /// which they were declared.
#[derive(PartialEq, Eq, Debug, Copy)] #[derive(PartialEq, Eq, Debug, Copy, Clone)]
enum InnermostDeclaringBlock { enum InnermostDeclaringBlock {
None, None,
Block(ast::NodeId), Block(ast::NodeId),
@ -296,7 +296,7 @@ impl InnermostDeclaringBlock {
/// Contextual information for declarations introduced by a statement /// Contextual information for declarations introduced by a statement
/// (i.e. `let`). It carries node-id's for statement and enclosing /// (i.e. `let`). It carries node-id's for statement and enclosing
/// block both, as well as the statement's index within the block. /// 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 { struct DeclaringStatementContext {
stmt_id: ast::NodeId, stmt_id: ast::NodeId,
block_id: ast::NodeId, block_id: ast::NodeId,
@ -312,7 +312,7 @@ impl DeclaringStatementContext {
} }
} }
#[derive(PartialEq, Eq, Debug, Copy)] #[derive(PartialEq, Eq, Debug, Copy, Clone)]
enum InnermostEnclosingExpr { enum InnermostEnclosingExpr {
None, None,
Some(ast::NodeId), Some(ast::NodeId),
@ -334,7 +334,7 @@ impl InnermostEnclosingExpr {
} }
} }
#[derive(Debug, Copy)] #[derive(Debug, Copy, Clone)]
pub struct Context { pub struct Context {
/// the root of the current region tree. This is typically the id /// the root of the current region tree. This is typically the id
/// of the innermost fn body. Each fn forms its own disjoint tree /// of the innermost fn body. Each fn forms its own disjoint tree

View file

@ -99,7 +99,7 @@ pub enum MethodMatchResult {
MethodDidNotMatch, MethodDidNotMatch,
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum MethodMatchedData { pub enum MethodMatchedData {
// In the case of a precise match, we don't really need to store // In the case of a precise match, we don't really need to store
// how the match was found. So don't. // how the match was found. So don't.

View file

@ -262,7 +262,7 @@ pub struct field_ty {
// Contains information needed to resolve types and (in the future) look up // Contains information needed to resolve types and (in the future) look up
// the types of AST nodes. // the types of AST nodes.
#[derive(Copy, PartialEq, Eq, Hash)] #[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct creader_cache_key { pub struct creader_cache_key {
pub cnum: CrateNum, pub cnum: CrateNum,
pub pos: usize, pub pos: usize,
@ -596,7 +596,7 @@ pub type ObjectCastMap<'tcx> = RefCell<NodeMap<ty::PolyTraitRef<'tcx>>>;
/// will push one or more such restriction into the /// will push one or more such restriction into the
/// `transmute_restrictions` vector during `intrinsicck`. They are /// `transmute_restrictions` vector during `intrinsicck`. They are
/// then checked during `trans` by the fn `check_intrinsics`. /// then checked during `trans` by the fn `check_intrinsics`.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct TransmuteRestriction<'tcx> { pub struct TransmuteRestriction<'tcx> {
/// The span whence the restriction comes. /// The span whence the restriction comes.
pub span: Span, pub span: Span,
@ -886,7 +886,7 @@ macro_rules! sty_debug_print {
// variable names. // variable names.
mod inner { mod inner {
use middle::ty; use middle::ty;
#[derive(Copy)] #[derive(Copy, Clone)]
struct DebugStat { struct DebugStat {
total: usize, total: usize,
region_infer: usize, region_infer: usize,
@ -4003,7 +4003,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 /// The ordering of the cases is significant. They are sorted so that cmp::max
/// will keep the "more erroneous" of two values. /// 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 { pub enum Representability {
Representable, Representable,
ContainsRecursive, ContainsRecursive,
@ -4734,7 +4734,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 /// 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 /// generate code for that kind of expression. See trans/expr.rs for more
/// information. /// information.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum ExprKind { pub enum ExprKind {
LvalueExpr, LvalueExpr,
RvalueDpsExpr, RvalueDpsExpr,
@ -5430,7 +5430,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() with_path(cx, id, |path| ast_map::path_to_string(path)).to_string()
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum DtorKind { pub enum DtorKind {
NoDtor, NoDtor,
TraitDtor(DefId, bool) TraitDtor(DefId, bool)
@ -7154,7 +7154,7 @@ pub fn make_substs_for_receiver_types<'tcx>(tcx: &ty::ctxt<'tcx>,
trait_ref.substs.clone().with_method(meth_tps, meth_regions) trait_ref.substs.clone().with_method(meth_tps, meth_regions)
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum CopyImplementationError { pub enum CopyImplementationError {
FieldDoesNotImplementCopy(ast::Name), FieldDoesNotImplementCopy(ast::Name),
VariantDoesNotImplementCopy(ast::Name), VariantDoesNotImplementCopy(ast::Name),

View file

@ -247,7 +247,7 @@ pub fn basic_options() -> Options {
// users can have their own entry // users can have their own entry
// functions that don't start a // functions that don't start a
// scheduler // scheduler
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum EntryFnType { pub enum EntryFnType {
EntryMain, EntryMain,
EntryStart, EntryStart,

View file

@ -15,7 +15,7 @@ use target::TargetOptions;
use self::Arch::*; use self::Arch::*;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Arch { pub enum Arch {
Armv7, Armv7,
Armv7s, Armv7s,

View file

@ -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 { pub enum LoanPathElem {
LpDeref(mc::PointerKind), // `*LV` in README.md LpDeref(mc::PointerKind), // `*LV` in README.md
LpInterior(InteriorKind), // `LV.f` in README.md LpInterior(InteriorKind), // `LV.f` in README.md
@ -500,13 +500,13 @@ pub struct BckError<'tcx> {
code: bckerr_code code: bckerr_code
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum AliasableViolationKind { pub enum AliasableViolationKind {
MutabilityViolation, MutabilityViolation,
BorrowViolation(euv::LoanCause) BorrowViolation(euv::LoanCause)
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum MovedValueUseKind { pub enum MovedValueUseKind {
MovedInUse, MovedInUse,
MovedInCapture, MovedInCapture,

View file

@ -94,7 +94,7 @@ impl Clone for MovePathIndex {
const InvalidMovePathIndex: MovePathIndex = MovePathIndex(usize::MAX); const InvalidMovePathIndex: MovePathIndex = MovePathIndex(usize::MAX);
/// Index into `MoveData.moves`, used like a pointer /// Index into `MoveData.moves`, used like a pointer
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub struct MoveIndex(usize); pub struct MoveIndex(usize);
impl MoveIndex { impl MoveIndex {
@ -125,7 +125,7 @@ pub struct MovePath<'tcx> {
pub next_sibling: MovePathIndex, pub next_sibling: MovePathIndex,
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum MoveKind { pub enum MoveKind {
Declared, // When declared, variables start out "moved". Declared, // When declared, variables start out "moved".
MoveExpr, // Expression or binding that moves a variable MoveExpr, // Expression or binding that moves a variable
@ -133,7 +133,7 @@ pub enum MoveKind {
Captured // Closure creation that moves a value Captured // Closure creation that moves a value
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Move { pub struct Move {
/// Path being moved. /// Path being moved.
pub path: MovePathIndex, pub path: MovePathIndex,
@ -148,7 +148,7 @@ pub struct Move {
pub next_move: MoveIndex pub next_move: MoveIndex
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Assignment { pub struct Assignment {
/// Path being assigned. /// Path being assigned.
pub path: MovePathIndex, pub path: MovePathIndex,
@ -160,7 +160,7 @@ pub struct Assignment {
pub span: Span, pub span: Span,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct VariantMatch { pub struct VariantMatch {
/// downcast to the variant. /// downcast to the variant.
pub path: MovePathIndex, pub path: MovePathIndex,

View file

@ -26,7 +26,7 @@ use rustc::middle::dataflow;
use std::rc::Rc; use std::rc::Rc;
use std::borrow::IntoCow; use std::borrow::IntoCow;
#[derive(Debug, Copy)] #[derive(Debug, Copy, Clone)]
pub enum Variant { pub enum Variant {
Loans, Loans,
Moves, Moves,

View file

@ -182,7 +182,7 @@ fn make_input(free_matches: &[String]) -> Option<(Input, Option<PathBuf>)> {
} }
// Whether to stop or continue compilation. // Whether to stop or continue compilation.
#[derive(Copy, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Compilation { pub enum Compilation {
Stop, Stop,
Continue, Continue,
@ -265,7 +265,7 @@ pub trait CompilerCalls<'a> {
} }
// CompilerCalls instance for a regular rustc build. // CompilerCalls instance for a regular rustc build.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct RustcDefaultCalls; pub struct RustcDefaultCalls;
impl<'a> CompilerCalls<'a> for RustcDefaultCalls { impl<'a> CompilerCalls<'a> for RustcDefaultCalls {

View file

@ -44,7 +44,7 @@ use std::option;
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum PpSourceMode { pub enum PpSourceMode {
PpmNormal, PpmNormal,
PpmEveryBodyLoops, PpmEveryBodyLoops,
@ -56,7 +56,7 @@ pub enum PpSourceMode {
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum PpFlowGraphMode { pub enum PpFlowGraphMode {
Default, Default,
/// Drops the labels from the edges in the flowgraph output. This /// Drops the labels from the edges in the flowgraph output. This
@ -65,7 +65,7 @@ pub enum PpFlowGraphMode {
/// have become a pain to maintain. /// have become a pain to maintain.
UnlabelledEdges, UnlabelledEdges,
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum PpMode { pub enum PpMode {
PpmSource(PpSourceMode), PpmSource(PpSourceMode),
PpmFlowGraph(PpFlowGraphMode), PpmFlowGraph(PpFlowGraphMode),

View file

@ -63,7 +63,7 @@ declare_lint! {
"suggest using `loop { }` instead of `while true { }`" "suggest using `loop { }` instead of `while true { }`"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct WhileTrue; pub struct WhileTrue;
impl LintPass for WhileTrue { impl LintPass for WhileTrue {
@ -107,7 +107,7 @@ declare_lint! {
"shift exceeds the type's number of bits" "shift exceeds the type's number of bits"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct TypeLimits { pub struct TypeLimits {
/// Id of the last visited negated expression /// Id of the last visited negated expression
negated_expr_id: ast::NodeId, 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; pub struct ImproperCTypes;
impl LintPass for ImproperCTypes { impl LintPass for ImproperCTypes {
@ -474,7 +474,7 @@ declare_lint! {
"use of owned (Box type) heap memory" "use of owned (Box type) heap memory"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct BoxPointers; pub struct BoxPointers;
impl BoxPointers { impl BoxPointers {
@ -621,7 +621,7 @@ declare_lint! {
"detects attributes that were not used by the compiler" "detects attributes that were not used by the compiler"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnusedAttributes; pub struct UnusedAttributes;
impl LintPass for UnusedAttributes { impl LintPass for UnusedAttributes {
@ -662,7 +662,7 @@ declare_lint! {
"path statements with no effect" "path statements with no effect"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct PathStatements; pub struct PathStatements;
impl LintPass for PathStatements { impl LintPass for PathStatements {
@ -696,7 +696,7 @@ declare_lint! {
"unused result of an expression in a statement" "unused result of an expression in a statement"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnusedResults; pub struct UnusedResults;
impl LintPass for UnusedResults { impl LintPass for UnusedResults {
@ -764,7 +764,7 @@ declare_lint! {
"types, variants, traits and type parameters should have camel case names" "types, variants, traits and type parameters should have camel case names"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct NonCamelCaseTypes; pub struct NonCamelCaseTypes;
impl NonCamelCaseTypes { impl NonCamelCaseTypes {
@ -874,7 +874,7 @@ declare_lint! {
"methods, functions, lifetime parameters and modules should have snake case names" "methods, functions, lifetime parameters and modules should have snake case names"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct NonSnakeCase; pub struct NonSnakeCase;
impl NonSnakeCase { impl NonSnakeCase {
@ -1014,7 +1014,7 @@ declare_lint! {
"static constants should have uppercase identifiers" "static constants should have uppercase identifiers"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct NonUpperCaseGlobals; pub struct NonUpperCaseGlobals;
impl NonUpperCaseGlobals { impl NonUpperCaseGlobals {
@ -1072,7 +1072,7 @@ declare_lint! {
"`if`, `match`, `while` and `return` do not need parentheses" "`if`, `match`, `while` and `return` do not need parentheses"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnusedParens; pub struct UnusedParens;
impl UnusedParens { impl UnusedParens {
@ -1166,7 +1166,7 @@ declare_lint! {
"unnecessary braces around an imported item" "unnecessary braces around an imported item"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnusedImportBraces; pub struct UnusedImportBraces;
impl LintPass for UnusedImportBraces { impl LintPass for UnusedImportBraces {
@ -1196,7 +1196,7 @@ declare_lint! {
"using `Struct { x: x }` instead of `Struct { x }`" "using `Struct { x: x }` instead of `Struct { x }`"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct NonShorthandFieldPatterns; pub struct NonShorthandFieldPatterns;
impl LintPass for NonShorthandFieldPatterns { impl LintPass for NonShorthandFieldPatterns {
@ -1233,7 +1233,7 @@ declare_lint! {
"unnecessary use of an `unsafe` block" "unnecessary use of an `unsafe` block"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnusedUnsafe; pub struct UnusedUnsafe;
impl LintPass for UnusedUnsafe { impl LintPass for UnusedUnsafe {
@ -1258,7 +1258,7 @@ declare_lint! {
"usage of `unsafe` code" "usage of `unsafe` code"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnsafeCode; pub struct UnsafeCode;
impl LintPass for UnsafeCode { impl LintPass for UnsafeCode {
@ -1319,7 +1319,7 @@ declare_lint! {
"detect mut variables which don't need to be mutable" "detect mut variables which don't need to be mutable"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnusedMut; pub struct UnusedMut;
impl UnusedMut { impl UnusedMut {
@ -1388,7 +1388,7 @@ declare_lint! {
"detects unnecessary allocations that can be eliminated" "detects unnecessary allocations that can be eliminated"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnusedAllocation; pub struct UnusedAllocation;
impl LintPass for UnusedAllocation { impl LintPass for UnusedAllocation {
@ -1625,7 +1625,7 @@ declare_lint! {
"detects potentially-forgotten implementations of `Copy`" "detects potentially-forgotten implementations of `Copy`"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct MissingCopyImplementations; pub struct MissingCopyImplementations;
impl LintPass for MissingCopyImplementations { impl LintPass for MissingCopyImplementations {
@ -1740,7 +1740,7 @@ declare_lint! {
} }
/// Checks for use of items with `#[deprecated]` attributes /// Checks for use of items with `#[deprecated]` attributes
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Stability; pub struct Stability;
impl Stability { impl Stability {
@ -1800,7 +1800,7 @@ declare_lint! {
"functions that cannot return without calling themselves" "functions that cannot return without calling themselves"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnconditionalRecursion; pub struct UnconditionalRecursion;
@ -1991,7 +1991,7 @@ declare_lint! {
"compiler plugin used as ordinary library in non-plugin crate" "compiler plugin used as ordinary library in non-plugin crate"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct PluginAsLibrary; pub struct PluginAsLibrary;
impl LintPass for PluginAsLibrary { impl LintPass for PluginAsLibrary {
@ -2045,7 +2045,7 @@ declare_lint! {
"const items will not have their symbols exported" "const items will not have their symbols exported"
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct InvalidNoMangleItems; pub struct InvalidNoMangleItems;
impl LintPass for InvalidNoMangleItems { impl LintPass for InvalidNoMangleItems {
@ -2088,7 +2088,7 @@ impl LintPass for InvalidNoMangleItems {
} }
/// Forbids using the `#[feature(...)]` attribute /// Forbids using the `#[feature(...)]` attribute
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnstableFeatures; pub struct UnstableFeatures;
declare_lint! { declare_lint! {

View file

@ -18,7 +18,7 @@ use std::ptr;
use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef}; use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef};
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum OptimizationDiagnosticKind { pub enum OptimizationDiagnosticKind {
OptimizationRemark, OptimizationRemark,
OptimizationMissed, OptimizationMissed,
@ -38,7 +38,7 @@ impl OptimizationDiagnosticKind {
} }
#[allow(raw_pointer_derive)] #[allow(raw_pointer_derive)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct OptimizationDiagnostic { pub struct OptimizationDiagnostic {
pub kind: OptimizationDiagnosticKind, pub kind: OptimizationDiagnosticKind,
pub pass_name: *const c_char, pub pass_name: *const c_char,
@ -69,14 +69,13 @@ impl OptimizationDiagnostic {
} }
} }
#[derive(Copy, Clone)]
pub struct InlineAsmDiagnostic { pub struct InlineAsmDiagnostic {
pub cookie: c_uint, pub cookie: c_uint,
pub message: TwineRef, pub message: TwineRef,
pub instruction: ValueRef, pub instruction: ValueRef,
} }
impl Copy for InlineAsmDiagnostic {}
impl InlineAsmDiagnostic { impl InlineAsmDiagnostic {
unsafe fn unpack(di: DiagnosticInfoRef) unsafe fn unpack(di: DiagnosticInfoRef)
-> InlineAsmDiagnostic { -> InlineAsmDiagnostic {
@ -96,7 +95,7 @@ impl InlineAsmDiagnostic {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Diagnostic { pub enum Diagnostic {
Optimization(OptimizationDiagnostic), Optimization(OptimizationDiagnostic),
InlineAsm(InlineAsmDiagnostic), InlineAsm(InlineAsmDiagnostic),

View file

@ -76,7 +76,7 @@ pub const False: Bool = 0 as Bool;
// Consts for the LLVM CallConv type, pre-cast to usize. // Consts for the LLVM CallConv type, pre-cast to usize.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum CallConv { pub enum CallConv {
CCallConv = 0, CCallConv = 0,
FastCallConv = 8, FastCallConv = 8,
@ -86,7 +86,7 @@ pub enum CallConv {
X86_64_Win64 = 79, X86_64_Win64 = 79,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Visibility { pub enum Visibility {
LLVMDefaultVisibility = 0, LLVMDefaultVisibility = 0,
HiddenVisibility = 1, HiddenVisibility = 1,
@ -97,7 +97,7 @@ pub enum Visibility {
// DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage. // DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage.
// LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either; // LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either;
// they've been removed in upstream LLVM commit r203866. // they've been removed in upstream LLVM commit r203866.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Linkage { pub enum Linkage {
ExternalLinkage = 0, ExternalLinkage = 0,
AvailableExternallyLinkage = 1, AvailableExternallyLinkage = 1,
@ -113,7 +113,7 @@ pub enum Linkage {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum DiagnosticSeverity { pub enum DiagnosticSeverity {
Error, Error,
Warning, Warning,
@ -154,7 +154,7 @@ bitflags! {
#[repr(u64)] #[repr(u64)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum OtherAttribute { pub enum OtherAttribute {
// The following are not really exposed in // The following are not really exposed in
// the LLVM c api so instead to add these // the LLVM c api so instead to add these
@ -175,13 +175,13 @@ pub enum OtherAttribute {
NonNullAttribute = 1 << 44, NonNullAttribute = 1 << 44,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum SpecialAttribute { pub enum SpecialAttribute {
DereferenceableAttribute(u64) DereferenceableAttribute(u64)
} }
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum AttributeSet { pub enum AttributeSet {
ReturnIndex = 0, ReturnIndex = 0,
FunctionIndex = !0 FunctionIndex = !0
@ -273,7 +273,7 @@ impl AttrBuilder {
} }
// enum for the LLVM IntPredicate type // enum for the LLVM IntPredicate type
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum IntPredicate { pub enum IntPredicate {
IntEQ = 32, IntEQ = 32,
IntNE = 33, IntNE = 33,
@ -288,7 +288,7 @@ pub enum IntPredicate {
} }
// enum for the LLVM RealPredicate type // enum for the LLVM RealPredicate type
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum RealPredicate { pub enum RealPredicate {
RealPredicateFalse = 0, RealPredicateFalse = 0,
RealOEQ = 1, RealOEQ = 1,
@ -310,7 +310,7 @@ pub enum RealPredicate {
// The LLVM TypeKind type - must stay in sync with the def of // The LLVM TypeKind type - must stay in sync with the def of
// LLVMTypeKind in llvm/include/llvm-c/Core.h // LLVMTypeKind in llvm/include/llvm-c/Core.h
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
#[repr(C)] #[repr(C)]
pub enum TypeKind { pub enum TypeKind {
Void = 0, Void = 0,
@ -332,7 +332,7 @@ pub enum TypeKind {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum AtomicBinOp { pub enum AtomicBinOp {
AtomicXchg = 0, AtomicXchg = 0,
AtomicAdd = 1, AtomicAdd = 1,
@ -348,7 +348,7 @@ pub enum AtomicBinOp {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum AtomicOrdering { pub enum AtomicOrdering {
NotAtomic = 0, NotAtomic = 0,
Unordered = 1, Unordered = 1,
@ -362,13 +362,13 @@ pub enum AtomicOrdering {
// Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h) // Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum FileType { pub enum FileType {
AssemblyFileType = 0, AssemblyFileType = 0,
ObjectFileType = 1 ObjectFileType = 1
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum MetadataType { pub enum MetadataType {
MD_dbg = 0, MD_dbg = 0,
MD_tbaa = 1, MD_tbaa = 1,
@ -385,13 +385,13 @@ pub enum MetadataType {
} }
// Inline Asm Dialect // Inline Asm Dialect
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum AsmDialect { pub enum AsmDialect {
AD_ATT = 0, AD_ATT = 0,
AD_Intel = 1 AD_Intel = 1
} }
#[derive(Copy, PartialEq, Clone)] #[derive(Copy, Clone, PartialEq)]
#[repr(C)] #[repr(C)]
pub enum CodeGenOptLevel { pub enum CodeGenOptLevel {
CodeGenLevelNone = 0, CodeGenLevelNone = 0,
@ -400,7 +400,7 @@ pub enum CodeGenOptLevel {
CodeGenLevelAggressive = 3, CodeGenLevelAggressive = 3,
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
#[repr(C)] #[repr(C)]
pub enum RelocMode { pub enum RelocMode {
RelocDefault = 0, RelocDefault = 0,
@ -410,7 +410,7 @@ pub enum RelocMode {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum CodeGenModel { pub enum CodeGenModel {
CodeModelDefault = 0, CodeModelDefault = 0,
CodeModelJITDefault = 1, CodeModelJITDefault = 1,
@ -421,7 +421,7 @@ pub enum CodeGenModel {
} }
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum DiagnosticKind { pub enum DiagnosticKind {
DK_InlineAsm = 0, DK_InlineAsm = 0,
DK_StackSize, DK_StackSize,
@ -533,7 +533,7 @@ pub mod debuginfo {
pub type DIEnumerator = DIDescriptor; pub type DIEnumerator = DIDescriptor;
pub type DITemplateTypeParameter = DIDescriptor; pub type DITemplateTypeParameter = DIDescriptor;
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum DIDescriptorFlags { pub enum DIDescriptorFlags {
FlagPrivate = 1 << 0, FlagPrivate = 1 << 0,
FlagProtected = 1 << 1, FlagProtected = 1 << 1,

View file

@ -61,7 +61,7 @@ use std::rc::Rc;
// Specifies how duplicates should be handled when adding a child item if // Specifies how duplicates should be handled when adding a child item if
// another item exists with the same name in some namespace. // another item exists with the same name in some namespace.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
enum DuplicateCheckingMode { enum DuplicateCheckingMode {
ForbidDuplicateModules, ForbidDuplicateModules,
ForbidDuplicateTypesAndModules, ForbidDuplicateTypesAndModules,
@ -70,7 +70,7 @@ enum DuplicateCheckingMode {
OverwriteDuplicates OverwriteDuplicates
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
enum NamespaceError { enum NamespaceError {
NoError, NoError,
ModuleError, ModuleError,

View file

@ -107,7 +107,7 @@ mod record_exports;
mod build_reduced_graph; mod build_reduced_graph;
mod resolve_imports; mod resolve_imports;
#[derive(Copy)] #[derive(Copy, Clone)]
struct BindingInfo { struct BindingInfo {
span: Span, span: Span,
binding_mode: BindingMode, binding_mode: BindingMode,
@ -116,14 +116,14 @@ struct BindingInfo {
// Map from the name in a pattern to its binding mode. // Map from the name in a pattern to its binding mode.
type BindingMap = HashMap<Name, BindingInfo>; type BindingMap = HashMap<Name, BindingInfo>;
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
enum PatternBindingMode { enum PatternBindingMode {
RefutableMode, RefutableMode,
LocalIrrefutableMode, LocalIrrefutableMode,
ArgumentIrrefutableMode, ArgumentIrrefutableMode,
} }
#[derive(Copy, PartialEq, Eq, Hash, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
enum Namespace { enum Namespace {
TypeNS, TypeNS,
ValueNS ValueNS
@ -280,7 +280,7 @@ enum FallbackSuggestion {
TraitMethod(String), TraitMethod(String),
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum TypeParameters<'a> { enum TypeParameters<'a> {
NoTypeParameters, NoTypeParameters,
HasTypeParameters( HasTypeParameters(
@ -297,7 +297,7 @@ enum TypeParameters<'a> {
// The rib kind controls the translation of local // The rib kind controls the translation of local
// definitions (`DefLocal`) to upvars (`DefUpvar`). // definitions (`DefLocal`) to upvars (`DefUpvar`).
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
enum RibKind { enum RibKind {
// No translation needs to be applied. // No translation needs to be applied.
NormalRibKind, NormalRibKind,
@ -319,7 +319,7 @@ enum RibKind {
ConstantItemRibKind ConstantItemRibKind
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum UseLexicalScopeFlag { enum UseLexicalScopeFlag {
DontUseLexicalScope, DontUseLexicalScope,
UseLexicalScope UseLexicalScope
@ -330,7 +330,7 @@ enum ModulePrefixResult {
PrefixFound(Rc<Module>, usize) PrefixFound(Rc<Module>, usize)
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
enum NameSearchType { enum NameSearchType {
/// We're doing a name search in order to resolve a `use` directive. /// We're doing a name search in order to resolve a `use` directive.
ImportSearch, ImportSearch,
@ -340,7 +340,7 @@ enum NameSearchType {
PathSearch, PathSearch,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum BareIdentifierPatternResolution { enum BareIdentifierPatternResolution {
FoundStructOrEnumVariant(Def, LastPrivate), FoundStructOrEnumVariant(Def, LastPrivate),
FoundConst(Def, LastPrivate), FoundConst(Def, LastPrivate),
@ -372,7 +372,7 @@ enum ParentLink {
} }
/// The type of module this is. /// The type of module this is.
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
enum ModuleKind { enum ModuleKind {
NormalModuleKind, NormalModuleKind,
TraitModuleKind, TraitModuleKind,
@ -3527,7 +3527,7 @@ pub struct CrateMap {
pub glob_map: Option<GlobMap> pub glob_map: Option<GlobMap>
} }
#[derive(PartialEq,Copy)] #[derive(PartialEq,Copy, Clone)]
pub enum MakeGlobMap { pub enum MakeGlobMap {
Yes, Yes,
No No

View file

@ -37,7 +37,7 @@ use std::rc::Rc;
/// Contains data for specific types of import directives. /// Contains data for specific types of import directives.
#[derive(Copy,Debug)] #[derive(Copy, Clone,Debug)]
pub enum ImportDirectiveSubclass { pub enum ImportDirectiveSubclass {
SingleImport(Name /* target */, Name /* source */), SingleImport(Name /* target */, Name /* source */),
GlobImport GlobImport

View file

@ -62,7 +62,7 @@ macro_rules! svec {
}) })
} }
#[derive(Copy, Debug, Eq, PartialEq)] #[derive(Copy, Clone, Debug, Eq, PartialEq)]
pub enum Row { pub enum Row {
Variable, Variable,
Enum, Enum,

View file

@ -228,7 +228,7 @@ use syntax::codemap::Span;
use syntax::fold::Folder; use syntax::fold::Folder;
use syntax::ptr::P; use syntax::ptr::P;
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
struct ConstantExpr<'a>(&'a ast::Expr); struct ConstantExpr<'a>(&'a ast::Expr);
impl<'a> ConstantExpr<'a> { impl<'a> ConstantExpr<'a> {
@ -311,7 +311,7 @@ impl<'a, 'tcx> Opt<'a, 'tcx> {
} }
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum BranchKind { pub enum BranchKind {
NoBranch, NoBranch,
Single, Single,

View file

@ -2112,7 +2112,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.
#[derive(Copy)] #[derive(Copy, Clone)]
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.

View file

@ -13,7 +13,7 @@ use llvm::BasicBlockRef;
use trans::value::{Users, Value}; use trans::value::{Users, Value};
use std::iter::{Filter, Map}; use std::iter::{Filter, Map};
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct BasicBlock(pub BasicBlockRef); pub struct BasicBlock(pub BasicBlockRef);
pub type Preds = Map<Filter<Users, fn(&Value) -> bool>, fn(Value) -> BasicBlock>; pub type Preds = Map<Filter<Users, fn(&Value) -> bool>, fn(Value) -> BasicBlock>;

View file

@ -60,7 +60,7 @@ use syntax::ast;
use syntax::ast_map; use syntax::ast_map;
use syntax::ptr::P; use syntax::ptr::P;
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct MethodData { pub struct MethodData {
pub llfn: ValueRef, pub llfn: ValueRef,
pub llself: ValueRef, pub llself: ValueRef,
@ -1110,7 +1110,7 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
bcx bcx
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum AutorefArg { pub enum AutorefArg {
DontAutorefArg, DontAutorefArg,
DoAutorefArg(ast::NodeId) DoAutorefArg(ast::NodeId)

View file

@ -153,7 +153,7 @@ pub struct CleanupScope<'blk, 'tcx: 'blk> {
cached_landing_pad: Option<BasicBlockRef>, cached_landing_pad: Option<BasicBlockRef>,
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub struct CustomScopeIndex { pub struct CustomScopeIndex {
index: usize 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 { pub enum EarlyExitLabel {
UnwindExit, UnwindExit,
ReturnExit, ReturnExit,
LoopExit(ast::NodeId, usize) LoopExit(ast::NodeId, usize)
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct CachedEarlyExit { pub struct CachedEarlyExit {
label: EarlyExitLabel, label: EarlyExitLabel,
cleanup_block: BasicBlockRef, cleanup_block: BasicBlockRef,
@ -209,7 +209,7 @@ pub trait Cleanup<'tcx> {
pub type CleanupObj<'tcx> = Box<Cleanup<'tcx>+'tcx>; pub type CleanupObj<'tcx> = Box<Cleanup<'tcx>+'tcx>;
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum ScopeId { pub enum ScopeId {
AstScope(ast::NodeId), AstScope(ast::NodeId),
CustomScope(CustomScopeIndex) CustomScope(CustomScopeIndex)
@ -982,7 +982,7 @@ impl EarlyExitLabel {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Cleanup types // Cleanup types
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct DropValue<'tcx> { pub struct DropValue<'tcx> {
is_immediate: bool, is_immediate: bool,
must_unwind: 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 { pub enum Heap {
HeapExchange HeapExchange
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct FreeValue<'tcx> { pub struct FreeValue<'tcx> {
ptr: ValueRef, ptr: ValueRef,
heap: Heap, heap: Heap,
@ -1061,7 +1061,7 @@ impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct FreeSlice { pub struct FreeSlice {
ptr: ValueRef, ptr: ValueRef,
size: ValueRef, size: ValueRef,
@ -1098,7 +1098,7 @@ impl<'tcx> Cleanup<'tcx> for FreeSlice {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct LifetimeEnd { pub struct LifetimeEnd {
ptr: ValueRef, ptr: ValueRef,
} }

View file

@ -343,7 +343,7 @@ pub fn gensym_name(name: &str) -> PathElem {
* *
*/ */
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct NodeIdAndSpan { pub struct NodeIdAndSpan {
pub id: ast::NodeId, pub id: ast::NodeId,
pub span: Span, 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. // Key used to lookup values supplied for type parameters in an expr.
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
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),

View file

@ -172,7 +172,7 @@ impl Drop for Rvalue {
fn drop(&mut self) { } fn drop(&mut self) { }
} }
#[derive(Copy, PartialEq, Eq, Hash, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
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,

View file

@ -2382,7 +2382,7 @@ impl<'tcx> VariantMemberDescriptionFactory<'tcx> {
} }
} }
#[derive(Copy)] #[derive(Copy, Clone)]
enum EnumDiscriminantInfo { enum EnumDiscriminantInfo {
RegularDiscriminant(DIType), RegularDiscriminant(DIType),
OptimizedDiscriminant, OptimizedDiscriminant,
@ -3106,7 +3106,7 @@ impl MetadataCreationResult {
} }
} }
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
enum InternalDebugLocation { enum InternalDebugLocation {
KnownLocation { scope: DIScope, line: usize, col: usize }, KnownLocation { scope: DIScope, line: usize, col: usize },
UnknownLocation UnknownLocation

View file

@ -94,7 +94,7 @@ 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.
#[derive(Copy, PartialEq)] #[derive(Copy, Clone, PartialEq)]
pub enum Dest { pub enum Dest {
SaveIn(ValueRef), SaveIn(ValueRef),
Ignore, Ignore,
@ -2038,7 +2038,7 @@ fn float_cast(bcx: Block,
} else { llsrc }; } else { llsrc };
} }
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum cast_kind { pub enum cast_kind {
cast_pointer, cast_pointer,
cast_integral, cast_integral,

View file

@ -57,7 +57,7 @@ mod basic_block;
mod llrepr; mod llrepr;
mod cleanup; mod cleanup;
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct ModuleTranslation { pub struct ModuleTranslation {
pub llcx: ContextRef, pub llcx: ContextRef,
pub llmod: ModuleRef, pub llmod: ModuleRef,

View file

@ -33,7 +33,7 @@ use util::ppaux::ty_to_string;
use syntax::ast; use syntax::ast;
use syntax::parse::token::InternedString; use syntax::parse::token::InternedString;
#[derive(Copy)] #[derive(Copy, Clone)]
struct VecTypes<'tcx> { struct VecTypes<'tcx> {
unit_ty: Ty<'tcx>, unit_ty: Ty<'tcx>,
llunit_ty: Type llunit_ty: Type

View file

@ -14,7 +14,7 @@ use trans::basic_block::BasicBlock;
use trans::common::Block; use trans::common::Block;
use libc::c_uint; use libc::c_uint;
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Value(pub ValueRef); pub struct Value(pub ValueRef);
macro_rules! opt_val { ($e:expr) => ( macro_rules! opt_val { ($e:expr) => (
@ -125,7 +125,7 @@ impl Value {
} }
/// Wrapper for LLVM UseRef /// Wrapper for LLVM UseRef
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Use(UseRef); pub struct Use(UseRef);
impl Use { impl Use {

View file

@ -52,7 +52,7 @@ pub enum MethodError {
// A pared down enum describing just the places from which a method // A pared down enum describing just the places from which a method
// candidate can arise. Used for error reporting only. // candidate can arise. Used for error reporting only.
#[derive(Copy, PartialOrd, Ord, PartialEq, Eq)] #[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq)]
pub enum CandidateSource { pub enum CandidateSource {
ImplSource(ast::DefId), ImplSource(ast::DefId),
TraitSource(/* trait id */ ast::DefId), TraitSource(/* trait id */ ast::DefId),

View file

@ -109,7 +109,7 @@ pub enum PickAdjustment {
AutoRef(ast::Mutability, Box<PickAdjustment>), AutoRef(ast::Mutability, Box<PickAdjustment>),
} }
#[derive(PartialEq, Eq, Copy)] #[derive(PartialEq, Eq, Copy, Clone)]
pub enum Mode { pub enum Mode {
// An expression of the form `receiver.method_name(...)`. // An expression of the form `receiver.method_name(...)`.
// Autoderefs are performed on `receiver`, lookup is done based on the // Autoderefs are performed on `receiver`, lookup is done based on the

View file

@ -266,7 +266,7 @@ fn type_derefs_to_local<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
}).2.is_some() }).2.is_some()
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct TraitInfo { pub struct TraitInfo {
pub def_id: ast::DefId, pub def_id: ast::DefId,
} }

View file

@ -205,7 +205,7 @@ struct CastCheck<'tcx> {
/// When type-checking an expression, we propagate downward /// When type-checking an expression, we propagate downward
/// whatever type hint we are able in the form of an `Expectation`. /// whatever type hint we are able in the form of an `Expectation`.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Expectation<'tcx> { pub enum Expectation<'tcx> {
/// We know nothing about what type this expression should have. /// We know nothing about what type this expression should have.
NoExpectation, NoExpectation,
@ -1952,14 +1952,14 @@ impl<'a, 'tcx> RegionScope for FnCtxt<'a, 'tcx> {
} }
} }
#[derive(Copy, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum LvaluePreference { pub enum LvaluePreference {
PreferMutLvalue, PreferMutLvalue,
NoPreference NoPreference
} }
/// Whether `autoderef` requires types to resolve. /// Whether `autoderef` requires types to resolve.
#[derive(Copy, Debug, PartialEq, Eq)] #[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum UnresolvedTypeAction { pub enum UnresolvedTypeAction {
/// Produce an error and return `ty_err` whenever a type cannot /// Produce an error and return `ty_err` whenever a type cannot
/// be resolved (i.e. it is `ty_infer`). /// be resolved (i.e. it is `ty_infer`).

View file

@ -249,11 +249,6 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
&fcx.inh.param_env.free_substs, &fcx.inh.param_env.free_substs,
&trait_ref); &trait_ref);
if fcx.tcx().lang_items.copy_trait() == Some(trait_ref.def_id) {
// This is checked in coherence.
return
}
// We are stricter on the trait-ref in an impl than the // We are stricter on the trait-ref in an impl than the
// self-type. In particular, we enforce region // self-type. In particular, we enforce region
// relationships. The reason for this is that (at least // relationships. The reason for this is that (at least

View file

@ -350,7 +350,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// Resolution reason. // Resolution reason.
#[derive(Copy)] #[derive(Copy, Clone)]
enum ResolveReason { enum ResolveReason {
ResolvingExpr(Span), ResolvingExpr(Span),
ResolvingLocal(Span), ResolvingLocal(Span),

View file

@ -135,7 +135,7 @@ struct ItemCtxt<'a,'tcx:'a> {
param_bounds: &'a (GetTypeParameterBounds<'tcx>+'a), param_bounds: &'a (GetTypeParameterBounds<'tcx>+'a),
} }
#[derive(Copy, PartialEq, Eq)] #[derive(Copy, Clone, PartialEq, Eq)]
enum AstConvRequest { enum AstConvRequest {
GetItemTypeScheme(ast::DefId), GetItemTypeScheme(ast::DefId),
GetTraitDef(ast::DefId), GetTraitDef(ast::DefId),

View file

@ -40,7 +40,7 @@ pub trait RegionScope {
// A scope in which all regions must be explicitly named. This is used // A scope in which all regions must be explicitly named. This is used
// for types that appear in structs and so on. // for types that appear in structs and so on.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct ExplicitRscope; pub struct ExplicitRscope;
impl RegionScope for ExplicitRscope { impl RegionScope for ExplicitRscope {

View file

@ -295,10 +295,10 @@ pub fn infer_variance(tcx: &ty::ctxt) {
type VarianceTermPtr<'a> = &'a VarianceTerm<'a>; type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
struct InferredIndex(usize); struct InferredIndex(usize);
#[derive(Copy)] #[derive(Copy, Clone)]
enum VarianceTerm<'a> { enum VarianceTerm<'a> {
ConstantTerm(ty::Variance), ConstantTerm(ty::Variance),
TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>), TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>),
@ -336,7 +336,7 @@ struct TermsContext<'a, 'tcx: 'a> {
inferred_infos: Vec<InferredInfo<'a>> , inferred_infos: Vec<InferredInfo<'a>> ,
} }
#[derive(Copy, Debug, PartialEq)] #[derive(Copy, Clone, Debug, PartialEq)]
enum ParamKind { enum ParamKind {
TypeParam, TypeParam,
RegionParam, RegionParam,
@ -560,7 +560,7 @@ struct ConstraintContext<'a, 'tcx: 'a> {
/// Declares that the variable `decl_id` appears in a location with /// Declares that the variable `decl_id` appears in a location with
/// variance `variance`. /// variance `variance`.
#[derive(Copy)] #[derive(Copy, Clone)]
struct Constraint<'a> { struct Constraint<'a> {
inferred: InferredIndex, inferred: InferredIndex,
variance: &'a VarianceTerm<'a>, variance: &'a VarianceTerm<'a>,

View file

@ -30,19 +30,19 @@ use html::render::{cache, CURRENT_LOCATION_KEY};
/// Helper to render an optional visibility with a space after it (if the /// Helper to render an optional visibility with a space after it (if the
/// visibility is preset) /// visibility is preset)
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct VisSpace(pub Option<ast::Visibility>); pub struct VisSpace(pub Option<ast::Visibility>);
/// Similarly to VisSpace, this structure is used to render a function style with a /// Similarly to VisSpace, this structure is used to render a function style with a
/// space after it. /// space after it.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct UnsafetySpace(pub ast::Unsafety); pub struct UnsafetySpace(pub ast::Unsafety);
/// Wrapper struct for properly emitting a method declaration. /// Wrapper struct for properly emitting a method declaration.
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl); pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
/// Similar to VisSpace, but used for mutability /// Similar to VisSpace, but used for mutability
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct MutableSpace(pub clean::Mutability); pub struct MutableSpace(pub clean::Mutability);
/// Similar to VisSpace, but used for mutability /// Similar to VisSpace, but used for mutability
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct RawMutableSpace(pub clean::Mutability); pub struct RawMutableSpace(pub clean::Mutability);
/// Wrapper struct for properly emitting the stability level. /// Wrapper struct for properly emitting the stability level.
pub struct Stability<'a>(pub &'a Option<clean::Stability>); pub struct Stability<'a>(pub &'a Option<clean::Stability>);

View file

@ -225,7 +225,7 @@ struct Source<'a>(&'a str);
// Helper structs for rendering items/sidebars and carrying along contextual // Helper structs for rendering items/sidebars and carrying along contextual
// information // information
#[derive(Copy)] #[derive(Copy, Clone)]
struct Item<'a> { struct Item<'a> {
cx: &'a Context, cx: &'a Context,
item: &'a clean::Item, item: &'a clean::Item,

View file

@ -27,7 +27,7 @@ use html::render::cache;
#[derive(RustcEncodable, RustcDecodable, PartialEq, Eq)] #[derive(RustcEncodable, RustcDecodable, PartialEq, Eq)]
/// The counts for each stability level. /// The counts for each stability level.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct Counts { pub struct Counts {
pub deprecated: u64, pub deprecated: u64,
pub unstable: u64, pub unstable: u64,

View file

@ -62,7 +62,7 @@ pub trait FromHex {
} }
/// Errors that can occur when decoding a hex encoded string /// Errors that can occur when decoding a hex encoded string
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum FromHexError { pub enum FromHexError {
/// The input contained a character not part of the hex format /// The input contained a character not part of the hex format
InvalidHexCharacter(char, usize), InvalidHexCharacter(char, usize),

View file

@ -278,7 +278,7 @@ pub enum DecoderError {
ApplicationError(string::String) ApplicationError(string::String)
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum EncoderError { pub enum EncoderError {
FmtError(fmt::Error), FmtError(fmt::Error),
BadHashmapKey, BadHashmapKey,

View file

@ -87,6 +87,9 @@ struct RawBucket<K, V> {
} }
impl<K,V> Copy for RawBucket<K,V> {} impl<K,V> Copy for RawBucket<K,V> {}
impl<K,V> Clone for RawBucket<K,V> {
fn clone(&self) -> RawBucket<K, V> { *self }
}
pub struct Bucket<K, V, M> { pub struct Bucket<K, V, M> {
raw: RawBucket<K, V>, raw: RawBucket<K, V>,
@ -95,6 +98,9 @@ pub struct Bucket<K, V, M> {
} }
impl<K,V,M:Copy> Copy for Bucket<K,V,M> {} impl<K,V,M:Copy> Copy for Bucket<K,V,M> {}
impl<K,V,M:Copy> Clone for Bucket<K,V,M> {
fn clone(&self) -> Bucket<K,V,M> { *self }
}
pub struct EmptyBucket<K, V, M> { pub struct EmptyBucket<K, V, M> {
raw: RawBucket<K, V>, raw: RawBucket<K, V>,
@ -129,7 +135,7 @@ struct GapThenFull<K, V, M> {
/// A hash that is not zero, since we use a hash of zero to represent empty /// A hash that is not zero, since we use a hash of zero to represent empty
/// buckets. /// buckets.
#[derive(PartialEq, Copy)] #[derive(PartialEq, Copy, Clone)]
pub struct SafeHash { pub struct SafeHash {
hash: u64, hash: u64,
} }

View file

@ -25,7 +25,7 @@ use string::String;
use vec::Vec; use vec::Vec;
/// A flag that specifies whether to use exponential (scientific) notation. /// A flag that specifies whether to use exponential (scientific) notation.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum ExponentFormat { pub enum ExponentFormat {
/// Do not use exponential notation. /// Do not use exponential notation.
ExpNone, ExpNone,
@ -40,7 +40,7 @@ pub enum ExponentFormat {
/// The number of digits used for emitting the fractional part of a number, if /// The number of digits used for emitting the fractional part of a number, if
/// any. /// any.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum SignificantDigits { pub enum SignificantDigits {
/// All calculable digits will be printed. /// All calculable digits will be printed.
/// ///
@ -57,7 +57,7 @@ pub enum SignificantDigits {
} }
/// How to emit the sign of a number. /// How to emit the sign of a number.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum SignFormat { pub enum SignFormat {
/// No sign will be printed. The exponent sign will also be emitted. /// No sign will be printed. The exponent sign will also be emitted.
SignNone, SignNone,

View file

@ -391,7 +391,7 @@ impl Error for IoError {
} }
/// A list specifying general categories of I/O error. /// A list specifying general categories of I/O error.
#[derive(Copy, PartialEq, Eq, Clone, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum IoErrorKind { pub enum IoErrorKind {
/// Any I/O error not part of this list. /// Any I/O error not part of this list.
OtherIoError, OtherIoError,
@ -1553,7 +1553,7 @@ impl<T: Buffer> BufferPrelude for T {
/// When seeking, the resulting cursor is offset from a base by the offset given /// When seeking, the resulting cursor is offset from a base by the offset given
/// to the `seek` function. The base used is specified by this enumeration. /// to the `seek` function. The base used is specified by this enumeration.
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum SeekStyle { pub enum SeekStyle {
/// Seek from the beginning of the stream /// Seek from the beginning of the stream
SeekSet, SeekSet,
@ -1744,7 +1744,7 @@ pub enum FileType {
/// ///
/// println!("byte size: {}", info.size); /// println!("byte size: {}", info.size);
/// ``` /// ```
#[derive(Copy, Hash)] #[derive(Copy, Clone, Hash)]
pub struct FileStat { pub struct FileStat {
/// The size of the file, in bytes /// The size of the file, in bytes
pub size: u64, pub size: u64,
@ -1783,7 +1783,7 @@ pub struct FileStat {
/// structure. This information is not necessarily platform independent, and may /// structure. This information is not necessarily platform independent, and may
/// have different meanings or no meaning at all on some platforms. /// have different meanings or no meaning at all on some platforms.
#[unstable(feature = "io")] #[unstable(feature = "io")]
#[derive(Copy, Hash)] #[derive(Copy, Clone, Hash)]
pub struct UnstableFileStat { pub struct UnstableFileStat {
/// The ID of the device containing the file. /// The ID of the device containing the file.
pub device: u64, pub device: u64,

View file

@ -29,7 +29,7 @@ use sys;
use vec::Vec; use vec::Vec;
/// Hints to the types of sockets that are desired when looking up hosts /// Hints to the types of sockets that are desired when looking up hosts
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum SocketType { pub enum SocketType {
Stream, Datagram, Raw Stream, Datagram, Raw
} }
@ -38,7 +38,7 @@ pub enum SocketType {
/// to manipulate how a query is performed. /// to manipulate how a query is performed.
/// ///
/// The meaning of each of these flags can be found with `man -s 3 getaddrinfo` /// The meaning of each of these flags can be found with `man -s 3 getaddrinfo`
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum Flag { pub enum Flag {
AddrConfig, AddrConfig,
All, All,
@ -51,7 +51,7 @@ pub enum Flag {
/// A transport protocol associated with either a hint or a return value of /// A transport protocol associated with either a hint or a return value of
/// `lookup` /// `lookup`
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum Protocol { pub enum Protocol {
TCP, UDP TCP, UDP
} }
@ -61,7 +61,7 @@ pub enum Protocol {
/// ///
/// For details on these fields, see their corresponding definitions via /// For details on these fields, see their corresponding definitions via
/// `man -s 3 getaddrinfo` /// `man -s 3 getaddrinfo`
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub struct Hint { pub struct Hint {
pub family: usize, pub family: usize,
pub socktype: Option<SocketType>, pub socktype: Option<SocketType>,
@ -69,7 +69,7 @@ pub struct Hint {
pub flags: usize, pub flags: usize,
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub struct Info { pub struct Info {
pub address: SocketAddr, pub address: SocketAddr,
pub family: usize, pub family: usize,

View file

@ -90,7 +90,7 @@ impl<R: Buffer> Buffer for LimitReader<R> {
} }
/// A `Writer` which ignores bytes written to it, like /dev/null. /// A `Writer` which ignores bytes written to it, like /dev/null.
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[deprecated(since = "1.0.0", reason = "use std::io::sink() instead")] #[deprecated(since = "1.0.0", reason = "use std::io::sink() instead")]
#[unstable(feature = "old_io")] #[unstable(feature = "old_io")]
pub struct NullWriter; pub struct NullWriter;
@ -103,7 +103,7 @@ impl Writer for NullWriter {
} }
/// A `Reader` which returns an infinite stream of 0 bytes, like /dev/zero. /// A `Reader` which returns an infinite stream of 0 bytes, like /dev/zero.
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[deprecated(since = "1.0.0", reason = "use std::io::repeat(0) instead")] #[deprecated(since = "1.0.0", reason = "use std::io::repeat(0) instead")]
#[unstable(feature = "old_io")] #[unstable(feature = "old_io")]
pub struct ZeroReader; pub struct ZeroReader;
@ -130,7 +130,7 @@ impl Buffer for ZeroReader {
} }
/// A `Reader` which is always at EOF, like /dev/null. /// A `Reader` which is always at EOF, like /dev/null.
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
#[deprecated(since = "1.0.0", reason = "use std::io::empty() instead")] #[deprecated(since = "1.0.0", reason = "use std::io::empty() instead")]
#[unstable(feature = "old_io")] #[unstable(feature = "old_io")]
pub struct NullReader; pub struct NullReader;

View file

@ -25,7 +25,7 @@ use libc;
#[cfg(any(not(target_arch = "arm"), target_os = "ios"))] #[cfg(any(not(target_arch = "arm"), target_os = "ios"))]
#[repr(C)] #[repr(C)]
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum _Unwind_Action { pub enum _Unwind_Action {
_UA_SEARCH_PHASE = 1, _UA_SEARCH_PHASE = 1,
_UA_CLEANUP_PHASE = 2, _UA_CLEANUP_PHASE = 2,

View file

@ -197,7 +197,7 @@ macro_rules! __thread_local_inner {
/// Indicator of the state of a thread local storage key. /// Indicator of the state of a thread local storage key.
#[unstable(feature = "std_misc", #[unstable(feature = "std_misc",
reason = "state querying was recently added")] reason = "state querying was recently added")]
#[derive(Eq, PartialEq, Copy)] #[derive(Eq, PartialEq, Copy, Clone)]
pub enum LocalKeyState { pub enum LocalKeyState {
/// All keys are in this state whenever a thread starts. Keys will /// All keys are in this state whenever a thread starts. Keys will
/// transition to the `Valid` state once the first call to `with` happens /// transition to the `Valid` state once the first call to `with` happens

View file

@ -15,7 +15,7 @@ pub use self::AbiArchitecture::*;
use std::fmt; use std::fmt;
#[derive(Copy, PartialEq, Eq, Debug)] #[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Os { pub enum Os {
OsWindows, OsWindows,
OsMacos, OsMacos,
@ -49,7 +49,7 @@ pub enum Abi {
} }
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[derive(Copy, PartialEq, Debug)] #[derive(Copy, Clone, PartialEq, Debug)]
pub enum Architecture { pub enum Architecture {
X86, X86,
X86_64, X86_64,
@ -58,7 +58,7 @@ pub enum Architecture {
Mipsel Mipsel
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct AbiData { pub struct AbiData {
abi: Abi, abi: Abi,
@ -66,7 +66,7 @@ pub struct AbiData {
name: &'static str, name: &'static str,
} }
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum AbiArchitecture { pub enum AbiArchitecture {
/// Not a real ABI (e.g., intrinsic) /// Not a real ABI (e.g., intrinsic)
RustArch, RustArch,

View file

@ -40,7 +40,7 @@ use visit;
/// - The default implementation for a trait method. /// - The default implementation for a trait method.
/// ///
/// To construct one, use the `Code::from_node` function. /// To construct one, use the `Code::from_node` function.
#[derive(Copy)] #[derive(Copy, Clone)]
pub struct FnLikeNode<'a> { node: ast_map::Node<'a> } pub struct FnLikeNode<'a> { node: ast_map::Node<'a> }
/// MaybeFnLike wraps a method that indicates if an object /// MaybeFnLike wraps a method that indicates if an object
@ -80,7 +80,7 @@ impl MaybeFnLike for ast::Expr {
/// Carries either an FnLikeNode or a Block, as these are the two /// Carries either an FnLikeNode or a Block, as these are the two
/// constructs that correspond to "code" (as in, something from which /// constructs that correspond to "code" (as in, something from which
/// we can construct a control-flow graph). /// we can construct a control-flow graph).
#[derive(Copy)] #[derive(Copy, Clone)]
pub enum Code<'a> { pub enum Code<'a> {
FnLikeCode(FnLikeNode<'a>), FnLikeCode(FnLikeNode<'a>),
BlockCode(&'a Block), BlockCode(&'a Block),

View file

@ -101,7 +101,7 @@ pub fn path_to_string<PI: Iterator<Item=PathElem>>(path: PI) -> String {
}) })
} }
#[derive(Copy, Debug)] #[derive(Copy, Clone, Debug)]
pub enum Node<'ast> { pub enum Node<'ast> {
NodeItem(&'ast Item), NodeItem(&'ast Item),
NodeForeignItem(&'ast ForeignItem), NodeForeignItem(&'ast ForeignItem),

Some files were not shown because too many files have changed in this diff Show more