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`.
```
# #[derive(Copy)]
# #[derive(Copy, Clone)]
# struct Point {x: f64, y: f64};
# type Surface = i32;
# struct BoundingBox {x: f64, y: f64, width: f64, height: f64};
@ -1661,6 +1661,10 @@ struct Circle {
impl Copy for Circle {}
impl Clone for Circle {
fn clone(&self) -> Circle { *self }
}
impl Shape for Circle {
fn draw(&self, s: Surface) { do_draw_circle(s, *self); }
fn bounding_box(&self) -> BoundingBox {

View File

@ -30,7 +30,7 @@
//! use std::collections::BinaryHeap;
//! use std::usize;
//!
//! #[derive(Copy, Eq, PartialEq)]
//! #[derive(Copy, Clone, Eq, PartialEq)]
//! struct State {
//! cost: 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());
/// }
/// ```
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct Handle<NodeRef, Type, NodeType> {
node: NodeRef,
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)
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash)]
/// 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
@ -37,6 +37,10 @@ pub struct 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")]
impl<E:CLike + fmt::Debug> fmt::Debug for EnumSet<E> {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {

View File

@ -14,7 +14,7 @@ use collections::enum_set::{CLike, EnumSet};
use self::Foo::*;
#[derive(Copy, PartialEq, Debug)]
#[derive(Copy, Clone, PartialEq, Debug)]
#[repr(usize)]
enum Foo {
A, B, C
@ -218,7 +218,7 @@ fn test_operators() {
#[should_panic]
fn test_overflow() {
#[allow(dead_code)]
#[derive(Copy)]
#[derive(Copy, Clone)]
#[repr(usize)]
enum Bar {
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
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum Ordering {
/// No ordering constraints, only atomic operations.
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -14,6 +14,7 @@
use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
use char::CharExt;
use clone::Clone;
use iter::Iterator;
use marker::{Copy, PhantomData, Sized};
use mem;
@ -53,7 +54,7 @@ pub type Result = result::Result<(), Error>;
/// occurred. Any extra information must be arranged to be transmitted through
/// some other means.
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
pub struct Error;
/// 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,
}
impl<'a> Clone for ArgumentV1<'a> {
fn clone(&self) -> ArgumentV1<'a> {
*self
}
}
impl<'a> ArgumentV1<'a> {
#[inline(never)]
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
#[derive(Copy)]
#[derive(Copy, Clone)]
#[allow(dead_code)] // SignMinus isn't currently used
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`
/// and `format` functions can be safely performed.
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct Arguments<'a> {
// Format string pieces to print.
pieces: &'a [&'a str],

View File

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

View File

@ -16,7 +16,7 @@
#![stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy)]
#[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Argument {
#[stable(feature = "rust1", since = "1.0.0")]
@ -25,7 +25,7 @@ pub struct Argument {
pub format: FormatSpec,
}
#[derive(Copy)]
#[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct FormatSpec {
#[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.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Alignment {
/// Indication that contents should be left-aligned.
@ -58,7 +58,7 @@ pub enum Alignment {
Unknown,
}
#[derive(Copy)]
#[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Count {
#[stable(feature = "rust1", since = "1.0.0")]
@ -71,7 +71,7 @@ pub enum Count {
Implied,
}
#[derive(Copy)]
#[derive(Copy, Clone)]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Position {
#[stable(feature = "rust1", since = "1.0.0")]

View File

@ -76,7 +76,7 @@ pub trait Sized : MarkerTrait {
///
/// ```
/// // we can just derive a `Copy` implementation
/// #[derive(Debug, Copy)]
/// #[derive(Debug, Copy, Clone)]
/// struct Foo;
///
/// let x = Foo;
@ -125,7 +125,7 @@ pub trait Sized : MarkerTrait {
/// There are two ways to implement `Copy` on your type:
///
/// ```
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct MyStruct;
/// ```
///
@ -134,6 +134,7 @@ pub trait Sized : MarkerTrait {
/// ```
/// struct 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`
@ -155,7 +156,7 @@ pub trait Sized : MarkerTrait {
/// change: that second example would fail to compile if we made `Foo` non-`Copy`.
#[stable(feature = "rust1", since = "1.0.0")]
#[lang="copy"]
pub trait Copy : MarkerTrait {
pub trait Copy : Clone {
// Empty.
}

View File

@ -2444,7 +2444,7 @@ impl_num_cast! { f32, to_f32 }
impl_num_cast! { f64, to_f64 }
/// 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")]
pub enum FpCategory {
/// "Not a Number", often obtained by dividing by zero

View File

@ -165,7 +165,7 @@ macro_rules! forward_ref_binop {
/// ```
/// use std::ops::Add;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct Foo;
///
/// impl Rem for Foo {
@ -454,7 +454,7 @@ rem_float_impl! { f64, fmod }
/// ```
/// use std::ops::Neg;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct Foo;
///
/// impl Neg for Foo {
@ -527,7 +527,7 @@ neg_impl_numeric! { isize i8 i16 i32 i64 f32 f64 }
/// ```
/// use std::ops::Not;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct 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;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct Foo;
/// struct Bar;
///
@ -928,7 +928,7 @@ pub trait Index<Idx: ?Sized> {
/// ```
/// use std::ops::{Index, IndexMut};
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct Foo;
/// struct Bar;
///

View File

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

View File

@ -38,7 +38,7 @@
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct i8x16(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")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
pub i16, pub i16, pub i16, pub i16);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct i64x2(pub i64, pub i64);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct u8x16(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")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
pub u16, pub u16, pub u16, pub u16);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct u64x2(pub u64, pub u64);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[unstable(feature = "core")]
#[simd]
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[repr(C)]
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
/// the next `char` in a string. This can be used as a data structure
/// for iterating over the UTF-8 bytes of a string.
#[derive(Copy)]
#[derive(Copy, Clone)]
#[unstable(feature = "str_char",
reason = "existence of this struct is uncertain as it is frequently \
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
/// to emit. These are emitted as a stream by the `Parser` class.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub enum Piece<'a> {
/// A literal string which should directly be emitted
String(&'a str),
@ -50,7 +50,7 @@ pub enum Piece<'a> {
}
/// Representation of an argument specification.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub struct Argument<'a> {
/// Where to find this argument
pub position: Position<'a>,
@ -59,7 +59,7 @@ pub struct Argument<'a> {
}
/// Specification for the formatting of an argument in the format string.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with
pub fill: Option<char>,
@ -78,7 +78,7 @@ pub struct FormatSpec<'a> {
}
/// Enum describing where an argument for a format can be located.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub enum Position<'a> {
/// The argument will be in the next position. This is the default.
ArgumentNext,
@ -89,7 +89,7 @@ pub enum Position<'a> {
}
/// Enum of alignments which are supported.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub enum Alignment {
/// The value will be aligned to the left.
AlignLeft,
@ -103,7 +103,7 @@ pub enum Alignment {
/// Various flags which can be applied to format strings. The meaning of these
/// flags is defined by the formatters themselves.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub enum Flag {
/// A `+` will be used to denote positive numbers.
FlagSignPlus,
@ -119,7 +119,7 @@ pub enum Flag {
/// A count is used for the precision and width parameters of an integer, and
/// can reference either an argument or a literal integer.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub enum Count<'a> {
/// The count is specified explicitly.
CountIs(usize),

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -29,7 +29,7 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
/// Generate Normal Random
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
/// College, Oxford
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct Exp1(pub f64);
// 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());
/// println!("{} is from a Exp(2) distribution", v);
/// ```
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct Exp {
/// `lambda` stored as `1/lambda`, since this is what we scale by.
lambda_inverse: f64

View File

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

View File

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

View File

@ -175,7 +175,7 @@ pub struct TaggedDoc<'a> {
pub doc: Doc<'a>,
}
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
pub enum EbmlEncoderTag {
// tags 00..1f are reserved for auto-serialization.
// 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 val: usize,
pub next: usize

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -84,7 +84,7 @@ pub struct Node<K:UnifyKey> {
pub rank: usize,
}
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct Delegate<K>(PhantomData<K>);
// 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; )*
) => {
#[derive(Copy, FromPrimitive, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, FromPrimitive, PartialEq, Eq, Hash)]
pub enum LangItem {
$($variant),*
}

View File

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

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
// as accessing of components:
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum deref_kind {
deref_ptr(PointerKind),
deref_interior(InteriorKind),
@ -263,6 +263,9 @@ pub struct MemCategorizationContext<'t,TYPER:'t> {
}
impl<'t,TYPER:'t> Copy for MemCategorizationContext<'t,TYPER> {}
impl<'t,TYPER:'t> Clone for MemCategorizationContext<'t,TYPER> {
fn clone(&self) -> MemCategorizationContext<'t,TYPER> { *self }
}
pub type McResult<T> = Result<T, ()>;

View File

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

View File

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

View File

@ -262,7 +262,7 @@ pub struct field_ty {
// Contains information needed to resolve types and (in the future) look up
// the types of AST nodes.
#[derive(Copy, PartialEq, Eq, Hash)]
#[derive(Copy, Clone, PartialEq, Eq, Hash)]
pub struct creader_cache_key {
pub cnum: CrateNum,
pub pos: usize,
@ -596,7 +596,7 @@ pub type ObjectCastMap<'tcx> = RefCell<NodeMap<ty::PolyTraitRef<'tcx>>>;
/// will push one or more such restriction into the
/// `transmute_restrictions` vector during `intrinsicck`. They are
/// then checked during `trans` by the fn `check_intrinsics`.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct TransmuteRestriction<'tcx> {
/// The span whence the restriction comes.
pub span: Span,
@ -886,7 +886,7 @@ macro_rules! sty_debug_print {
// variable names.
mod inner {
use middle::ty;
#[derive(Copy)]
#[derive(Copy, Clone)]
struct DebugStat {
total: usize,
region_infer: usize,
@ -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
/// will keep the "more erroneous" of two values.
#[derive(Copy, PartialOrd, Ord, Eq, PartialEq, Debug)]
#[derive(Copy, Clone, PartialOrd, Ord, Eq, PartialEq, Debug)]
pub enum Representability {
Representable,
ContainsRecursive,
@ -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
/// generate code for that kind of expression. See trans/expr.rs for more
/// information.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum ExprKind {
LvalueExpr,
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()
}
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum DtorKind {
NoDtor,
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)
}
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum CopyImplementationError {
FieldDoesNotImplementCopy(ast::Name),
VariantDoesNotImplementCopy(ast::Name),

View File

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

View File

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

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum ValueOrigin {
/// The LLVM `Value` is in this context because the corresponding item was
/// assigned to the current compilation unit.

View File

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

View File

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

View File

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

View File

@ -343,7 +343,7 @@ pub fn gensym_name(name: &str) -> PathElem {
*
*/
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct NodeIdAndSpan {
pub id: ast::NodeId,
pub span: Span,
@ -1225,7 +1225,7 @@ pub fn drain_fulfillment_cx<'a,'tcx,T>(infcx: &infer::InferCtxt<'a,'tcx>,
}
// Key used to lookup values supplied for type parameters in an expr.
#[derive(Copy, PartialEq, Debug)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum ExprOrMethodCall {
// Type parameters for a path like `None::<int>`
ExprId(ast::NodeId),

View File

@ -172,7 +172,7 @@ impl Drop for Rvalue {
fn drop(&mut self) { }
}
#[derive(Copy, PartialEq, Eq, Hash, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
pub enum RvalueMode {
/// `val` is a pointer to the actual value (and thus has type *T)
ByRef,

View File

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

View File

@ -94,7 +94,7 @@ use std::rc::Rc;
// These are passed around by the code generating functions to track the
// destination of a computation's value.
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
pub enum Dest {
SaveIn(ValueRef),
Ignore,
@ -2038,7 +2038,7 @@ fn float_cast(bcx: Block,
} else { llsrc };
}
#[derive(Copy, PartialEq, Debug)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum cast_kind {
cast_pointer,
cast_integral,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -249,11 +249,6 @@ impl<'ccx, 'tcx> CheckTypeWellFormedVisitor<'ccx, 'tcx> {
&fcx.inh.param_env.free_substs,
&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
// self-type. In particular, we enforce region
// relationships. The reason for this is that (at least

View File

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

View File

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

View File

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

View File

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

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
/// visibility is preset)
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct VisSpace(pub Option<ast::Visibility>);
/// Similarly to VisSpace, this structure is used to render a function style with a
/// space after it.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct UnsafetySpace(pub ast::Unsafety);
/// Wrapper struct for properly emitting a method declaration.
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
/// Similar to VisSpace, but used for mutability
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct MutableSpace(pub clean::Mutability);
/// Similar to VisSpace, but used for mutability
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct RawMutableSpace(pub clean::Mutability);
/// Wrapper struct for properly emitting the stability level.
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
// information
#[derive(Copy)]
#[derive(Copy, Clone)]
struct Item<'a> {
cx: &'a Context,
item: &'a clean::Item,

View File

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

View File

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

View File

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

View File

@ -87,6 +87,9 @@ struct 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> {
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> Clone for Bucket<K,V,M> {
fn clone(&self) -> Bucket<K,V,M> { *self }
}
pub struct EmptyBucket<K, V, M> {
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
/// buckets.
#[derive(PartialEq, Copy)]
#[derive(PartialEq, Copy, Clone)]
pub struct SafeHash {
hash: u64,
}

View File

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

View File

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

View File

@ -29,7 +29,7 @@ use sys;
use vec::Vec;
/// Hints to the types of sockets that are desired when looking up hosts
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
pub enum SocketType {
Stream, Datagram, Raw
}
@ -38,7 +38,7 @@ pub enum SocketType {
/// to manipulate how a query is performed.
///
/// 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 {
AddrConfig,
All,
@ -51,7 +51,7 @@ pub enum Flag {
/// A transport protocol associated with either a hint or a return value of
/// `lookup`
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
pub enum Protocol {
TCP, UDP
}
@ -61,7 +61,7 @@ pub enum Protocol {
///
/// For details on these fields, see their corresponding definitions via
/// `man -s 3 getaddrinfo`
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
pub struct Hint {
pub family: usize,
pub socktype: Option<SocketType>,
@ -69,7 +69,7 @@ pub struct Hint {
pub flags: usize,
}
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
pub struct Info {
pub address: SocketAddr,
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.
#[derive(Copy, Debug)]
#[derive(Copy, Clone, Debug)]
#[deprecated(since = "1.0.0", reason = "use std::io::sink() instead")]
#[unstable(feature = "old_io")]
pub struct NullWriter;
@ -103,7 +103,7 @@ impl Writer for NullWriter {
}
/// 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")]
#[unstable(feature = "old_io")]
pub struct ZeroReader;
@ -130,7 +130,7 @@ impl Buffer for ZeroReader {
}
/// 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")]
#[unstable(feature = "old_io")]
pub struct NullReader;

View File

@ -25,7 +25,7 @@ use libc;
#[cfg(any(not(target_arch = "arm"), target_os = "ios"))]
#[repr(C)]
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum _Unwind_Action {
_UA_SEARCH_PHASE = 1,
_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.
#[unstable(feature = "std_misc",
reason = "state querying was recently added")]
#[derive(Eq, PartialEq, Copy)]
#[derive(Eq, PartialEq, Copy, Clone)]
pub enum LocalKeyState {
/// All keys are in this state whenever a thread starts. Keys will
/// 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;
#[derive(Copy, PartialEq, Eq, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Os {
OsWindows,
OsMacos,
@ -49,7 +49,7 @@ pub enum Abi {
}
#[allow(non_camel_case_types)]
#[derive(Copy, PartialEq, Debug)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Architecture {
X86,
X86_64,
@ -58,7 +58,7 @@ pub enum Architecture {
Mipsel
}
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct AbiData {
abi: Abi,
@ -66,7 +66,7 @@ pub struct AbiData {
name: &'static str,
}
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum AbiArchitecture {
/// Not a real ABI (e.g., intrinsic)
RustArch,

View File

@ -40,7 +40,7 @@ use visit;
/// - The default implementation for a trait method.
///
/// To construct one, use the `Code::from_node` function.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct FnLikeNode<'a> { node: ast_map::Node<'a> }
/// 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
/// constructs that correspond to "code" (as in, something from which
/// we can construct a control-flow graph).
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum Code<'a> {
FnLikeCode(FnLikeNode<'a>),
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> {
NodeItem(&'ast Item),
NodeForeignItem(&'ast ForeignItem),

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