1
Fork 0

Fallout in public-facing and semi-public-facing libs

This commit is contained in:
Niko Matsakis 2015-03-30 09:40:52 -04:00
parent 49b76a087b
commit c35c46821a
39 changed files with 273 additions and 242 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

@ -15,6 +15,7 @@
use any;
use cell::{Cell, RefCell, Ref, RefMut, BorrowState};
use char::CharExt;
use clone::Clone;
use iter::Iterator;
use marker::{Copy, PhantomData, Sized};
use mem;
@ -54,7 +55,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.
@ -141,6 +142,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 {
@ -175,7 +182,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, }
@ -222,7 +229,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

@ -75,7 +75,7 @@ pub trait Sized : MarkerTrait {
///
/// ```
/// // we can just derive a `Copy` implementation
/// #[derive(Debug, Copy)]
/// #[derive(Debug, Copy, Clone)]
/// struct Foo;
///
/// let x = Foo;
@ -124,7 +124,7 @@ pub trait Sized : MarkerTrait {
/// There are two ways to implement `Copy` on your type:
///
/// ```
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct MyStruct;
/// ```
///
@ -133,6 +133,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`

View file

@ -2425,7 +2425,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 {
@ -511,7 +511,7 @@ neg_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
/// ```
/// use std::ops::Not;
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct Foo;
///
/// impl Not for Foo {
@ -565,7 +565,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 {
@ -619,7 +619,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 {
@ -673,7 +673,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 {
@ -727,7 +727,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 {
@ -799,7 +799,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 {
@ -871,7 +871,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;
///
@ -912,7 +912,7 @@ pub trait Index<Idx: ?Sized> {
/// ```
/// use std::ops::{Index, IndexMut};
///
/// #[derive(Copy)]
/// #[derive(Copy, Clone)]
/// struct Foo;
/// struct Bar;
///

View file

@ -18,7 +18,6 @@
//!
//! Their definition should always match the ABI defined in `rustc::back::abi`.
use marker::Copy;
use mem;
/// The representation of a slice like `&[T]`.
@ -63,6 +62,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 +138,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

@ -1123,7 +1123,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

@ -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

@ -184,7 +184,7 @@ pub mod attr {
/// Most attributes can only be turned on and must be turned off with term.reset().
/// The ones that can be turned off explicitly take a boolean value.
/// Color is also represented as an attribute for convenience.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum Attr {
/// Bold (or possibly bright) mode
Bold,

View file

@ -18,7 +18,7 @@ use std::ascii::OwnedAsciiExt;
use std::mem::replace;
use std::iter::repeat;
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
enum States {
Nothing,
Percent,
@ -35,7 +35,7 @@ enum States {
SeekIfEndPercent(isize)
}
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
enum FormatState {
FormatStateFlags,
FormatStateWidth,
@ -444,7 +444,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
Ok(output)
}
#[derive(Copy, PartialEq)]
#[derive(Copy, Clone, PartialEq)]
struct Flags {
width: usize,
precision: usize,
@ -461,7 +461,7 @@ impl Flags {
}
}
#[derive(Copy)]
#[derive(Copy, Clone)]
enum FormatOp {
FormatDigit,
FormatOctal,

View file

@ -193,7 +193,7 @@ impl fmt::Debug for TestFn {
/// This is fed into functions marked with `#[bench]` to allow for
/// set-up & tear-down before running a piece of code repeatedly via a
/// call to `iter`.
#[derive(Copy)]
#[derive(Copy, Clone)]
pub struct Bencher {
iterations: u64,
dur: Duration,
@ -280,7 +280,7 @@ pub fn test_main_static(args: env::Args, tests: &[TestDescAndFn]) {
test_main(&args, owned_tests)
}
#[derive(Copy)]
#[derive(Copy, Clone)]
pub enum ColorConfig {
AutoColor,
AlwaysColor,