auto merge of #19867 : japaric/rust/deriving-copy, r=acrichto
r? @alexcrichton
This commit is contained in:
commit
95c2ed31ae
147 changed files with 484 additions and 1267 deletions
|
|
@ -29,14 +29,12 @@
|
|||
//! use std::collections::BinaryHeap;
|
||||
//! use std::uint;
|
||||
//!
|
||||
//! #[deriving(Eq, PartialEq)]
|
||||
//! #[deriving(Copy, Eq, PartialEq)]
|
||||
//! struct State {
|
||||
//! cost: uint,
|
||||
//! position: uint
|
||||
//! }
|
||||
//!
|
||||
//! impl Copy for State {}
|
||||
//!
|
||||
//! // The priority queue depends on `Ord`.
|
||||
//! // Explicitly implement the trait so the queue becomes a min-heap
|
||||
//! // instead of a max-heap.
|
||||
|
|
|
|||
|
|
@ -301,14 +301,12 @@ mod test {
|
|||
|
||||
use super::{EnumSet, CLike};
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
#[repr(uint)]
|
||||
enum Foo {
|
||||
A, B, C
|
||||
}
|
||||
|
||||
impl Copy for Foo {}
|
||||
|
||||
impl CLike for Foo {
|
||||
fn to_uint(&self) -> uint {
|
||||
*self as uint
|
||||
|
|
@ -507,6 +505,7 @@ mod test {
|
|||
#[should_fail]
|
||||
fn test_overflow() {
|
||||
#[allow(dead_code)]
|
||||
#[deriving(Copy)]
|
||||
#[repr(uint)]
|
||||
enum Bar {
|
||||
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,
|
||||
|
|
@ -518,8 +517,6 @@ mod test {
|
|||
V60, V61, V62, V63, V64, V65, V66, V67, V68, V69,
|
||||
}
|
||||
|
||||
impl Copy for Bar {}
|
||||
|
||||
impl CLike for Bar {
|
||||
fn to_uint(&self) -> uint {
|
||||
*self as uint
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ use alloc::boxed::Box;
|
|||
use core::borrow::{BorrowFrom, BorrowFromMut, ToOwned};
|
||||
use core::cmp;
|
||||
use core::iter::{range_step, MultiplicativeIterator};
|
||||
use core::kinds::{Copy, Sized};
|
||||
use core::kinds::Sized;
|
||||
use core::mem::size_of;
|
||||
use core::mem;
|
||||
use core::ops::FnMut;
|
||||
|
|
@ -177,18 +177,16 @@ impl ElementSwaps {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum Direction { Pos, Neg }
|
||||
|
||||
impl Copy for Direction {}
|
||||
|
||||
/// An `Index` and `Direction` together.
|
||||
#[deriving(Copy)]
|
||||
struct SizeDirection {
|
||||
size: uint,
|
||||
dir: Direction,
|
||||
}
|
||||
|
||||
impl Copy for SizeDirection {}
|
||||
|
||||
impl Iterator<(uint, uint)> for ElementSwaps {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<(uint, uint)> {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ pub use self::Ordering::*;
|
|||
|
||||
use intrinsics;
|
||||
use cell::UnsafeCell;
|
||||
use kinds::Copy;
|
||||
|
||||
/// A boolean type which can be safely shared between threads.
|
||||
#[stable]
|
||||
|
|
@ -53,6 +52,7 @@ pub struct AtomicPtr<T> {
|
|||
/// Rust's memory orderings are [the same as
|
||||
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
|
||||
#[stable]
|
||||
#[deriving(Copy)]
|
||||
pub enum Ordering {
|
||||
/// No ordering constraints, only atomic operations.
|
||||
#[stable]
|
||||
|
|
@ -77,8 +77,6 @@ pub enum Ordering {
|
|||
SeqCst,
|
||||
}
|
||||
|
||||
impl Copy for Ordering {}
|
||||
|
||||
/// An `AtomicBool` initialized to `false`.
|
||||
#[unstable = "may be renamed, pending conventions for static initalizers"]
|
||||
pub const INIT_ATOMIC_BOOL: AtomicBool =
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@
|
|||
|
||||
pub use self::Ordering::*;
|
||||
|
||||
use kinds::{Copy, Sized};
|
||||
use kinds::Sized;
|
||||
use option::Option::{mod, Some, None};
|
||||
|
||||
/// Trait for values that can be compared for equality and inequality.
|
||||
|
|
@ -94,7 +94,7 @@ pub trait Eq<Sized? Rhs = Self> for Sized?: PartialEq<Rhs> {
|
|||
}
|
||||
|
||||
/// An ordering is, e.g, a result of a comparison between two values.
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||
#[stable]
|
||||
pub enum Ordering {
|
||||
/// An ordering where a compared value is less [than another].
|
||||
|
|
@ -105,8 +105,6 @@ pub enum Ordering {
|
|||
Greater = 1i,
|
||||
}
|
||||
|
||||
impl Copy for Ordering {}
|
||||
|
||||
impl Ordering {
|
||||
/// Reverse the `Ordering`, so that `Less` becomes `Greater` and
|
||||
/// vice versa.
|
||||
|
|
|
|||
|
|
@ -44,10 +44,9 @@ pub type Result = result::Result<(), Error>;
|
|||
/// occurred. Any extra information must be arranged to be transmitted through
|
||||
/// some other means.
|
||||
#[experimental = "core and I/O reconciliation may alter this definition"]
|
||||
#[deriving(Copy)]
|
||||
pub struct Error;
|
||||
|
||||
impl Copy for Error {}
|
||||
|
||||
/// A collection of methods that are required to format a message into a stream.
|
||||
///
|
||||
/// This trait is the type which this modules requires when formatting
|
||||
|
|
@ -104,6 +103,7 @@ enum Void {}
|
|||
/// compile time it is ensured that the function and the value have the correct
|
||||
/// types, and then this struct is used to canonicalize arguments to one type.
|
||||
#[experimental = "implementation detail of the `format_args!` macro"]
|
||||
#[deriving(Copy)]
|
||||
pub struct Argument<'a> {
|
||||
value: &'a Void,
|
||||
formatter: fn(&Void, &mut Formatter) -> Result,
|
||||
|
|
@ -137,8 +137,6 @@ impl<'a> Argument<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Copy for Argument<'a> {}
|
||||
|
||||
impl<'a> Arguments<'a> {
|
||||
/// When using the format_args!() macro, this function is used to generate the
|
||||
/// Arguments structure.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
use fmt;
|
||||
use iter::DoubleEndedIteratorExt;
|
||||
use kinds::Copy;
|
||||
use num::{Int, cast};
|
||||
use slice::SliceExt;
|
||||
|
||||
|
|
@ -109,14 +108,12 @@ radix! { UpperHex, 16, "0x", x @ 0 ... 9 => b'0' + x,
|
|||
x @ 10 ... 15 => b'A' + (x - 10) }
|
||||
|
||||
/// A radix with in the range of `2..36`.
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
#[unstable = "may be renamed or move to a different module"]
|
||||
pub struct Radix {
|
||||
base: u8,
|
||||
}
|
||||
|
||||
impl Copy for Radix {}
|
||||
|
||||
impl Radix {
|
||||
fn new(base: u8) -> Radix {
|
||||
assert!(2 <= base && base <= 36, "the base must be in the range of 2..36: {}", base);
|
||||
|
|
@ -137,10 +134,9 @@ impl GenericRadix for Radix {
|
|||
|
||||
/// A helper type for formatting radixes.
|
||||
#[unstable = "may be renamed or move to a different module"]
|
||||
#[deriving(Copy)]
|
||||
pub struct RadixFmt<T, R>(T, R);
|
||||
|
||||
impl<T,R> Copy for RadixFmt<T,R> where T: Copy, R: Copy {}
|
||||
|
||||
/// Constructs a radix formatter in the range of `2..36`.
|
||||
///
|
||||
/// # Example
|
||||
|
|
|
|||
|
|
@ -20,17 +20,16 @@ pub use self::Alignment::*;
|
|||
pub use self::Count::*;
|
||||
pub use self::Position::*;
|
||||
pub use self::Flag::*;
|
||||
use kinds::Copy;
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deriving(Copy)]
|
||||
pub struct Argument<'a> {
|
||||
pub position: Position,
|
||||
pub format: FormatSpec,
|
||||
}
|
||||
|
||||
impl<'a> Copy for Argument<'a> {}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deriving(Copy)]
|
||||
pub struct FormatSpec {
|
||||
pub fill: char,
|
||||
pub align: Alignment,
|
||||
|
|
@ -39,10 +38,8 @@ pub struct FormatSpec {
|
|||
pub width: Count,
|
||||
}
|
||||
|
||||
impl Copy for FormatSpec {}
|
||||
|
||||
/// Possible alignments that can be requested as part of a formatting directive.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum Alignment {
|
||||
/// Indication that contents should be left-aligned.
|
||||
AlignLeft,
|
||||
|
|
@ -54,27 +51,24 @@ pub enum Alignment {
|
|||
AlignUnknown,
|
||||
}
|
||||
|
||||
impl Copy for Alignment {}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deriving(Copy)]
|
||||
pub enum Count {
|
||||
CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied,
|
||||
}
|
||||
|
||||
impl Copy for Count {}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deriving(Copy)]
|
||||
pub enum Position {
|
||||
ArgumentNext, ArgumentIs(uint)
|
||||
}
|
||||
|
||||
impl Copy for Position {}
|
||||
|
||||
/// Flags which can be passed to formatting via a directive.
|
||||
///
|
||||
/// These flags are discovered through the `flags` field of the `Formatter`
|
||||
/// structure. The flag in that structure is a union of these flags into a
|
||||
/// `uint` where each flag's discriminant is the corresponding bit.
|
||||
#[deriving(Copy)]
|
||||
pub enum Flag {
|
||||
/// A flag which enables number formatting to always print the sign of a
|
||||
/// number.
|
||||
|
|
@ -89,5 +83,3 @@ pub enum Flag {
|
|||
/// being aware of the sign to be printed.
|
||||
FlagSignAwareZeroPad,
|
||||
}
|
||||
|
||||
impl Copy for Flag {}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ use default::Default;
|
|||
use super::{Hash, Hasher, Writer};
|
||||
|
||||
/// `SipState` computes a SipHash 2-4 hash over a stream of bytes.
|
||||
#[deriving(Copy)]
|
||||
pub struct SipState {
|
||||
k0: u64,
|
||||
k1: u64,
|
||||
|
|
@ -42,8 +43,6 @@ pub struct SipState {
|
|||
ntail: uint, // how many bytes in tail are valid
|
||||
}
|
||||
|
||||
impl Copy for SipState {}
|
||||
|
||||
// sadly, these macro definitions can't appear later,
|
||||
// because they're needed in the following defs;
|
||||
// this design could be improved.
|
||||
|
|
|
|||
|
|
@ -42,11 +42,10 @@
|
|||
#![experimental]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use kinds::Copy;
|
||||
|
||||
pub type GlueFn = extern "Rust" fn(*const i8);
|
||||
|
||||
#[lang="ty_desc"]
|
||||
#[deriving(Copy)]
|
||||
pub struct TyDesc {
|
||||
// sizeof(T)
|
||||
pub size: uint,
|
||||
|
|
@ -61,8 +60,6 @@ pub struct TyDesc {
|
|||
pub name: &'static str,
|
||||
}
|
||||
|
||||
impl Copy for TyDesc {}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
|
||||
// NB: These intrinsics take unsafe pointers because they mutate aliased
|
||||
|
|
@ -540,13 +537,11 @@ extern "rust-intrinsic" {
|
|||
/// `TypeId` represents a globally unique identifier for a type
|
||||
#[lang="type_id"] // This needs to be kept in lockstep with the code in trans/intrinsic.rs and
|
||||
// middle/lang_items.rs
|
||||
#[deriving(Clone, PartialEq, Eq, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Show)]
|
||||
pub struct TypeId {
|
||||
t: u64,
|
||||
}
|
||||
|
||||
impl Copy for TypeId {}
|
||||
|
||||
impl TypeId {
|
||||
/// Returns the `TypeId` of the type this generic function has been instantiated with
|
||||
pub fn of<T: 'static>() -> TypeId {
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ pub use self::MinMaxResult::*;
|
|||
use clone::Clone;
|
||||
use cmp;
|
||||
use cmp::Ord;
|
||||
use kinds::Copy;
|
||||
use mem;
|
||||
use num::{ToPrimitive, Int};
|
||||
use ops::{Add, Deref, FnMut};
|
||||
|
|
@ -1168,7 +1167,7 @@ impl<A, I> CloneIteratorExt for I where I: Iterator<A> + Clone {
|
|||
}
|
||||
|
||||
/// An iterator that repeats endlessly
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable]
|
||||
pub struct Cycle<T> {
|
||||
|
|
@ -1176,8 +1175,6 @@ pub struct Cycle<T> {
|
|||
iter: T,
|
||||
}
|
||||
|
||||
impl<T:Copy> Copy for Cycle<T> {}
|
||||
|
||||
impl<A, T: Clone + Iterator<A>> Iterator<A> for Cycle<T> {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<A> {
|
||||
|
|
@ -1635,13 +1632,12 @@ impl<A, T: RandomAccessIterator<A>> RandomAccessIterator<(uint, A)> for Enumerat
|
|||
/// An iterator with a `peek()` that returns an optional reference to the next element.
|
||||
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
|
||||
#[stable]
|
||||
#[deriving(Copy)]
|
||||
pub struct Peekable<A, T> {
|
||||
iter: T,
|
||||
peeked: Option<A>,
|
||||
}
|
||||
|
||||
impl<T:Copy,A:Copy> Copy for Peekable<A,T> {}
|
||||
|
||||
impl<A, T: Iterator<A>> Iterator<A> for Peekable<A, T> {
|
||||
#[inline]
|
||||
fn next(&mut self) -> Option<A> {
|
||||
|
|
@ -2267,7 +2263,7 @@ impl<A, St, F> Iterator<A> for Unfold<A, St, F> where F: FnMut(&mut St) -> Optio
|
|||
|
||||
/// An infinite iterator starting at `start` and advancing by `step` with each
|
||||
/// iteration
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
#[unstable = "may be renamed"]
|
||||
pub struct Counter<A> {
|
||||
/// The current state the counter is at (next value to be yielded)
|
||||
|
|
@ -2276,8 +2272,6 @@ pub struct Counter<A> {
|
|||
step: A,
|
||||
}
|
||||
|
||||
impl<A:Copy> Copy for Counter<A> {}
|
||||
|
||||
/// Creates a new counter with the specified start/step
|
||||
#[inline]
|
||||
#[unstable = "may be renamed"]
|
||||
|
|
@ -2301,7 +2295,7 @@ impl<A: Add<A, A> + Clone> Iterator<A> for Counter<A> {
|
|||
}
|
||||
|
||||
/// An iterator over the range [start, stop)
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
#[unstable = "may be refactored due to numerics reform or ops reform"]
|
||||
pub struct Range<A> {
|
||||
state: A,
|
||||
|
|
@ -2309,8 +2303,6 @@ pub struct Range<A> {
|
|||
one: A,
|
||||
}
|
||||
|
||||
impl<A:Copy> Copy for Range<A> {}
|
||||
|
||||
/// Returns an iterator over the given range [start, stop) (that is, starting
|
||||
/// at start (inclusive), and ending at stop (exclusive)).
|
||||
///
|
||||
|
|
|
|||
|
|
@ -225,11 +225,9 @@ pub mod marker {
|
|||
/// For more information about variance, refer to this Wikipedia
|
||||
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
|
||||
#[lang="covariant_lifetime"]
|
||||
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct CovariantLifetime<'a>;
|
||||
|
||||
impl<'a> Copy for CovariantLifetime<'a> {}
|
||||
|
||||
/// As `ContravariantType`, but for lifetime parameters. Using
|
||||
/// `ContravariantLifetime<'a>` indicates that it is ok to
|
||||
/// substitute a *shorter* lifetime for `'a` than the one you
|
||||
|
|
@ -243,11 +241,9 @@ pub mod marker {
|
|||
/// For more information about variance, refer to this Wikipedia
|
||||
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
|
||||
#[lang="contravariant_lifetime"]
|
||||
#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
|
||||
pub struct ContravariantLifetime<'a>;
|
||||
|
||||
impl<'a> Copy for ContravariantLifetime<'a> {}
|
||||
|
||||
/// As `InvariantType`, but for lifetime parameters. Using
|
||||
/// `InvariantLifetime<'a>` indicates that it is not ok to
|
||||
/// substitute any other lifetime for `'a` besides its original
|
||||
|
|
|
|||
|
|
@ -1225,7 +1225,7 @@ impl_num_cast! { f32, to_f32 }
|
|||
impl_num_cast! { f64, to_f64 }
|
||||
|
||||
/// Used for representing the classification of floating point numbers
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
#[unstable = "may be renamed"]
|
||||
pub enum FPCategory {
|
||||
/// "Not a Number", often obtained by dividing by zero
|
||||
|
|
@ -1240,8 +1240,6 @@ pub enum FPCategory {
|
|||
FPNormal,
|
||||
}
|
||||
|
||||
impl Copy for FPCategory {}
|
||||
|
||||
/// A built-in floating point number.
|
||||
// FIXME(#5527): In a future version of Rust, many of these functions will
|
||||
// become constants.
|
||||
|
|
|
|||
|
|
@ -88,10 +88,9 @@ pub trait Drop {
|
|||
/// calling `add`, and therefore, `main` prints `Adding!`.
|
||||
///
|
||||
/// ```rust
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Add<Foo, Foo> for Foo {
|
||||
/// fn add(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Adding!");
|
||||
|
|
@ -170,10 +169,9 @@ add_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// calling `sub`, and therefore, `main` prints `Subtracting!`.
|
||||
///
|
||||
/// ```rust
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Sub<Foo, Foo> for Foo {
|
||||
/// fn sub(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Subtracting!");
|
||||
|
|
@ -252,10 +250,9 @@ sub_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// calling `mul`, and therefore, `main` prints `Multiplying!`.
|
||||
///
|
||||
/// ```rust
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Mul<Foo, Foo> for Foo {
|
||||
/// fn mul(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Multiplying!");
|
||||
|
|
@ -334,10 +331,9 @@ mul_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// calling `div`, and therefore, `main` prints `Dividing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Div<Foo, Foo> for Foo {
|
||||
/// fn div(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Dividing!");
|
||||
|
|
@ -416,10 +412,9 @@ div_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 f32 f64 }
|
|||
/// calling `rem`, and therefore, `main` prints `Remainder-ing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Rem<Foo, Foo> for Foo {
|
||||
/// fn rem(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Remainder-ing!");
|
||||
|
|
@ -527,10 +522,9 @@ rem_float_impl! { f64, fmod }
|
|||
/// `neg`, and therefore, `main` prints `Negating!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Neg<Foo> for Foo {
|
||||
/// fn neg(&self) -> Foo {
|
||||
/// println!("Negating!");
|
||||
|
|
@ -639,10 +633,9 @@ neg_uint_impl! { u64, i64 }
|
|||
/// `not`, and therefore, `main` prints `Not-ing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Not<Foo> for Foo {
|
||||
/// fn not(&self) -> Foo {
|
||||
/// println!("Not-ing!");
|
||||
|
|
@ -724,10 +717,9 @@ not_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// calling `bitand`, and therefore, `main` prints `Bitwise And-ing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl BitAnd<Foo, Foo> for Foo {
|
||||
/// fn bitand(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Bitwise And-ing!");
|
||||
|
|
@ -806,10 +798,9 @@ bitand_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// calling `bitor`, and therefore, `main` prints `Bitwise Or-ing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl BitOr<Foo, Foo> for Foo {
|
||||
/// fn bitor(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Bitwise Or-ing!");
|
||||
|
|
@ -888,10 +879,9 @@ bitor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// calling `bitxor`, and therefore, `main` prints `Bitwise Xor-ing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl BitXor<Foo, Foo> for Foo {
|
||||
/// fn bitxor(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Bitwise Xor-ing!");
|
||||
|
|
@ -970,10 +960,9 @@ bitxor_impl! { bool uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// calling `shl`, and therefore, `main` prints `Shifting left!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Shl<Foo, Foo> for Foo {
|
||||
/// fn shl(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Shifting left!");
|
||||
|
|
@ -1056,10 +1045,9 @@ shl_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// calling `shr`, and therefore, `main` prints `Shifting right!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Shr<Foo, Foo> for Foo {
|
||||
/// fn shr(&self, _rhs: &Foo) -> Foo {
|
||||
/// println!("Shifting right!");
|
||||
|
|
@ -1139,10 +1127,9 @@ shr_impl! { uint u8 u16 u32 u64 int i8 i16 i32 i64 }
|
|||
/// calling `index`, and therefore, `main` prints `Indexing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Index<Foo, Foo> for Foo {
|
||||
/// fn index<'a>(&'a self, _index: &Foo) -> &'a Foo {
|
||||
/// println!("Indexing!");
|
||||
|
|
@ -1169,10 +1156,9 @@ pub trait Index<Sized? Index, Sized? Result> for Sized? {
|
|||
/// calling `index_mut`, and therefore, `main` prints `Indexing!`.
|
||||
///
|
||||
/// ```
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl IndexMut<Foo, Foo> for Foo {
|
||||
/// fn index_mut<'a>(&'a mut self, _index: &Foo) -> &'a mut Foo {
|
||||
/// println!("Indexing!");
|
||||
|
|
@ -1199,10 +1185,9 @@ pub trait IndexMut<Sized? Index, Sized? Result> for Sized? {
|
|||
/// calling `slice_to`, and therefore, `main` prints `Slicing!`.
|
||||
///
|
||||
/// ```ignore
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl Slice<Foo, Foo> for Foo {
|
||||
/// fn as_slice_<'a>(&'a self) -> &'a Foo {
|
||||
/// println!("Slicing!");
|
||||
|
|
@ -1247,10 +1232,9 @@ pub trait Slice<Sized? Idx, Sized? Result> for Sized? {
|
|||
/// calling `slice_from_mut`, and therefore, `main` prints `Slicing!`.
|
||||
///
|
||||
/// ```ignore
|
||||
/// #[deriving(Copy)]
|
||||
/// struct Foo;
|
||||
///
|
||||
/// impl Copy for Foo {}
|
||||
///
|
||||
/// impl SliceMut<Foo, Foo> for Foo {
|
||||
/// fn as_mut_slice_<'a>(&'a mut self) -> &'a mut Foo {
|
||||
/// println!("Slicing!");
|
||||
|
|
|
|||
|
|
@ -149,7 +149,6 @@ use cmp::{Eq, Ord};
|
|||
use default::Default;
|
||||
use iter::{Iterator, IteratorExt, DoubleEndedIterator, FromIterator};
|
||||
use iter::{ExactSizeIterator};
|
||||
use kinds::Copy;
|
||||
use mem;
|
||||
use result::Result;
|
||||
use result::Result::{Ok, Err};
|
||||
|
|
@ -164,7 +163,7 @@ use ops::{Deref, FnOnce};
|
|||
// which basically means it must be `Option`.
|
||||
|
||||
/// The `Option` type.
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
|
||||
#[stable]
|
||||
pub enum Option<T> {
|
||||
/// No value
|
||||
|
|
@ -920,7 +919,3 @@ impl<A, V: FromIterator<A>> FromIterator<Option<A>> for Option<V> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[stable]
|
||||
impl<T:Copy> Copy for Option<T> {}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,25 +33,23 @@ impl<T> Copy for Slice<T> {}
|
|||
|
||||
/// The representation of a Rust closure
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub struct Closure {
|
||||
pub code: *mut (),
|
||||
pub env: *mut (),
|
||||
}
|
||||
|
||||
impl Copy for Closure {}
|
||||
|
||||
/// The representation of a Rust trait object.
|
||||
///
|
||||
/// This struct does not have a `Repr` implementation
|
||||
/// because there is no way to refer to all trait objects generically.
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub struct TraitObject {
|
||||
pub data: *mut (),
|
||||
pub vtable: *mut (),
|
||||
}
|
||||
|
||||
impl Copy for TraitObject {}
|
||||
|
||||
/// This trait is meant to map equivalences between raw structs and their
|
||||
/// corresponding rust values.
|
||||
pub trait Repr<T> for Sized? {
|
||||
|
|
|
|||
|
|
@ -232,7 +232,6 @@
|
|||
|
||||
use self::Result::*;
|
||||
|
||||
use kinds::Copy;
|
||||
use std::fmt::Show;
|
||||
use slice;
|
||||
use slice::AsSlice;
|
||||
|
|
@ -244,7 +243,7 @@ use ops::{FnMut, FnOnce};
|
|||
/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
|
||||
///
|
||||
/// See the [`std::result`](index.html) module documentation for details.
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
|
||||
#[must_use]
|
||||
#[stable]
|
||||
pub enum Result<T, E> {
|
||||
|
|
@ -919,6 +918,3 @@ pub fn fold<T,
|
|||
}
|
||||
Ok(init)
|
||||
}
|
||||
|
||||
impl<T:Copy,U:Copy> Copy for Result<T,U> {}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,93 +37,70 @@
|
|||
#![allow(non_camel_case_types)]
|
||||
#![allow(missing_docs)]
|
||||
|
||||
use kinds::Copy;
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
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,
|
||||
pub i8, pub i8, pub i8, pub i8);
|
||||
|
||||
impl Copy for i8x16 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
|
||||
pub i16, pub i16, pub i16, pub i16);
|
||||
|
||||
impl Copy for i16x8 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
|
||||
|
||||
impl Copy for i32x4 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct i64x2(pub i64, pub i64);
|
||||
|
||||
impl Copy for i64x2 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
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,
|
||||
pub u8, pub u8, pub u8, pub u8);
|
||||
|
||||
impl Copy for u8x16 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
|
||||
pub u16, pub u16, pub u16, pub u16);
|
||||
|
||||
impl Copy for u16x8 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
|
||||
|
||||
impl Copy for u32x4 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct u64x2(pub u64, pub u64);
|
||||
|
||||
impl Copy for u64x2 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
|
||||
|
||||
impl Copy for f32x4 {}
|
||||
|
||||
#[experimental]
|
||||
#[simd]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
#[repr(C)]
|
||||
pub struct f64x2(pub f64, pub f64);
|
||||
|
||||
impl Copy for f64x2 {}
|
||||
|
||||
|
|
|
|||
|
|
@ -1229,7 +1229,7 @@ impl<'a, T> DoubleEndedIterator<&'a mut [T]> for MutChunks<'a, T> {
|
|||
/// index of the matching element. `NotFound` means the search
|
||||
/// succeeded, and the contained value is an index where a matching
|
||||
/// value could be inserted while maintaining sort order.
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
#[experimental = "needs review"]
|
||||
pub enum BinarySearchResult {
|
||||
/// The index of the found value.
|
||||
|
|
@ -1238,8 +1238,6 @@ pub enum BinarySearchResult {
|
|||
NotFound(uint)
|
||||
}
|
||||
|
||||
impl Copy for BinarySearchResult {}
|
||||
|
||||
#[experimental = "needs review"]
|
||||
impl BinarySearchResult {
|
||||
/// Converts a `Found` to `Some`, `NotFound` to `None`.
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ use default::Default;
|
|||
use iter::{Map, Iterator, IteratorExt, DoubleEndedIterator};
|
||||
use iter::{DoubleEndedIteratorExt, ExactSizeIterator};
|
||||
use iter::range;
|
||||
use kinds::{Copy, Sized};
|
||||
use kinds::Sized;
|
||||
use mem;
|
||||
use num::Int;
|
||||
use option::Option;
|
||||
|
|
@ -165,13 +165,11 @@ Section: Iterators
|
|||
/// Iterator for the char (representing *Unicode Scalar Values*) of a string
|
||||
///
|
||||
/// Created with the method `.chars()`.
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct Chars<'a> {
|
||||
iter: slice::Items<'a, u8>
|
||||
}
|
||||
|
||||
impl<'a> Copy for Chars<'a> {}
|
||||
|
||||
// Return the initial codepoint accumulator for the first byte.
|
||||
// The first byte is special, only want bottom 5 bits for width 2, 4 bits
|
||||
// for width 3, and 3 bits for width 4
|
||||
|
|
@ -998,7 +996,7 @@ pub struct Utf16Items<'a> {
|
|||
iter: slice::Items<'a, u16>
|
||||
}
|
||||
/// The possibilities for values decoded from a `u16` stream.
|
||||
#[deriving(PartialEq, Eq, Clone, Show)]
|
||||
#[deriving(Copy, PartialEq, Eq, Clone, Show)]
|
||||
pub enum Utf16Item {
|
||||
/// A valid codepoint.
|
||||
ScalarValue(char),
|
||||
|
|
@ -1006,8 +1004,6 @@ pub enum Utf16Item {
|
|||
LoneSurrogate(u16)
|
||||
}
|
||||
|
||||
impl Copy for Utf16Item {}
|
||||
|
||||
impl Utf16Item {
|
||||
/// Convert `self` to a `char`, taking `LoneSurrogate`s to the
|
||||
/// replacement character (U+FFFD).
|
||||
|
|
@ -1144,6 +1140,7 @@ pub fn utf8_char_width(b: u8) -> uint {
|
|||
/// 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.
|
||||
#[deriving(Copy)]
|
||||
pub struct CharRange {
|
||||
/// Current `char`
|
||||
pub ch: char,
|
||||
|
|
@ -1151,8 +1148,6 @@ pub struct CharRange {
|
|||
pub next: uint,
|
||||
}
|
||||
|
||||
impl Copy for CharRange {}
|
||||
|
||||
/// Mask of the value bits of a continuation byte
|
||||
const CONT_MASK: u8 = 0b0011_1111u8;
|
||||
/// Value of the tag bits (tag mask is !CONT_MASK) of a continuation byte
|
||||
|
|
|
|||
|
|
@ -35,7 +35,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.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum Piece<'a> {
|
||||
/// A literal string which should directly be emitted
|
||||
String(&'a str),
|
||||
|
|
@ -44,10 +44,8 @@ pub enum Piece<'a> {
|
|||
NextArgument(Argument<'a>),
|
||||
}
|
||||
|
||||
impl<'a> Copy for Piece<'a> {}
|
||||
|
||||
/// Representation of an argument specification.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub struct Argument<'a> {
|
||||
/// Where to find this argument
|
||||
pub position: Position<'a>,
|
||||
|
|
@ -55,10 +53,8 @@ pub struct Argument<'a> {
|
|||
pub format: FormatSpec<'a>,
|
||||
}
|
||||
|
||||
impl<'a> Copy for Argument<'a> {}
|
||||
|
||||
/// Specification for the formatting of an argument in the format string.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub struct FormatSpec<'a> {
|
||||
/// Optionally specified character to fill alignment with
|
||||
pub fill: Option<char>,
|
||||
|
|
@ -76,10 +72,8 @@ pub struct FormatSpec<'a> {
|
|||
pub ty: &'a str
|
||||
}
|
||||
|
||||
impl<'a> Copy for FormatSpec<'a> {}
|
||||
|
||||
/// Enum describing where an argument for a format can be located.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum Position<'a> {
|
||||
/// The argument will be in the next position. This is the default.
|
||||
ArgumentNext,
|
||||
|
|
@ -89,10 +83,8 @@ pub enum Position<'a> {
|
|||
ArgumentNamed(&'a str),
|
||||
}
|
||||
|
||||
impl<'a> Copy for Position<'a> {}
|
||||
|
||||
/// Enum of alignments which are supported.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum Alignment {
|
||||
/// The value will be aligned to the left.
|
||||
AlignLeft,
|
||||
|
|
@ -104,11 +96,9 @@ pub enum Alignment {
|
|||
AlignUnknown,
|
||||
}
|
||||
|
||||
impl Copy for Alignment {}
|
||||
|
||||
/// Various flags which can be applied to format strings. The meaning of these
|
||||
/// flags is defined by the formatters themselves.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum Flag {
|
||||
/// A `+` will be used to denote positive numbers.
|
||||
FlagSignPlus,
|
||||
|
|
@ -122,11 +112,9 @@ pub enum Flag {
|
|||
FlagSignAwareZeroPad,
|
||||
}
|
||||
|
||||
impl Copy for Flag {}
|
||||
|
||||
/// A count is used for the precision and width parameters of an integer, and
|
||||
/// can reference either an argument or a literal integer.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum Count<'a> {
|
||||
/// The count is specified explicitly.
|
||||
CountIs(uint),
|
||||
|
|
@ -140,8 +128,6 @@ pub enum Count<'a> {
|
|||
CountImplied,
|
||||
}
|
||||
|
||||
impl<'a> Copy for Count<'a> {}
|
||||
|
||||
/// The parser structure for interpreting the input format string. This is
|
||||
/// modelled as an iterator over `Piece` structures to form a stream of tokens
|
||||
/// being output.
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ pub enum Name {
|
|||
}
|
||||
|
||||
/// Describes whether an option has an argument.
|
||||
#[deriving(Clone, PartialEq, Eq)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum HasArg {
|
||||
/// The option requires an argument.
|
||||
Yes,
|
||||
|
|
@ -128,10 +128,8 @@ pub enum HasArg {
|
|||
Maybe,
|
||||
}
|
||||
|
||||
impl Copy for HasArg {}
|
||||
|
||||
/// Describes how often an option may occur.
|
||||
#[deriving(Clone, PartialEq, Eq)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum Occur {
|
||||
/// The option occurs once.
|
||||
Req,
|
||||
|
|
@ -141,8 +139,6 @@ pub enum Occur {
|
|||
Multi,
|
||||
}
|
||||
|
||||
impl Copy for Occur {}
|
||||
|
||||
/// A description of a possible option.
|
||||
#[deriving(Clone, PartialEq, Eq)]
|
||||
pub struct Opt {
|
||||
|
|
@ -211,7 +207,7 @@ pub enum Fail {
|
|||
}
|
||||
|
||||
/// The type of failure that occurred.
|
||||
#[deriving(PartialEq, Eq)]
|
||||
#[deriving(Copy, PartialEq, Eq)]
|
||||
#[allow(missing_docs)]
|
||||
pub enum FailType {
|
||||
ArgumentMissing_,
|
||||
|
|
@ -221,8 +217,6 @@ pub enum FailType {
|
|||
UnexpectedArgument_,
|
||||
}
|
||||
|
||||
impl Copy for FailType {}
|
||||
|
||||
/// The result of parsing a command line with a set of options.
|
||||
pub type Result = result::Result<Matches, Fail>;
|
||||
|
||||
|
|
@ -839,22 +833,22 @@ pub fn short_usage(program_name: &str, opts: &[OptGroup]) -> String {
|
|||
line
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum SplitWithinState {
|
||||
A, // leading whitespace, initial state
|
||||
B, // words
|
||||
C, // internal and trailing whitespace
|
||||
}
|
||||
impl Copy for SplitWithinState {}
|
||||
#[deriving(Copy)]
|
||||
enum Whitespace {
|
||||
Ws, // current char is whitespace
|
||||
Cr // current char is not whitespace
|
||||
}
|
||||
impl Copy for Whitespace {}
|
||||
#[deriving(Copy)]
|
||||
enum LengthLimit {
|
||||
UnderLim, // current char makes current substring still fit in limit
|
||||
OverLim // current char makes current substring no longer fit in limit
|
||||
}
|
||||
impl Copy for LengthLimit {}
|
||||
|
||||
|
||||
/// Splits a string into substrings with possibly internal whitespace,
|
||||
|
|
|
|||
|
|
@ -232,11 +232,9 @@ struct DefaultLogger {
|
|||
}
|
||||
|
||||
/// Wraps the log level with fmt implementations.
|
||||
#[deriving(PartialEq, PartialOrd)]
|
||||
#[deriving(Copy, PartialEq, PartialOrd)]
|
||||
pub struct LogLevel(pub u32);
|
||||
|
||||
impl Copy for LogLevel {}
|
||||
|
||||
impl fmt::Show for LogLevel {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
let LogLevel(level) = *self;
|
||||
|
|
@ -341,14 +339,13 @@ pub struct LogRecord<'a> {
|
|||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deriving(Copy)]
|
||||
pub struct LogLocation {
|
||||
pub module_path: &'static str,
|
||||
pub file: &'static str,
|
||||
pub line: uint,
|
||||
}
|
||||
|
||||
impl Copy for LogLocation {}
|
||||
|
||||
/// Tests whether a given module's name is enabled for a particular level of
|
||||
/// logging. This is the second layer of defense about determining whether a
|
||||
/// module's log statement should be emitted or not.
|
||||
|
|
|
|||
|
|
@ -29,14 +29,13 @@ const CHACHA_ROUNDS: uint = 20; // Cryptographically secure from 8 upwards as of
|
|||
/// [1]: D. J. Bernstein, [*ChaCha, a variant of
|
||||
/// Salsa20*](http://cr.yp.to/chacha.html)
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct ChaChaRng {
|
||||
buffer: [u32, ..STATE_WORDS], // Internal buffer of output
|
||||
state: [u32, ..STATE_WORDS], // Initial state
|
||||
index: uint, // Index into state
|
||||
}
|
||||
|
||||
impl Copy for ChaChaRng {}
|
||||
|
||||
static EMPTY: ChaChaRng = ChaChaRng {
|
||||
buffer: [0, ..STATE_WORDS],
|
||||
state: [0, ..STATE_WORDS],
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
//! The exponential distribution.
|
||||
|
||||
use core::kinds::Copy;
|
||||
use core::num::Float;
|
||||
|
||||
use {Rng, Rand};
|
||||
|
|
@ -30,10 +29,9 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
|
|||
/// Generate Normal Random
|
||||
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
|
||||
/// College, Oxford
|
||||
#[deriving(Copy)]
|
||||
pub struct Exp1(pub f64);
|
||||
|
||||
impl Copy for Exp1 {}
|
||||
|
||||
// This could be done via `-rng.gen::<f64>().ln()` but that is slower.
|
||||
impl Rand for Exp1 {
|
||||
#[inline]
|
||||
|
|
@ -69,13 +67,12 @@ impl Rand for Exp1 {
|
|||
/// let v = exp.ind_sample(&mut rand::task_rng());
|
||||
/// println!("{} is from a Exp(2) distribution", v);
|
||||
/// ```
|
||||
#[deriving(Copy)]
|
||||
pub struct Exp {
|
||||
/// `lambda` stored as `1/lambda`, since this is what we scale by.
|
||||
lambda_inverse: f64
|
||||
}
|
||||
|
||||
impl Copy for Exp {}
|
||||
|
||||
impl Exp {
|
||||
/// Construct a new `Exp` with the given shape parameter
|
||||
/// `lambda`. Panics if `lambda <= 0`.
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
|
||||
//! The normal and derived distributions.
|
||||
|
||||
use core::kinds::Copy;
|
||||
use core::num::Float;
|
||||
|
||||
use {Rng, Rand, Open01};
|
||||
|
|
@ -29,10 +28,9 @@ use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
|
|||
/// Generate Normal Random
|
||||
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
|
||||
/// College, Oxford
|
||||
#[deriving(Copy)]
|
||||
pub struct StandardNormal(pub f64);
|
||||
|
||||
impl Copy for StandardNormal {}
|
||||
|
||||
impl Rand for StandardNormal {
|
||||
fn rand<R:Rng>(rng: &mut R) -> StandardNormal {
|
||||
#[inline]
|
||||
|
|
@ -86,13 +84,12 @@ impl Rand for StandardNormal {
|
|||
/// let v = normal.ind_sample(&mut rand::task_rng());
|
||||
/// println!("{} is from a N(2, 9) distribution", v)
|
||||
/// ```
|
||||
#[deriving(Copy)]
|
||||
pub struct Normal {
|
||||
mean: f64,
|
||||
std_dev: f64,
|
||||
}
|
||||
|
||||
impl Copy for Normal {}
|
||||
|
||||
impl Normal {
|
||||
/// Construct a new `Normal` distribution with the given mean and
|
||||
/// standard deviation.
|
||||
|
|
@ -135,12 +132,11 @@ impl IndependentSample<f64> for Normal {
|
|||
/// let v = log_normal.ind_sample(&mut rand::task_rng());
|
||||
/// println!("{} is from an ln N(2, 9) distribution", v)
|
||||
/// ```
|
||||
#[deriving(Copy)]
|
||||
pub struct LogNormal {
|
||||
norm: Normal
|
||||
}
|
||||
|
||||
impl Copy for LogNormal {}
|
||||
|
||||
impl LogNormal {
|
||||
/// Construct a new `LogNormal` distribution with the given mean
|
||||
/// and standard deviation.
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ const RAND_SIZE_UINT: uint = 1 << (RAND_SIZE_LEN as uint);
|
|||
///
|
||||
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
|
||||
/// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
|
||||
#[deriving(Copy)]
|
||||
pub struct IsaacRng {
|
||||
cnt: u32,
|
||||
rsl: [u32, ..RAND_SIZE_UINT],
|
||||
|
|
@ -38,8 +39,6 @@ pub struct IsaacRng {
|
|||
c: u32
|
||||
}
|
||||
|
||||
impl Copy for IsaacRng {}
|
||||
|
||||
static EMPTY: IsaacRng = IsaacRng {
|
||||
cnt: 0,
|
||||
rsl: [0, ..RAND_SIZE_UINT],
|
||||
|
|
@ -265,6 +264,7 @@ const RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN;
|
|||
///
|
||||
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
|
||||
/// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
|
||||
#[deriving(Copy)]
|
||||
pub struct Isaac64Rng {
|
||||
cnt: uint,
|
||||
rsl: [u64, .. RAND_SIZE_64],
|
||||
|
|
@ -274,8 +274,6 @@ pub struct Isaac64Rng {
|
|||
c: u64,
|
||||
}
|
||||
|
||||
impl Copy for Isaac64Rng {}
|
||||
|
||||
static EMPTY_64: Isaac64Rng = Isaac64Rng {
|
||||
cnt: 0,
|
||||
rsl: [0, .. RAND_SIZE_64],
|
||||
|
|
|
|||
|
|
@ -501,6 +501,7 @@ pub struct Closed01<F>(pub F);
|
|||
#[cfg(not(test))]
|
||||
mod std {
|
||||
pub use core::{option, fmt}; // panic!()
|
||||
pub use core::kinds;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
|||
|
|
@ -133,10 +133,9 @@ 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.
|
||||
#[deriving(Copy)]
|
||||
pub struct ReseedWithDefault;
|
||||
|
||||
impl Copy for ReseedWithDefault {}
|
||||
|
||||
impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault {
|
||||
fn reseed(&mut self, rng: &mut R) {
|
||||
*rng = Default::default();
|
||||
|
|
|
|||
|
|
@ -41,15 +41,13 @@ use std::str;
|
|||
pub mod io;
|
||||
|
||||
/// Common data structures
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct Doc<'a> {
|
||||
pub data: &'a [u8],
|
||||
pub start: uint,
|
||||
pub end: uint,
|
||||
}
|
||||
|
||||
impl<'doc> Copy for Doc<'doc> {}
|
||||
|
||||
impl<'doc> Doc<'doc> {
|
||||
pub fn new(data: &'doc [u8]) -> Doc<'doc> {
|
||||
Doc { data: data, start: 0u, end: data.len() }
|
||||
|
|
@ -73,7 +71,7 @@ pub struct TaggedDoc<'a> {
|
|||
pub doc: Doc<'a>,
|
||||
}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum EbmlEncoderTag {
|
||||
EsUint, // 0
|
||||
EsU64, // 1
|
||||
|
|
@ -107,8 +105,6 @@ pub enum EbmlEncoderTag {
|
|||
EsLabel, // Used only when debugging
|
||||
}
|
||||
|
||||
impl Copy for EbmlEncoderTag {}
|
||||
|
||||
#[deriving(Show)]
|
||||
pub enum Error {
|
||||
IntTooBig(uint),
|
||||
|
|
@ -151,13 +147,12 @@ pub mod reader {
|
|||
)
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct Res {
|
||||
pub val: uint,
|
||||
pub next: uint
|
||||
}
|
||||
|
||||
impl Copy for Res {}
|
||||
|
||||
#[inline(never)]
|
||||
fn vuint_at_slow(data: &[u8], start: uint) -> DecodeResult<Res> {
|
||||
let a = data[start];
|
||||
|
|
|
|||
|
|
@ -77,14 +77,12 @@ pub enum Repeater {
|
|||
OneMore,
|
||||
}
|
||||
|
||||
#[deriving(Show, Clone)]
|
||||
#[deriving(Copy, Show, Clone)]
|
||||
pub enum Greed {
|
||||
Greedy,
|
||||
Ungreedy,
|
||||
}
|
||||
|
||||
impl Copy for Greed {}
|
||||
|
||||
impl Greed {
|
||||
pub fn is_greedy(&self) -> bool {
|
||||
match *self {
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ pub struct ExDynamic {
|
|||
}
|
||||
|
||||
#[doc(hidden)]
|
||||
#[deriving(Copy)]
|
||||
pub struct ExNative {
|
||||
#[doc(hidden)]
|
||||
pub original: &'static str,
|
||||
|
|
@ -135,8 +136,6 @@ pub struct ExNative {
|
|||
pub prog: fn(MatchKind, &str, uint, uint) -> Vec<Option<uint>>
|
||||
}
|
||||
|
||||
impl Copy for ExNative {}
|
||||
|
||||
impl Clone for ExNative {
|
||||
fn clone(&self) -> ExNative {
|
||||
*self
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ use unicode::regex::PERLW;
|
|||
pub type CaptureLocs = Vec<Option<uint>>;
|
||||
|
||||
/// Indicates the type of match to be performed by the VM.
|
||||
#[deriving(Copy)]
|
||||
pub enum MatchKind {
|
||||
/// Only checks if a match exists or not. Does not return location.
|
||||
Exists,
|
||||
|
|
@ -60,8 +61,6 @@ pub enum MatchKind {
|
|||
Submatches,
|
||||
}
|
||||
|
||||
impl Copy for MatchKind {}
|
||||
|
||||
/// Runs an NFA simulation on the compiled expression given on the search text
|
||||
/// `input`. The search begins at byte index `start` and ends at byte index
|
||||
/// `end`. (The range is specified here so that zero-width assertions will work
|
||||
|
|
@ -96,6 +95,7 @@ struct Nfa<'r, 't> {
|
|||
|
||||
/// Indicates the next action to take after a single non-empty instruction
|
||||
/// is processed.
|
||||
#[deriving(Copy)]
|
||||
pub enum StepState {
|
||||
/// This is returned if and only if a Match instruction is reached and
|
||||
/// we only care about the existence of a match. It instructs the VM to
|
||||
|
|
@ -109,8 +109,6 @@ pub enum StepState {
|
|||
StepContinue,
|
||||
}
|
||||
|
||||
impl Copy for StepState {}
|
||||
|
||||
impl<'r, 't> Nfa<'r, 't> {
|
||||
fn run(&mut self) -> CaptureLocs {
|
||||
let ncaps = match self.which {
|
||||
|
|
|
|||
|
|
@ -56,10 +56,9 @@ declare_lint! {
|
|||
"suggest using `loop { }` instead of `while true { }`"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct WhileTrue;
|
||||
|
||||
impl Copy for WhileTrue {}
|
||||
|
||||
impl LintPass for WhileTrue {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(WHILE_TRUE)
|
||||
|
|
@ -83,10 +82,9 @@ declare_lint! {
|
|||
"detects unnecessary type casts that can be removed"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedCasts;
|
||||
|
||||
impl Copy for UnusedCasts {}
|
||||
|
||||
impl LintPass for UnusedCasts {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(UNUSED_TYPECASTS)
|
||||
|
|
@ -126,13 +124,12 @@ declare_lint! {
|
|||
"shift exceeds the type's number of bits"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct TypeLimits {
|
||||
/// Id of the last visited negated expression
|
||||
negated_expr_id: ast::NodeId,
|
||||
}
|
||||
|
||||
impl Copy for TypeLimits {}
|
||||
|
||||
impl TypeLimits {
|
||||
pub fn new() -> TypeLimits {
|
||||
TypeLimits {
|
||||
|
|
@ -442,10 +439,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for ImproperCTypesVisitor<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct ImproperCTypes;
|
||||
|
||||
impl Copy for ImproperCTypes {}
|
||||
|
||||
impl LintPass for ImproperCTypes {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(IMPROPER_CTYPES)
|
||||
|
|
@ -486,10 +482,9 @@ declare_lint! {
|
|||
"use of owned (Box type) heap memory"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct BoxPointers;
|
||||
|
||||
impl Copy for BoxPointers {}
|
||||
|
||||
impl BoxPointers {
|
||||
fn check_heap_type<'a, 'tcx>(&self, cx: &Context<'a, 'tcx>,
|
||||
span: Span, ty: Ty<'tcx>) {
|
||||
|
|
@ -627,10 +622,9 @@ declare_lint! {
|
|||
"detects attributes that were not used by the compiler"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedAttributes;
|
||||
|
||||
impl Copy for UnusedAttributes {}
|
||||
|
||||
impl LintPass for UnusedAttributes {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(UNUSED_ATTRIBUTES)
|
||||
|
|
@ -711,10 +705,9 @@ declare_lint! {
|
|||
"path statements with no effect"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct PathStatements;
|
||||
|
||||
impl Copy for PathStatements {}
|
||||
|
||||
impl LintPass for PathStatements {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(PATH_STATEMENTS)
|
||||
|
|
@ -746,10 +739,9 @@ declare_lint! {
|
|||
"unused result of an expression in a statement"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedResults;
|
||||
|
||||
impl Copy for UnusedResults {}
|
||||
|
||||
impl LintPass for UnusedResults {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(UNUSED_MUST_USE, UNUSED_RESULTS)
|
||||
|
|
@ -815,10 +807,9 @@ declare_lint! {
|
|||
"types, variants, traits and type parameters should have camel case names"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct NonCamelCaseTypes;
|
||||
|
||||
impl Copy for NonCamelCaseTypes {}
|
||||
|
||||
impl NonCamelCaseTypes {
|
||||
fn check_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
|
||||
fn is_camel_case(ident: ast::Ident) -> bool {
|
||||
|
|
@ -939,10 +930,9 @@ declare_lint! {
|
|||
"methods, functions, lifetime parameters and modules should have snake case names"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct NonSnakeCase;
|
||||
|
||||
impl Copy for NonSnakeCase {}
|
||||
|
||||
impl NonSnakeCase {
|
||||
fn check_snake_case(&self, cx: &Context, sort: &str, ident: ast::Ident, span: Span) {
|
||||
fn is_snake_case(ident: ast::Ident) -> bool {
|
||||
|
|
@ -1053,10 +1043,9 @@ declare_lint! {
|
|||
"static constants should have uppercase identifiers"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct NonUpperCaseGlobals;
|
||||
|
||||
impl Copy for NonUpperCaseGlobals {}
|
||||
|
||||
impl LintPass for NonUpperCaseGlobals {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(NON_UPPER_CASE_GLOBALS)
|
||||
|
|
@ -1107,10 +1096,9 @@ declare_lint! {
|
|||
"`if`, `match`, `while` and `return` do not need parentheses"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedParens;
|
||||
|
||||
impl Copy for UnusedParens {}
|
||||
|
||||
impl UnusedParens {
|
||||
fn check_unused_parens_core(&self, cx: &Context, value: &ast::Expr, msg: &str,
|
||||
struct_lit_needs_parens: bool) {
|
||||
|
|
@ -1202,10 +1190,9 @@ declare_lint! {
|
|||
"unnecessary braces around an imported item"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedImportBraces;
|
||||
|
||||
impl Copy for UnusedImportBraces {}
|
||||
|
||||
impl LintPass for UnusedImportBraces {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(UNUSED_IMPORT_BRACES)
|
||||
|
|
@ -1242,10 +1229,9 @@ declare_lint! {
|
|||
"using `Struct { x: x }` instead of `Struct { x }`"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct NonShorthandFieldPatterns;
|
||||
|
||||
impl Copy for NonShorthandFieldPatterns {}
|
||||
|
||||
impl LintPass for NonShorthandFieldPatterns {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(NON_SHORTHAND_FIELD_PATTERNS)
|
||||
|
|
@ -1276,10 +1262,9 @@ declare_lint! {
|
|||
"unnecessary use of an `unsafe` block"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedUnsafe;
|
||||
|
||||
impl Copy for UnusedUnsafe {}
|
||||
|
||||
impl LintPass for UnusedUnsafe {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(UNUSED_UNSAFE)
|
||||
|
|
@ -1302,10 +1287,9 @@ declare_lint! {
|
|||
"usage of an `unsafe` block"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnsafeBlocks;
|
||||
|
||||
impl Copy for UnsafeBlocks {}
|
||||
|
||||
impl LintPass for UnsafeBlocks {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(UNSAFE_BLOCKS)
|
||||
|
|
@ -1327,10 +1311,9 @@ declare_lint! {
|
|||
"detect mut variables which don't need to be mutable"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedMut;
|
||||
|
||||
impl Copy for UnusedMut {}
|
||||
|
||||
impl UnusedMut {
|
||||
fn check_unused_mut_pat(&self, cx: &Context, pats: &[P<ast::Pat>]) {
|
||||
// collect all mutable pattern and group their NodeIDs by their Identifier to
|
||||
|
|
@ -1397,10 +1380,9 @@ declare_lint! {
|
|||
"detects unnecessary allocations that can be eliminated"
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnusedAllocation;
|
||||
|
||||
impl Copy for UnusedAllocation {}
|
||||
|
||||
impl LintPass for UnusedAllocation {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(UNUSED_ALLOCATION)
|
||||
|
|
@ -1589,10 +1571,9 @@ impl LintPass for MissingDoc {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct MissingCopyImplementations;
|
||||
|
||||
impl Copy for MissingCopyImplementations {}
|
||||
|
||||
impl LintPass for MissingCopyImplementations {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(MISSING_COPY_IMPLEMENTATIONS)
|
||||
|
|
@ -1665,10 +1646,9 @@ declare_lint! {
|
|||
|
||||
/// Checks for use of items with `#[deprecated]`, `#[experimental]` and
|
||||
/// `#[unstable]` attributes, or no stability attribute.
|
||||
#[deriving(Copy)]
|
||||
pub struct Stability;
|
||||
|
||||
impl Copy for Stability {}
|
||||
|
||||
impl Stability {
|
||||
fn lint(&self, cx: &Context, id: ast::DefId, span: Span) {
|
||||
let stability = stability::lookup(cx.tcx, id);
|
||||
|
|
@ -1903,10 +1883,9 @@ declare_lint!{
|
|||
|
||||
/// Does nothing as a lint pass, but registers some `Lint`s
|
||||
/// which are used by other parts of the compiler.
|
||||
#[deriving(Copy)]
|
||||
pub struct HardwiredLints;
|
||||
|
||||
impl Copy for HardwiredLints {}
|
||||
|
||||
impl LintPass for HardwiredLints {
|
||||
fn get_lints(&self) -> LintArray {
|
||||
lint_array!(
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ use syntax::ast;
|
|||
pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_attrs};
|
||||
|
||||
/// Specification of a single lint.
|
||||
#[deriving(Copy)]
|
||||
pub struct Lint {
|
||||
/// A string identifier for the lint.
|
||||
///
|
||||
|
|
@ -64,8 +65,6 @@ pub struct Lint {
|
|||
pub desc: &'static str,
|
||||
}
|
||||
|
||||
impl Copy for Lint {}
|
||||
|
||||
impl Lint {
|
||||
/// Get the lint's name, with ASCII letters converted to lowercase.
|
||||
pub fn name_lower(&self) -> String {
|
||||
|
|
@ -175,14 +174,12 @@ pub trait LintPass {
|
|||
pub type LintPassObject = Box<LintPass + 'static>;
|
||||
|
||||
/// Identifies a lint known to the compiler.
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct LintId {
|
||||
// Identity is based on pointer equality of this field.
|
||||
lint: &'static Lint,
|
||||
}
|
||||
|
||||
impl Copy for LintId {}
|
||||
|
||||
impl PartialEq for LintId {
|
||||
fn eq(&self, other: &LintId) -> bool {
|
||||
(self.lint as *const Lint) == (other.lint as *const Lint)
|
||||
|
|
@ -213,13 +210,11 @@ impl LintId {
|
|||
}
|
||||
|
||||
/// Setting for how to handle a lint.
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord)]
|
||||
pub enum Level {
|
||||
Allow, Warn, Deny, Forbid
|
||||
}
|
||||
|
||||
impl Copy for Level {}
|
||||
|
||||
impl Level {
|
||||
/// Convert a level to a lower-case string.
|
||||
pub fn as_str(self) -> &'static str {
|
||||
|
|
@ -244,7 +239,7 @@ impl Level {
|
|||
}
|
||||
|
||||
/// How a lint level was set.
|
||||
#[deriving(Clone, PartialEq, Eq)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq)]
|
||||
pub enum LintSource {
|
||||
/// Lint is at the default level as declared
|
||||
/// in rustc or a plugin.
|
||||
|
|
@ -257,8 +252,6 @@ pub enum LintSource {
|
|||
CommandLine,
|
||||
}
|
||||
|
||||
impl Copy for LintSource {}
|
||||
|
||||
pub type LevelSource = (Level, LintSource);
|
||||
|
||||
pub mod builtin;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ pub const tag_items_data_item_reexport_def_id: uint = 0x39;
|
|||
pub const tag_items_data_item_reexport_name: uint = 0x3a;
|
||||
|
||||
// used to encode crate_ctxt side tables
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
#[repr(uint)]
|
||||
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
|
||||
tag_ast = 0x40,
|
||||
|
|
@ -145,7 +145,6 @@ pub enum astencode_tag { // Reserves 0x40 -- 0x5f
|
|||
tag_table_object_cast_map = 0x57,
|
||||
}
|
||||
|
||||
impl Copy for astencode_tag {}
|
||||
static first_astencode_tag: uint = tag_ast as uint;
|
||||
static last_astencode_tag: uint = tag_table_object_cast_map as uint;
|
||||
impl astencode_tag {
|
||||
|
|
|
|||
|
|
@ -33,14 +33,13 @@ use syntax::parse::token;
|
|||
|
||||
use std::collections::hash_map::HashMap;
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct MethodInfo {
|
||||
pub name: ast::Name,
|
||||
pub def_id: ast::DefId,
|
||||
pub vis: ast::Visibility,
|
||||
}
|
||||
|
||||
impl Copy for MethodInfo {}
|
||||
|
||||
pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> String {
|
||||
let cdata = cstore.get_crate_data(def.krate);
|
||||
decoder::get_symbol(cdata.data(), def.node)
|
||||
|
|
|
|||
|
|
@ -48,23 +48,19 @@ pub struct crate_metadata {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
#[deriving(Show, PartialEq, Clone)]
|
||||
#[deriving(Copy, Show, PartialEq, Clone)]
|
||||
pub enum LinkagePreference {
|
||||
RequireDynamic,
|
||||
RequireStatic,
|
||||
}
|
||||
|
||||
impl Copy for LinkagePreference {}
|
||||
|
||||
#[deriving(Clone, PartialEq, FromPrimitive)]
|
||||
#[deriving(Copy, Clone, PartialEq, FromPrimitive)]
|
||||
pub enum NativeLibraryKind {
|
||||
NativeStatic, // native static library (.a archive)
|
||||
NativeFramework, // OSX-specific
|
||||
NativeUnknown, // default way to specify a dynamic library
|
||||
}
|
||||
|
||||
impl Copy for NativeLibraryKind {}
|
||||
|
||||
// Where a crate came from on the local filesystem. One of these two options
|
||||
// must be non-None.
|
||||
#[deriving(PartialEq, Clone)]
|
||||
|
|
|
|||
|
|
@ -450,15 +450,13 @@ pub fn get_symbol(data: &[u8], id: ast::NodeId) -> String {
|
|||
}
|
||||
|
||||
// Something that a name can resolve to.
|
||||
#[deriving(Clone,Show)]
|
||||
#[deriving(Copy, Clone, Show)]
|
||||
pub enum DefLike {
|
||||
DlDef(def::Def),
|
||||
DlImpl(ast::DefId),
|
||||
DlField
|
||||
}
|
||||
|
||||
impl Copy for DefLike {}
|
||||
|
||||
/// Iterates over the language items in the given crate.
|
||||
pub fn each_lang_item<F>(cdata: Cmd, mut f: F) -> bool where
|
||||
F: FnMut(ast::NodeId, uint) -> bool,
|
||||
|
|
|
|||
|
|
@ -20,13 +20,12 @@ use std::os;
|
|||
|
||||
use util::fs as myfs;
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum FileMatch {
|
||||
FileMatches,
|
||||
FileDoesntMatch,
|
||||
}
|
||||
|
||||
impl Copy for FileMatch {}
|
||||
|
||||
// A module for searching for libraries
|
||||
// FIXME (#2658): I'm not happy how this module turned out. Should
|
||||
// probably just be folded into cstore.
|
||||
|
|
|
|||
|
|
@ -44,7 +44,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.
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum DefIdSource {
|
||||
// Identifies a struct, trait, enum, etc.
|
||||
NominalType,
|
||||
|
|
@ -62,7 +62,6 @@ pub enum DefIdSource {
|
|||
UnboxedClosureSource
|
||||
}
|
||||
|
||||
impl Copy for DefIdSource {}
|
||||
pub type conv_did<'a> =
|
||||
|source: DefIdSource, ast::DefId|: 'a -> ast::DefId;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,14 +26,13 @@ struct CFGBuilder<'a, 'tcx: 'a> {
|
|||
loop_scopes: Vec<LoopScope>,
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
struct LoopScope {
|
||||
loop_id: ast::NodeId, // id of loop/while node
|
||||
continue_index: CFGIndex, // where to go on a `loop`
|
||||
break_index: CFGIndex, // where to go on a `break
|
||||
}
|
||||
|
||||
impl Copy for LoopScope {}
|
||||
|
||||
pub fn construct(tcx: &ty::ctxt,
|
||||
blk: &ast::Block) -> CFG {
|
||||
let mut graph = graph::Graph::new();
|
||||
|
|
|
|||
|
|
@ -26,12 +26,11 @@ pub struct CFG {
|
|||
pub exit: CFGIndex,
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct CFGNodeData {
|
||||
pub id: ast::NodeId
|
||||
}
|
||||
|
||||
impl Copy for CFGNodeData {}
|
||||
|
||||
pub struct CFGEdgeData {
|
||||
pub exiting_scopes: Vec<ast::NodeId>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,20 +16,17 @@ use syntax::codemap::Span;
|
|||
use syntax::visit::Visitor;
|
||||
use syntax::visit;
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
enum Context {
|
||||
Normal, Loop, Closure
|
||||
}
|
||||
|
||||
impl Copy for Context {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
struct CheckLoopVisitor<'a> {
|
||||
sess: &'a Session,
|
||||
cx: Context
|
||||
}
|
||||
|
||||
impl<'a> Copy for CheckLoopVisitor<'a> {}
|
||||
|
||||
pub fn check_crate(sess: &Session, krate: &ast::Crate) {
|
||||
visit::walk_crate(&mut CheckLoopVisitor { sess: sess, cx: Normal }, krate)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,13 +127,12 @@ enum Usefulness {
|
|||
NotUseful
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum WitnessPreference {
|
||||
ConstructWitness,
|
||||
LeaveOutWitness
|
||||
}
|
||||
|
||||
impl Copy for WitnessPreference {}
|
||||
|
||||
impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &ast::Expr) {
|
||||
check_expr(self, ex);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ use syntax::visit::Visitor;
|
|||
use syntax::codemap::Span;
|
||||
use syntax::visit;
|
||||
|
||||
#[deriving(Eq, PartialEq)]
|
||||
#[deriving(Copy, Eq, PartialEq)]
|
||||
enum Mode {
|
||||
InConstant,
|
||||
InStatic,
|
||||
|
|
@ -47,8 +47,6 @@ enum Mode {
|
|||
InNothing,
|
||||
}
|
||||
|
||||
impl Copy for Mode {}
|
||||
|
||||
struct CheckStaticVisitor<'a, 'tcx: 'a> {
|
||||
tcx: &'a ty::ctxt<'tcx>,
|
||||
mode: Mode,
|
||||
|
|
|
|||
|
|
@ -62,14 +62,13 @@ use std::collections::hash_map::Vacant;
|
|||
// - Non-constants: everything else.
|
||||
//
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum constness {
|
||||
integral_const,
|
||||
general_const,
|
||||
non_const
|
||||
}
|
||||
|
||||
impl Copy for constness {}
|
||||
|
||||
type constness_cache = DefIdMap<constness>;
|
||||
|
||||
pub fn join(a: constness, b: constness) -> constness {
|
||||
|
|
|
|||
|
|
@ -27,14 +27,12 @@ use syntax::visit;
|
|||
use syntax::print::{pp, pprust};
|
||||
use util::nodemap::NodeMap;
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum EntryOrExit {
|
||||
Entry,
|
||||
Exit,
|
||||
}
|
||||
|
||||
impl Copy for EntryOrExit {}
|
||||
|
||||
#[deriving(Clone)]
|
||||
pub struct DataFlowContext<'a, 'tcx: 'a, O> {
|
||||
tcx: &'a ty::ctxt<'tcx>,
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ use middle::subst::ParamSpace;
|
|||
use syntax::ast;
|
||||
use syntax::ast_util::local_def;
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
pub enum Def {
|
||||
DefFn(ast::DefId, bool /* is_ctor */),
|
||||
DefStaticMethod(/* method */ ast::DefId, MethodProvenance),
|
||||
|
|
@ -56,15 +56,13 @@ pub enum Def {
|
|||
DefMethod(ast::DefId /* method */, Option<ast::DefId> /* trait */, MethodProvenance),
|
||||
}
|
||||
|
||||
impl Copy for Def {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
pub enum MethodProvenance {
|
||||
FromTrait(ast::DefId),
|
||||
FromImpl(ast::DefId),
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
|
||||
pub enum TyParamProvenance {
|
||||
FromSelf(ast::DefId),
|
||||
FromParam(ast::DefId),
|
||||
|
|
@ -81,8 +79,6 @@ impl MethodProvenance {
|
|||
}
|
||||
}
|
||||
|
||||
impl Copy for MethodProvenance {}
|
||||
|
||||
impl TyParamProvenance {
|
||||
pub fn def_id(&self) -> ast::DefId {
|
||||
match *self {
|
||||
|
|
@ -92,8 +88,6 @@ impl TyParamProvenance {
|
|||
}
|
||||
}
|
||||
|
||||
impl Copy for TyParamProvenance {}
|
||||
|
||||
impl Def {
|
||||
pub fn def_id(&self) -> ast::DefId {
|
||||
match *self {
|
||||
|
|
|
|||
|
|
@ -23,15 +23,13 @@ use syntax::codemap::Span;
|
|||
use syntax::visit;
|
||||
use syntax::visit::Visitor;
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
enum UnsafeContext {
|
||||
SafeContext,
|
||||
UnsafeFn,
|
||||
UnsafeBlock(ast::NodeId),
|
||||
}
|
||||
|
||||
impl Copy for UnsafeContext {}
|
||||
|
||||
fn type_is_unsafe_function(ty: Ty) -> bool {
|
||||
match ty.sty {
|
||||
ty::ty_bare_fn(ref f) => f.unsafety == ast::Unsafety::Unsafe,
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ pub trait Delegate<'tcx> {
|
|||
mode: MutateMode);
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum LoanCause {
|
||||
ClosureCapture(Span),
|
||||
AddrOf,
|
||||
|
|
@ -107,26 +107,20 @@ pub enum LoanCause {
|
|||
MatchDiscriminant
|
||||
}
|
||||
|
||||
impl kinds::Copy for LoanCause {}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
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
|
||||
}
|
||||
|
||||
impl kinds::Copy for ConsumeMode {}
|
||||
|
||||
#[deriving(PartialEq,Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum MoveReason {
|
||||
DirectRefMove,
|
||||
PatBindingMove,
|
||||
CaptureMove,
|
||||
}
|
||||
|
||||
impl kinds::Copy for MoveReason {}
|
||||
|
||||
#[deriving(PartialEq,Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum MatchMode {
|
||||
NonBindingMatch,
|
||||
BorrowingMatch,
|
||||
|
|
@ -134,8 +128,6 @@ pub enum MatchMode {
|
|||
MovingMatch,
|
||||
}
|
||||
|
||||
impl kinds::Copy for MatchMode {}
|
||||
|
||||
#[deriving(PartialEq,Show)]
|
||||
enum TrackMatchMode<T> {
|
||||
Unknown,
|
||||
|
|
@ -205,23 +197,20 @@ impl<T> TrackMatchMode<T> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq,Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum MutateMode {
|
||||
Init,
|
||||
JustWrite, // x = y
|
||||
WriteAndRead, // x += y
|
||||
}
|
||||
|
||||
impl kinds::Copy for MutateMode {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum OverloadedCallType {
|
||||
FnOverloadedCall,
|
||||
FnMutOverloadedCall,
|
||||
FnOnceOverloadedCall,
|
||||
}
|
||||
|
||||
impl kinds::Copy for OverloadedCallType {}
|
||||
|
||||
impl OverloadedCallType {
|
||||
fn from_trait_id(tcx: &ty::ctxt, trait_id: ast::DefId)
|
||||
-> OverloadedCallType {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use syntax::ast;
|
|||
use self::SimplifiedType::*;
|
||||
|
||||
/// See `simplify_type
|
||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum SimplifiedType {
|
||||
BoolSimplifiedType,
|
||||
CharSimplifiedType,
|
||||
|
|
@ -33,8 +33,6 @@ pub enum SimplifiedType {
|
|||
ParameterSimplifiedType,
|
||||
}
|
||||
|
||||
impl Copy for SimplifiedType {}
|
||||
|
||||
/// Tries to simplify a type by dropping type parameters, deref'ing away any reference types, etc.
|
||||
/// The idea is to get something simple that we can use to quickly decide if two types could unify
|
||||
/// during method lookup.
|
||||
|
|
|
|||
|
|
@ -60,30 +60,24 @@ impl<E: Show> Show for Edge<E> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||
pub struct NodeIndex(pub uint);
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
|
||||
|
||||
impl Copy for NodeIndex {}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub struct EdgeIndex(pub uint);
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
|
||||
|
||||
impl Copy for EdgeIndex {}
|
||||
|
||||
// Use a private field here to guarantee no more instances are created:
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub struct Direction { repr: uint }
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const Outgoing: Direction = Direction { repr: 0 };
|
||||
#[allow(non_upper_case_globals)]
|
||||
pub const Incoming: Direction = Direction { repr: 1 };
|
||||
|
||||
impl Copy for Direction {}
|
||||
|
||||
impl NodeIndex {
|
||||
fn get(&self) -> uint { let NodeIndex(v) = *self; v }
|
||||
/// Returns unique id (unique with respect to the graph holding associated node).
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ pub type SkolemizationMap = FnvHashMap<ty::BoundRegion,ty::Region>;
|
|||
/// Why did we require that the two types be related?
|
||||
///
|
||||
/// See `error_reporting.rs` for more details
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub enum TypeOrigin {
|
||||
// Not yet categorized in a better way
|
||||
Misc(Span),
|
||||
|
|
@ -131,8 +131,6 @@ pub enum TypeOrigin {
|
|||
EquatePredicate(Span),
|
||||
}
|
||||
|
||||
impl Copy for TypeOrigin {}
|
||||
|
||||
/// See `error_reporting.rs` for more details
|
||||
#[deriving(Clone, Show)]
|
||||
pub enum ValuePairs<'tcx> {
|
||||
|
|
@ -223,7 +221,7 @@ pub enum SubregionOrigin<'tcx> {
|
|||
}
|
||||
|
||||
/// Times when we replace late-bound regions with variables:
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub enum LateBoundRegionConversionTime {
|
||||
/// when a fn is called
|
||||
FnCall,
|
||||
|
|
@ -232,8 +230,6 @@ pub enum LateBoundRegionConversionTime {
|
|||
HigherRankedType,
|
||||
}
|
||||
|
||||
impl Copy for LateBoundRegionConversionTime {}
|
||||
|
||||
/// Reasons to create a region inference variable
|
||||
///
|
||||
/// See `error_reporting.rs` for more details
|
||||
|
|
@ -270,15 +266,13 @@ pub enum RegionVariableOrigin<'tcx> {
|
|||
BoundRegionInCoherence(ast::Name),
|
||||
}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum fixup_err {
|
||||
unresolved_int_ty(IntVid),
|
||||
unresolved_float_ty(FloatVid),
|
||||
unresolved_ty(TyVid)
|
||||
}
|
||||
|
||||
impl Copy for fixup_err {}
|
||||
|
||||
pub fn fixup_err_to_string(f: fixup_err) -> String {
|
||||
match f {
|
||||
unresolved_int_ty(_) => {
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ mod doc;
|
|||
mod graphviz;
|
||||
|
||||
// A constraint that influences the inference process.
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum Constraint {
|
||||
// One region variable is subregion of another
|
||||
ConstrainVarSubVar(RegionVid, RegionVid),
|
||||
|
|
@ -52,8 +52,6 @@ pub enum Constraint {
|
|||
ConstrainVarSubReg(RegionVid, Region),
|
||||
}
|
||||
|
||||
impl Copy for Constraint {}
|
||||
|
||||
// Something we have to verify after region inference is done, but
|
||||
// which does not directly influence the inference process
|
||||
pub enum Verify<'tcx> {
|
||||
|
|
@ -69,15 +67,13 @@ pub enum Verify<'tcx> {
|
|||
VerifyParamBound(ty::ParamTy, SubregionOrigin<'tcx>, Region, Vec<Region>),
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Eq, Hash)]
|
||||
#[deriving(Copy, PartialEq, Eq, Hash)]
|
||||
pub struct TwoRegions {
|
||||
a: Region,
|
||||
b: Region,
|
||||
}
|
||||
|
||||
impl Copy for TwoRegions {}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum UndoLogEntry {
|
||||
OpenSnapshot,
|
||||
CommitedSnapshot,
|
||||
|
|
@ -88,15 +84,11 @@ pub enum UndoLogEntry {
|
|||
AddCombination(CombineMapType, TwoRegions)
|
||||
}
|
||||
|
||||
impl Copy for UndoLogEntry {}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum CombineMapType {
|
||||
Lub, Glb
|
||||
}
|
||||
|
||||
impl Copy for CombineMapType {}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
pub enum RegionResolutionError<'tcx> {
|
||||
/// `ConcreteFailure(o, a, b)`:
|
||||
|
|
@ -940,15 +932,12 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> {
|
|||
|
||||
// ______________________________________________________________________
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
enum Classification { Expanding, Contracting }
|
||||
|
||||
impl Copy for Classification {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum VarValue { NoValue, Value(Region), ErrorValue }
|
||||
|
||||
impl Copy for VarValue {}
|
||||
|
||||
struct VarData {
|
||||
classification: Classification,
|
||||
value: VarValue,
|
||||
|
|
|
|||
|
|
@ -46,13 +46,11 @@ struct Delegate;
|
|||
|
||||
type Relation = (RelationDir, ty::TyVid);
|
||||
|
||||
#[deriving(PartialEq,Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum RelationDir {
|
||||
SubtypeOf, SupertypeOf, EqTo
|
||||
}
|
||||
|
||||
impl Copy for RelationDir {}
|
||||
|
||||
impl RelationDir {
|
||||
fn opposite(self) -> RelationDir {
|
||||
match self {
|
||||
|
|
|
|||
|
|
@ -90,10 +90,9 @@ pub struct Node<K,V> {
|
|||
pub rank: uint,
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct Delegate;
|
||||
|
||||
impl Copy for Delegate {}
|
||||
|
||||
// We can't use V:LatticeValue, much as I would like to,
|
||||
// because frequently the pattern is that V=Option<U> for some
|
||||
// other type parameter U, and we have no way to say
|
||||
|
|
|
|||
|
|
@ -45,13 +45,11 @@ macro_rules! lets_do_this {
|
|||
$( $variant:ident, $name:expr, $method:ident; )*
|
||||
) => {
|
||||
|
||||
#[deriving(FromPrimitive, PartialEq, Eq, Hash)]
|
||||
#[deriving(Copy, FromPrimitive, PartialEq, Eq, Hash)]
|
||||
pub enum LangItem {
|
||||
$($variant),*
|
||||
}
|
||||
|
||||
impl Copy for LangItem {}
|
||||
|
||||
pub struct LanguageItems {
|
||||
pub items: Vec<Option<ast::DefId>>,
|
||||
pub missing: Vec<LangItem>,
|
||||
|
|
|
|||
|
|
@ -135,16 +135,12 @@ enum LoopKind<'a> {
|
|||
ForLoop(&'a ast::Pat),
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
struct Variable(uint);
|
||||
|
||||
impl Copy for Variable {}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
struct LiveNode(uint);
|
||||
|
||||
impl Copy for LiveNode {}
|
||||
|
||||
impl Variable {
|
||||
fn get(&self) -> uint { let Variable(v) = *self; v }
|
||||
}
|
||||
|
|
@ -159,7 +155,7 @@ impl Clone for LiveNode {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
enum LiveNodeKind {
|
||||
FreeVarNode(Span),
|
||||
ExprNode(Span),
|
||||
|
|
@ -167,8 +163,6 @@ enum LiveNodeKind {
|
|||
ExitNode
|
||||
}
|
||||
|
||||
impl Copy for LiveNodeKind {}
|
||||
|
||||
fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
|
||||
let cm = cx.sess.codemap();
|
||||
match lnk {
|
||||
|
|
@ -247,15 +241,13 @@ struct CaptureInfo {
|
|||
var_nid: NodeId
|
||||
}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
struct LocalInfo {
|
||||
id: NodeId,
|
||||
ident: ast::Ident
|
||||
}
|
||||
|
||||
impl Copy for LocalInfo {}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
enum VarKind {
|
||||
Arg(NodeId, ast::Ident),
|
||||
Local(LocalInfo),
|
||||
|
|
@ -263,8 +255,6 @@ enum VarKind {
|
|||
CleanExit
|
||||
}
|
||||
|
||||
impl Copy for VarKind {}
|
||||
|
||||
struct IrMaps<'a, 'tcx: 'a> {
|
||||
tcx: &'a ty::ctxt<'tcx>,
|
||||
|
||||
|
|
@ -536,15 +526,13 @@ fn visit_expr(ir: &mut IrMaps, expr: &Expr) {
|
|||
// Actually we compute just a bit more than just liveness, but we use
|
||||
// the same basic propagation framework in all cases.
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
struct Users {
|
||||
reader: LiveNode,
|
||||
writer: LiveNode,
|
||||
used: bool
|
||||
}
|
||||
|
||||
impl Copy for Users {}
|
||||
|
||||
fn invalid_users() -> Users {
|
||||
Users {
|
||||
reader: invalid_node(),
|
||||
|
|
@ -553,6 +541,7 @@ fn invalid_users() -> Users {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
struct Specials {
|
||||
exit_ln: LiveNode,
|
||||
fallthrough_ln: LiveNode,
|
||||
|
|
@ -560,8 +549,6 @@ struct Specials {
|
|||
clean_exit_var: Variable
|
||||
}
|
||||
|
||||
impl Copy for Specials {}
|
||||
|
||||
static ACC_READ: uint = 1u;
|
||||
static ACC_WRITE: uint = 2u;
|
||||
static ACC_USE: uint = 4u;
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ pub enum categorization<'tcx> {
|
|||
}
|
||||
|
||||
// Represents any kind of upvar
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||
pub struct Upvar {
|
||||
pub id: ty::UpvarId,
|
||||
// Unboxed closure kinds are used even for old-style closures for simplicity
|
||||
|
|
@ -110,10 +110,8 @@ pub struct Upvar {
|
|||
pub is_unboxed: bool
|
||||
}
|
||||
|
||||
impl Copy for Upvar {}
|
||||
|
||||
// different kinds of pointers:
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum PointerKind {
|
||||
OwnedPtr,
|
||||
BorrowedPtr(ty::BorrowKind, ty::Region),
|
||||
|
|
@ -121,57 +119,45 @@ pub enum PointerKind {
|
|||
UnsafePtr(ast::Mutability)
|
||||
}
|
||||
|
||||
impl Copy for PointerKind {}
|
||||
|
||||
// We use the term "interior" to mean "something reachable from the
|
||||
// base without a pointer dereference", e.g. a field
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum InteriorKind {
|
||||
InteriorField(FieldName),
|
||||
InteriorElement(ElementKind),
|
||||
}
|
||||
|
||||
impl Copy for InteriorKind {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum FieldName {
|
||||
NamedField(ast::Name),
|
||||
PositionalField(uint)
|
||||
}
|
||||
|
||||
impl Copy for FieldName {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum ElementKind {
|
||||
VecElement,
|
||||
OtherElement,
|
||||
}
|
||||
|
||||
impl Copy for ElementKind {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum MutabilityCategory {
|
||||
McImmutable, // Immutable.
|
||||
McDeclared, // Directly declared as mutable.
|
||||
McInherited, // Inherited from the fact that owner is mutable.
|
||||
}
|
||||
|
||||
impl Copy for MutabilityCategory {}
|
||||
|
||||
// A note about the provenance of a `cmt`. This is used for
|
||||
// special-case handling of upvars such as mutability inference.
|
||||
// Upvar categorization can generate a variable number of nested
|
||||
// derefs. The note allows detecting them without deep pattern
|
||||
// matching on the categorization.
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||
pub enum Note {
|
||||
NoteClosureEnv(ty::UpvarId), // Deref through closure env
|
||||
NoteUpvarRef(ty::UpvarId), // Deref through by-ref upvar
|
||||
NoteNone // Nothing special
|
||||
}
|
||||
|
||||
impl Copy for Note {}
|
||||
|
||||
// `cmt`: "Category, Mutability, and Type".
|
||||
//
|
||||
// a complete categorization of a value indicating where it originated
|
||||
|
|
@ -200,13 +186,12 @@ 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:
|
||||
#[deriving(Copy)]
|
||||
pub enum deref_kind {
|
||||
deref_ptr(PointerKind),
|
||||
deref_interior(InteriorKind),
|
||||
}
|
||||
|
||||
impl Copy for deref_kind {}
|
||||
|
||||
// Categorizes a derefable type. Note that we include vectors and strings as
|
||||
// derefable (we model an index as the combination of a deref and then a
|
||||
// pointer adjustment).
|
||||
|
|
@ -1394,13 +1379,13 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum InteriorSafety {
|
||||
InteriorUnsafe,
|
||||
InteriorSafe
|
||||
}
|
||||
|
||||
impl Copy for InteriorSafety {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum AliasableReason {
|
||||
AliasableBorrowed,
|
||||
AliasableClosure(ast::NodeId), // Aliasable due to capture Fn closure env
|
||||
|
|
@ -1409,8 +1394,6 @@ pub enum AliasableReason {
|
|||
AliasableStaticMut(InteriorSafety),
|
||||
}
|
||||
|
||||
impl Copy for AliasableReason {}
|
||||
|
||||
impl<'tcx> cmt_<'tcx> {
|
||||
pub fn guarantor(&self) -> cmt<'tcx> {
|
||||
//! Returns `self` after stripping away any owned pointer derefs or
|
||||
|
|
|
|||
|
|
@ -36,13 +36,11 @@ use syntax::visit::{Visitor, FnKind};
|
|||
/// placate the same deriving in `ty::FreeRegion`, but we may want to
|
||||
/// actually attach a more meaningful ordering to scopes than the one
|
||||
/// generated via deriving here.
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||
pub enum CodeExtent {
|
||||
Misc(ast::NodeId)
|
||||
}
|
||||
|
||||
impl Copy for CodeExtent {}
|
||||
|
||||
impl CodeExtent {
|
||||
/// Creates a scope that represents the dynamic extent associated
|
||||
/// with `node_id`.
|
||||
|
|
@ -117,6 +115,7 @@ pub struct RegionMaps {
|
|||
terminating_scopes: RefCell<FnvHashSet<CodeExtent>>,
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct Context {
|
||||
var_parent: Option<ast::NodeId>,
|
||||
|
||||
|
|
@ -124,8 +123,6 @@ pub struct Context {
|
|||
parent: Option<ast::NodeId>,
|
||||
}
|
||||
|
||||
impl Copy for Context {}
|
||||
|
||||
struct RegionResolutionVisitor<'a> {
|
||||
sess: &'a Session,
|
||||
|
||||
|
|
|
|||
|
|
@ -89,13 +89,12 @@ use std::uint;
|
|||
// Definition mapping
|
||||
pub type DefMap = RefCell<NodeMap<Def>>;
|
||||
|
||||
#[deriving(Copy)]
|
||||
struct binding_info {
|
||||
span: Span,
|
||||
binding_mode: BindingMode,
|
||||
}
|
||||
|
||||
impl Copy for binding_info {}
|
||||
|
||||
// Map from the name in a pattern to its binding mode.
|
||||
type BindingMap = HashMap<Name,binding_info>;
|
||||
|
||||
|
|
@ -118,7 +117,7 @@ pub type ExternalExports = DefIdSet;
|
|||
// FIXME: dox
|
||||
pub type LastPrivateMap = NodeMap<LastPrivate>;
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum LastPrivate {
|
||||
LastMod(PrivateDep),
|
||||
// `use` directives (imports) can refer to two separate definitions in the
|
||||
|
|
@ -132,25 +131,19 @@ pub enum LastPrivate {
|
|||
type_used: ImportUse},
|
||||
}
|
||||
|
||||
impl Copy for LastPrivate {}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum PrivateDep {
|
||||
AllPublic,
|
||||
DependsOn(DefId),
|
||||
}
|
||||
|
||||
impl Copy for PrivateDep {}
|
||||
|
||||
// How an import is used.
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum ImportUse {
|
||||
Unused, // The import is not used.
|
||||
Used, // The import is used.
|
||||
}
|
||||
|
||||
impl Copy for ImportUse {}
|
||||
|
||||
impl LastPrivate {
|
||||
fn or(self, other: LastPrivate) -> LastPrivate {
|
||||
match (self, other) {
|
||||
|
|
@ -160,24 +153,20 @@ impl LastPrivate {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
enum PatternBindingMode {
|
||||
RefutableMode,
|
||||
LocalIrrefutableMode,
|
||||
ArgumentIrrefutableMode,
|
||||
}
|
||||
|
||||
impl Copy for PatternBindingMode {}
|
||||
|
||||
#[deriving(PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Copy, PartialEq, Eq, Hash, Show)]
|
||||
enum Namespace {
|
||||
TypeNS,
|
||||
ValueNS
|
||||
}
|
||||
|
||||
impl Copy for Namespace {}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
enum NamespaceError {
|
||||
NoError,
|
||||
ModuleError,
|
||||
|
|
@ -185,8 +174,6 @@ enum NamespaceError {
|
|||
ValueError
|
||||
}
|
||||
|
||||
impl Copy for NamespaceError {}
|
||||
|
||||
/// A NamespaceResult represents the result of resolving an import in
|
||||
/// a particular namespace. The result is either definitely-resolved,
|
||||
/// definitely- unresolved, or unknown.
|
||||
|
|
@ -247,13 +234,12 @@ impl<'a, 'v> Visitor<'v> for Resolver<'a> {
|
|||
}
|
||||
|
||||
/// Contains data for specific types of import directives.
|
||||
#[deriving(Copy)]
|
||||
enum ImportDirectiveSubclass {
|
||||
SingleImport(Name /* target */, Name /* source */),
|
||||
GlobImport
|
||||
}
|
||||
|
||||
impl Copy for ImportDirectiveSubclass {}
|
||||
|
||||
/// The context that we thread through while building the reduced graph.
|
||||
#[deriving(Clone)]
|
||||
enum ReducedGraphParent {
|
||||
|
|
@ -293,6 +279,7 @@ enum FallbackSuggestion {
|
|||
TraitMethod(String),
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum TypeParameters<'a> {
|
||||
NoTypeParameters,
|
||||
HasTypeParameters(
|
||||
|
|
@ -310,11 +297,9 @@ enum TypeParameters<'a> {
|
|||
RibKind)
|
||||
}
|
||||
|
||||
impl<'a> Copy for TypeParameters<'a> {}
|
||||
|
||||
// The rib kind controls the translation of local
|
||||
// definitions (`DefLocal`) to upvars (`DefUpvar`).
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
enum RibKind {
|
||||
// No translation needs to be applied.
|
||||
NormalRibKind,
|
||||
|
|
@ -337,38 +322,31 @@ enum RibKind {
|
|||
ConstantItemRibKind
|
||||
}
|
||||
|
||||
impl Copy for RibKind {}
|
||||
|
||||
// Methods can be required or provided. RequiredMethod methods only occur in traits.
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
enum MethodSort {
|
||||
RequiredMethod,
|
||||
ProvidedMethod(NodeId)
|
||||
}
|
||||
|
||||
impl Copy for MethodSort {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum UseLexicalScopeFlag {
|
||||
DontUseLexicalScope,
|
||||
UseLexicalScope
|
||||
}
|
||||
|
||||
impl Copy for UseLexicalScopeFlag {}
|
||||
|
||||
enum ModulePrefixResult {
|
||||
NoPrefixFound,
|
||||
PrefixFound(Rc<Module>, uint)
|
||||
}
|
||||
|
||||
#[deriving(Clone, Eq, PartialEq)]
|
||||
#[deriving(Clone, Copy, Eq, PartialEq)]
|
||||
pub enum TraitItemKind {
|
||||
NonstaticMethodTraitItemKind,
|
||||
StaticMethodTraitItemKind,
|
||||
TypeTraitItemKind,
|
||||
}
|
||||
|
||||
impl Copy for TraitItemKind {}
|
||||
|
||||
impl TraitItemKind {
|
||||
pub fn from_explicit_self_category(explicit_self_category:
|
||||
ExplicitSelfCategory)
|
||||
|
|
@ -381,7 +359,7 @@ impl TraitItemKind {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
enum NameSearchType {
|
||||
/// We're doing a name search in order to resolve a `use` directive.
|
||||
ImportSearch,
|
||||
|
|
@ -391,19 +369,16 @@ enum NameSearchType {
|
|||
PathSearch,
|
||||
}
|
||||
|
||||
impl Copy for NameSearchType {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum BareIdentifierPatternResolution {
|
||||
FoundStructOrEnumVariant(Def, LastPrivate),
|
||||
FoundConst(Def, LastPrivate),
|
||||
BareIdentifierPatternUnresolved
|
||||
}
|
||||
|
||||
impl Copy for BareIdentifierPatternResolution {}
|
||||
|
||||
// Specifies how duplicates should be handled when adding a child item if
|
||||
// another item exists with the same name in some namespace.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
enum DuplicateCheckingMode {
|
||||
ForbidDuplicateModules,
|
||||
ForbidDuplicateTypesAndModules,
|
||||
|
|
@ -412,8 +387,6 @@ enum DuplicateCheckingMode {
|
|||
OverwriteDuplicates
|
||||
}
|
||||
|
||||
impl Copy for DuplicateCheckingMode {}
|
||||
|
||||
/// One local scope.
|
||||
#[deriving(Show)]
|
||||
struct Rib {
|
||||
|
|
@ -543,7 +516,7 @@ enum ParentLink {
|
|||
}
|
||||
|
||||
/// The type of module this is.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
enum ModuleKind {
|
||||
NormalModuleKind,
|
||||
TraitModuleKind,
|
||||
|
|
@ -552,8 +525,6 @@ enum ModuleKind {
|
|||
AnonymousModuleKind,
|
||||
}
|
||||
|
||||
impl Copy for ModuleKind {}
|
||||
|
||||
/// One node in the tree of modules.
|
||||
struct Module {
|
||||
parent_link: ParentLink,
|
||||
|
|
@ -645,15 +616,13 @@ struct TypeNsDef {
|
|||
}
|
||||
|
||||
// Records a possibly-private value definition.
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
struct ValueNsDef {
|
||||
modifiers: DefModifiers, // see note in ImportResolution about how to use this
|
||||
def: Def,
|
||||
value_span: Option<Span>,
|
||||
}
|
||||
|
||||
impl Copy for ValueNsDef {}
|
||||
|
||||
// Records the definitions (at most one for each namespace) that a name is
|
||||
// bound to.
|
||||
struct NameBindings {
|
||||
|
|
@ -662,6 +631,7 @@ struct NameBindings {
|
|||
}
|
||||
|
||||
/// Ways in which a trait can be referenced
|
||||
#[deriving(Copy)]
|
||||
enum TraitReferenceType {
|
||||
TraitImplementation, // impl SomeTrait for T { ... }
|
||||
TraitDerivation, // trait T : SomeTrait { ... }
|
||||
|
|
@ -670,8 +640,6 @@ enum TraitReferenceType {
|
|||
TraitQPath, // <T as SomeTrait>::
|
||||
}
|
||||
|
||||
impl Copy for TraitReferenceType {}
|
||||
|
||||
impl NameBindings {
|
||||
fn new() -> NameBindings {
|
||||
NameBindings {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ use syntax::visit;
|
|||
use syntax::visit::Visitor;
|
||||
use util::nodemap::NodeMap;
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
pub enum DefRegion {
|
||||
DefStaticRegion,
|
||||
DefEarlyBoundRegion(/* space */ subst::ParamSpace,
|
||||
|
|
@ -46,8 +46,6 @@ pub enum DefRegion {
|
|||
/* lifetime decl */ ast::NodeId),
|
||||
}
|
||||
|
||||
impl Copy for DefRegion {}
|
||||
|
||||
// maps the id of each lifetime reference to the lifetime decl
|
||||
// that it corresponds to
|
||||
pub type NamedRegionMap = NodeMap<DefRegion>;
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ impl RegionSubsts {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// ParamSpace
|
||||
|
||||
#[deriving(PartialOrd, Ord, PartialEq, Eq,
|
||||
#[deriving(Copy, PartialOrd, Ord, PartialEq, Eq,
|
||||
Clone, Hash, Encodable, Decodable, Show)]
|
||||
pub enum ParamSpace {
|
||||
TypeSpace, // Type parameters attached to a type definition, trait, or impl
|
||||
|
|
@ -196,8 +196,6 @@ pub enum ParamSpace {
|
|||
FnSpace, // Type parameters attached to a method or fn
|
||||
}
|
||||
|
||||
impl Copy for ParamSpace {}
|
||||
|
||||
impl ParamSpace {
|
||||
pub fn all() -> [ParamSpace, ..4] {
|
||||
[TypeSpace, SelfSpace, AssocSpace, FnSpace]
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ pub enum MethodMatchResult {
|
|||
MethodDidNotMatch,
|
||||
}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
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.
|
||||
|
|
@ -102,8 +102,6 @@ pub enum MethodMatchedData {
|
|||
CoerciveMethodMatch(/* impl we matched */ ast::DefId)
|
||||
}
|
||||
|
||||
impl Copy for MethodMatchedData {}
|
||||
|
||||
/// The selection process begins by considering all impls, where
|
||||
/// clauses, and so forth that might resolve an obligation. Sometimes
|
||||
/// we'll be able to say definitively that (e.g.) an impl does not
|
||||
|
|
|
|||
|
|
@ -107,22 +107,18 @@ pub struct CrateAnalysis<'tcx> {
|
|||
pub name: String,
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Eq, Hash)]
|
||||
#[deriving(Copy, PartialEq, Eq, Hash)]
|
||||
pub struct field<'tcx> {
|
||||
pub name: ast::Name,
|
||||
pub mt: mt<'tcx>
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for field<'tcx> {}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub enum ImplOrTraitItemContainer {
|
||||
TraitContainer(ast::DefId),
|
||||
ImplContainer(ast::DefId),
|
||||
}
|
||||
|
||||
impl Copy for ImplOrTraitItemContainer {}
|
||||
|
||||
impl ImplOrTraitItemContainer {
|
||||
pub fn id(&self) -> ast::DefId {
|
||||
match *self {
|
||||
|
|
@ -177,14 +173,12 @@ impl<'tcx> ImplOrTraitItem<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub enum ImplOrTraitItemId {
|
||||
MethodTraitItemId(ast::DefId),
|
||||
TypeTraitItemId(ast::DefId),
|
||||
}
|
||||
|
||||
impl Copy for ImplOrTraitItemId {}
|
||||
|
||||
impl ImplOrTraitItemId {
|
||||
pub fn def_id(&self) -> ast::DefId {
|
||||
match *self {
|
||||
|
|
@ -238,7 +232,7 @@ impl<'tcx> Method<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct AssociatedType {
|
||||
pub name: ast::Name,
|
||||
pub vis: ast::Visibility,
|
||||
|
|
@ -246,17 +240,13 @@ pub struct AssociatedType {
|
|||
pub container: ImplOrTraitItemContainer,
|
||||
}
|
||||
|
||||
impl Copy for AssociatedType {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub struct mt<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
pub mutbl: ast::Mutability,
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for mt<'tcx> {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
pub enum TraitStore {
|
||||
/// Box<Trait>
|
||||
UniqTraitStore,
|
||||
|
|
@ -264,9 +254,7 @@ pub enum TraitStore {
|
|||
RegionTraitStore(Region, ast::Mutability),
|
||||
}
|
||||
|
||||
impl Copy for TraitStore {}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub struct field_ty {
|
||||
pub name: Name,
|
||||
pub id: DefId,
|
||||
|
|
@ -274,33 +262,28 @@ pub struct field_ty {
|
|||
pub origin: ast::DefId, // The DefId of the struct in which the field is declared.
|
||||
}
|
||||
|
||||
impl Copy for field_ty {}
|
||||
|
||||
// Contains information needed to resolve types and (in the future) look up
|
||||
// the types of AST nodes.
|
||||
#[deriving(PartialEq, Eq, Hash)]
|
||||
#[deriving(Copy, PartialEq, Eq, Hash)]
|
||||
pub struct creader_cache_key {
|
||||
pub cnum: CrateNum,
|
||||
pub pos: uint,
|
||||
pub len: uint
|
||||
}
|
||||
|
||||
impl Copy for creader_cache_key {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum ast_ty_to_ty_cache_entry<'tcx> {
|
||||
atttce_unresolved, /* not resolved yet */
|
||||
atttce_resolved(Ty<'tcx>) /* resolved to a type, irrespective of region */
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for ast_ty_to_ty_cache_entry<'tcx> {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Decodable, Encodable)]
|
||||
pub struct ItemVariances {
|
||||
pub types: VecPerParamSpace<Variance>,
|
||||
pub regions: VecPerParamSpace<Variance>,
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Decodable, Encodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Decodable, Encodable, Show)]
|
||||
pub enum Variance {
|
||||
Covariant, // T<A> <: T<B> iff A <: B -- e.g., function return type
|
||||
Invariant, // T<A> <: T<B> iff B == A -- e.g., type of mutable cell
|
||||
|
|
@ -308,8 +291,6 @@ pub enum Variance {
|
|||
Bivariant, // T<A> <: T<B> -- e.g., unused type parameter
|
||||
}
|
||||
|
||||
impl Copy for Variance {}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
pub enum AutoAdjustment<'tcx> {
|
||||
AdjustAddEnv(ty::TraitStore),
|
||||
|
|
@ -449,14 +430,12 @@ pub fn type_of_adjust<'tcx>(cx: &ctxt<'tcx>, adj: &AutoAdjustment<'tcx>) -> Opti
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, Encodable, Decodable, PartialEq, PartialOrd, Show)]
|
||||
#[deriving(Clone, Copy, Encodable, Decodable, PartialEq, PartialOrd, Show)]
|
||||
pub struct param_index {
|
||||
pub space: subst::ParamSpace,
|
||||
pub index: uint
|
||||
}
|
||||
|
||||
impl Copy for param_index {}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
pub enum MethodOrigin<'tcx> {
|
||||
// fully statically resolved method
|
||||
|
|
@ -513,8 +492,6 @@ pub struct MethodCallee<'tcx> {
|
|||
pub substs: subst::Substs<'tcx>
|
||||
}
|
||||
|
||||
impl Copy for MethodCall {}
|
||||
|
||||
/// With method calls, we store some extra information in
|
||||
/// side tables (i.e method_map). We use
|
||||
/// MethodCall as a key to index into these tables instead of
|
||||
|
|
@ -527,21 +504,19 @@ impl Copy for MethodCall {}
|
|||
/// needed to add to the side tables. Thus to disambiguate
|
||||
/// we also keep track of whether there's an adjustment in
|
||||
/// our key.
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub struct MethodCall {
|
||||
pub expr_id: ast::NodeId,
|
||||
pub adjustment: ExprAdjustment
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
||||
pub enum ExprAdjustment {
|
||||
NoAdjustment,
|
||||
AutoDeref(uint),
|
||||
AutoObject
|
||||
}
|
||||
|
||||
impl Copy for ExprAdjustment {}
|
||||
|
||||
impl MethodCall {
|
||||
pub fn expr(id: ast::NodeId) -> MethodCall {
|
||||
MethodCall {
|
||||
|
|
@ -615,6 +590,7 @@ pub type ObjectCastMap<'tcx> = RefCell<NodeMap<Rc<ty::PolyTraitRef<'tcx>>>>;
|
|||
|
||||
/// A restriction that certain types must be the same size. The use of
|
||||
/// `transmute` gives rise to these restrictions.
|
||||
#[deriving(Copy)]
|
||||
pub struct TransmuteRestriction<'tcx> {
|
||||
/// The span from whence the restriction comes.
|
||||
pub span: Span,
|
||||
|
|
@ -626,8 +602,6 @@ pub struct TransmuteRestriction<'tcx> {
|
|||
pub id: ast::NodeId,
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for TransmuteRestriction<'tcx> {}
|
||||
|
||||
/// The data structure to keep track of all the information that typechecker
|
||||
/// generates so that so that it can be reused and doesn't have to be redone
|
||||
/// later on.
|
||||
|
|
@ -923,7 +897,7 @@ pub struct ClosureTy<'tcx> {
|
|||
pub abi: abi::Abi,
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum FnOutput<'tcx> {
|
||||
FnConverging(Ty<'tcx>),
|
||||
FnDiverging
|
||||
|
|
@ -938,8 +912,6 @@ impl<'tcx> FnOutput<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for FnOutput<'tcx> {}
|
||||
|
||||
/// Signature of a function type, which I have arbitrarily
|
||||
/// decided to use to refer to the input/output types.
|
||||
///
|
||||
|
|
@ -955,15 +927,13 @@ pub struct FnSig<'tcx> {
|
|||
|
||||
pub type PolyFnSig<'tcx> = Binder<FnSig<'tcx>>;
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub struct ParamTy {
|
||||
pub space: subst::ParamSpace,
|
||||
pub idx: uint,
|
||||
pub def_id: DefId
|
||||
}
|
||||
|
||||
impl Copy for ParamTy {}
|
||||
|
||||
/// A [De Bruijn index][dbi] is a standard means of representing
|
||||
/// regions (and perhaps later types) in a higher-ranked setting. In
|
||||
/// particular, imagine a type like this:
|
||||
|
|
@ -1003,7 +973,7 @@ impl Copy for ParamTy {}
|
|||
/// is the outer fn.
|
||||
///
|
||||
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
pub struct DebruijnIndex {
|
||||
// We maintain the invariant that this is never 0. So 1 indicates
|
||||
// the innermost binder. To ensure this, create with `DebruijnIndex::new`.
|
||||
|
|
@ -1011,7 +981,7 @@ pub struct DebruijnIndex {
|
|||
}
|
||||
|
||||
/// Representation of regions:
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Encodable, Decodable, Show)]
|
||||
pub enum Region {
|
||||
// Region bound in a type or fn declaration which will be
|
||||
// substituted 'early' -- that is, at the same time when type
|
||||
|
|
@ -1052,15 +1022,13 @@ pub enum Region {
|
|||
/// Upvars do not get their own node-id. Instead, we use the pair of
|
||||
/// the original var id (that is, the root variable that is referenced
|
||||
/// by the upvar) and the id of the closure expression.
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub struct UpvarId {
|
||||
pub var_id: ast::NodeId,
|
||||
pub closure_expr_id: ast::NodeId,
|
||||
}
|
||||
|
||||
impl Copy for UpvarId {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show, Encodable, Decodable)]
|
||||
pub enum BorrowKind {
|
||||
/// Data must be immutable and is aliasable.
|
||||
ImmBorrow,
|
||||
|
|
@ -1106,8 +1074,6 @@ pub enum BorrowKind {
|
|||
MutBorrow
|
||||
}
|
||||
|
||||
impl Copy for BorrowKind {}
|
||||
|
||||
/// Information describing the borrowing of an upvar. This is computed
|
||||
/// during `typeck`, specifically by `regionck`. The general idea is
|
||||
/// that the compiler analyses treat closures like:
|
||||
|
|
@ -1155,7 +1121,7 @@ impl Copy for BorrowKind {}
|
|||
/// - Through mutation, the borrowed upvars can actually escape
|
||||
/// the closure, so sometimes it is necessary for them to be larger
|
||||
/// than the closure lifetime itself.
|
||||
#[deriving(PartialEq, Clone, Encodable, Decodable, Show)]
|
||||
#[deriving(Copy, PartialEq, Clone, Encodable, Decodable, Show)]
|
||||
pub struct UpvarBorrow {
|
||||
pub kind: BorrowKind,
|
||||
pub region: ty::Region,
|
||||
|
|
@ -1163,8 +1129,6 @@ pub struct UpvarBorrow {
|
|||
|
||||
pub type UpvarBorrowMap = FnvHashMap<UpvarId, UpvarBorrow>;
|
||||
|
||||
impl Copy for UpvarBorrow {}
|
||||
|
||||
impl Region {
|
||||
pub fn is_bound(&self) -> bool {
|
||||
match *self {
|
||||
|
|
@ -1182,9 +1146,7 @@ impl Region {
|
|||
}
|
||||
}
|
||||
|
||||
impl Copy for Region {}
|
||||
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||
/// A "free" region `fr` can be interpreted as "some region
|
||||
/// at least as big as the scope `fr.scope`".
|
||||
pub struct FreeRegion {
|
||||
|
|
@ -1192,9 +1154,7 @@ pub struct FreeRegion {
|
|||
pub bound_region: BoundRegion
|
||||
}
|
||||
|
||||
impl Copy for FreeRegion {}
|
||||
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash, Encodable, Decodable, Show)]
|
||||
pub enum BoundRegion {
|
||||
/// An anonymous region parameter for a given fn (&T)
|
||||
BrAnon(uint),
|
||||
|
|
@ -1213,8 +1173,6 @@ pub enum BoundRegion {
|
|||
BrEnv
|
||||
}
|
||||
|
||||
impl Copy for BoundRegion {}
|
||||
|
||||
#[inline]
|
||||
pub fn mk_prim_t<'tcx>(primitive: &'tcx TyS<'static>) -> Ty<'tcx> {
|
||||
// FIXME(#17596) Ty<'tcx> is incorrectly invariant w.r.t 'tcx.
|
||||
|
|
@ -1378,15 +1336,13 @@ impl<'tcx> PolyTraitRef<'tcx> {
|
|||
#[deriving(Clone, PartialEq, Eq, Hash, Show)]
|
||||
pub struct Binder<T>(pub T);
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
pub enum IntVarValue {
|
||||
IntType(ast::IntTy),
|
||||
UintType(ast::UintTy),
|
||||
}
|
||||
|
||||
impl Copy for IntVarValue {}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub enum terr_vstore_kind {
|
||||
terr_vec,
|
||||
terr_str,
|
||||
|
|
@ -1394,18 +1350,14 @@ pub enum terr_vstore_kind {
|
|||
terr_trait
|
||||
}
|
||||
|
||||
impl Copy for terr_vstore_kind {}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub struct expected_found<T> {
|
||||
pub expected: T,
|
||||
pub found: T
|
||||
}
|
||||
|
||||
impl<T:Copy> Copy for expected_found<T> {}
|
||||
|
||||
// Data structures used in type unification
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub enum type_err<'tcx> {
|
||||
terr_mismatch,
|
||||
terr_unsafety_mismatch(expected_found<ast::Unsafety>),
|
||||
|
|
@ -1438,8 +1390,6 @@ pub enum type_err<'tcx> {
|
|||
terr_convergence_mismatch(expected_found<bool>)
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for type_err<'tcx> {}
|
||||
|
||||
/// Bounds suitable for a named type parameter like `A` in `fn foo<A>`
|
||||
/// as well as the existential type parameter in an object type.
|
||||
#[deriving(PartialEq, Eq, Hash, Clone, Show)]
|
||||
|
|
@ -1454,17 +1404,15 @@ pub struct ParamBounds<'tcx> {
|
|||
/// major difference between this case and `ParamBounds` is that
|
||||
/// general purpose trait bounds are omitted and there must be
|
||||
/// *exactly one* region.
|
||||
#[deriving(PartialEq, Eq, Hash, Clone, Show)]
|
||||
#[deriving(Copy, PartialEq, Eq, Hash, Clone, Show)]
|
||||
pub struct ExistentialBounds {
|
||||
pub region_bound: ty::Region,
|
||||
pub builtin_bounds: BuiltinBounds
|
||||
}
|
||||
|
||||
impl Copy for ExistentialBounds {}
|
||||
|
||||
pub type BuiltinBounds = EnumSet<BuiltinBound>;
|
||||
|
||||
#[deriving(Clone, Encodable, PartialEq, Eq, Decodable, Hash, Show)]
|
||||
#[deriving(Copy, Clone, Encodable, PartialEq, Eq, Decodable, Hash, Show)]
|
||||
#[repr(uint)]
|
||||
pub enum BuiltinBound {
|
||||
BoundSend,
|
||||
|
|
@ -1473,8 +1421,6 @@ pub enum BuiltinBound {
|
|||
BoundSync,
|
||||
}
|
||||
|
||||
impl Copy for BuiltinBound {}
|
||||
|
||||
pub fn empty_builtin_bounds() -> BuiltinBounds {
|
||||
EnumSet::new()
|
||||
}
|
||||
|
|
@ -1502,35 +1448,27 @@ impl CLike for BuiltinBound {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct TyVid {
|
||||
pub index: uint
|
||||
}
|
||||
|
||||
impl Copy for TyVid {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct IntVid {
|
||||
pub index: uint
|
||||
}
|
||||
|
||||
impl Copy for IntVid {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct FloatVid {
|
||||
pub index: uint
|
||||
}
|
||||
|
||||
impl Copy for FloatVid {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
|
||||
pub struct RegionVid {
|
||||
pub index: uint
|
||||
}
|
||||
|
||||
impl Copy for RegionVid {}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Hash)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum InferTy {
|
||||
TyVar(TyVid),
|
||||
IntVar(IntVid),
|
||||
|
|
@ -1547,16 +1485,12 @@ pub enum InferTy {
|
|||
FreshIntTy(uint),
|
||||
}
|
||||
|
||||
impl Copy for InferTy {}
|
||||
|
||||
#[deriving(Clone, Encodable, Decodable, Eq, Hash, Show)]
|
||||
#[deriving(Clone, Copy, Encodable, Decodable, Eq, Hash, Show)]
|
||||
pub enum InferRegion {
|
||||
ReVar(RegionVid),
|
||||
ReSkolemized(uint, BoundRegion)
|
||||
}
|
||||
|
||||
impl Copy for InferRegion {}
|
||||
|
||||
impl cmp::PartialEq for InferRegion {
|
||||
fn eq(&self, other: &InferRegion) -> bool {
|
||||
match ((*self), *other) {
|
||||
|
|
@ -2006,15 +1940,13 @@ pub struct UnboxedClosure<'tcx> {
|
|||
pub kind: UnboxedClosureKind,
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq, Eq, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Eq, Show)]
|
||||
pub enum UnboxedClosureKind {
|
||||
FnUnboxedClosureKind,
|
||||
FnMutUnboxedClosureKind,
|
||||
FnOnceUnboxedClosureKind,
|
||||
}
|
||||
|
||||
impl Copy for UnboxedClosureKind {}
|
||||
|
||||
impl UnboxedClosureKind {
|
||||
pub fn trait_did(&self, cx: &ctxt) -> ast::DefId {
|
||||
let result = match *self {
|
||||
|
|
@ -2795,13 +2727,11 @@ pub fn type_needs_unwind_cleanup<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> bool {
|
|||
/// The reason we compute type contents and not kinds is that it is
|
||||
/// easier for me (nmatsakis) to think about what is contained within
|
||||
/// a type than to think about what is *not* contained within a type.
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct TypeContents {
|
||||
pub bits: u64
|
||||
}
|
||||
|
||||
impl Copy for TypeContents {}
|
||||
|
||||
macro_rules! def_type_content_sets {
|
||||
(mod $mname:ident { $($name:ident = $bits:expr),+ }) => {
|
||||
#[allow(non_snake_case)]
|
||||
|
|
@ -3443,15 +3373,13 @@ 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.
|
||||
#[deriving(PartialOrd, Ord, Eq, PartialEq, Show)]
|
||||
#[deriving(Copy, PartialOrd, Ord, Eq, PartialEq, Show)]
|
||||
pub enum Representability {
|
||||
Representable,
|
||||
ContainsRecursive,
|
||||
SelfRecursive,
|
||||
}
|
||||
|
||||
impl Copy for Representability {}
|
||||
|
||||
/// Check whether a type is representable. This means it cannot contain unboxed
|
||||
/// structural recursion. This check is needed for structs and enums.
|
||||
pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
|
||||
|
|
@ -4228,6 +4156,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.
|
||||
#[deriving(Copy)]
|
||||
pub enum ExprKind {
|
||||
LvalueExpr,
|
||||
RvalueDpsExpr,
|
||||
|
|
@ -4235,8 +4164,6 @@ pub enum ExprKind {
|
|||
RvalueStmtExpr
|
||||
}
|
||||
|
||||
impl Copy for ExprKind {}
|
||||
|
||||
pub fn expr_kind(tcx: &ctxt, expr: &ast::Expr) -> ExprKind {
|
||||
if tcx.method_map.borrow().contains_key(&MethodCall::expr(expr.id)) {
|
||||
// Overloaded operations are generally calls, and hence they are
|
||||
|
|
@ -4791,15 +4718,13 @@ pub fn associated_type_parameter_index(cx: &ctxt,
|
|||
cx.sess.bug("couldn't find associated type parameter index")
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Eq)]
|
||||
#[deriving(Copy, PartialEq, Eq)]
|
||||
pub struct AssociatedTypeInfo {
|
||||
pub def_id: ast::DefId,
|
||||
pub index: uint,
|
||||
pub name: ast::Name,
|
||||
}
|
||||
|
||||
impl Copy for AssociatedTypeInfo {}
|
||||
|
||||
impl PartialOrd for AssociatedTypeInfo {
|
||||
fn partial_cmp(&self, other: &AssociatedTypeInfo) -> Option<Ordering> {
|
||||
Some(self.index.cmp(&other.index))
|
||||
|
|
@ -4979,13 +4904,12 @@ pub fn item_path_str(cx: &ctxt, id: ast::DefId) -> String {
|
|||
with_path(cx, id, |path| ast_map::path_to_string(path)).to_string()
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum DtorKind {
|
||||
NoDtor,
|
||||
TraitDtor(DefId, bool)
|
||||
}
|
||||
|
||||
impl Copy for DtorKind {}
|
||||
|
||||
impl DtorKind {
|
||||
pub fn is_present(&self) -> bool {
|
||||
match *self {
|
||||
|
|
@ -5403,14 +5327,13 @@ pub fn tup_fields<'tcx>(v: &[Ty<'tcx>]) -> Vec<field<'tcx>> {
|
|||
}).collect()
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct UnboxedClosureUpvar<'tcx> {
|
||||
pub def: def::Def,
|
||||
pub span: Span,
|
||||
pub ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for UnboxedClosureUpvar<'tcx> {}
|
||||
|
||||
// Returns a list of `UnboxedClosureUpvar`s for each upvar.
|
||||
pub fn unboxed_closure_upvars<'tcx>(tcx: &ctxt<'tcx>, closure_id: ast::DefId, substs: &Substs<'tcx>)
|
||||
-> Vec<UnboxedClosureUpvar<'tcx>> {
|
||||
|
|
@ -6259,7 +6182,7 @@ impl<'tcx> mc::Typer<'tcx> for ty::ctxt<'tcx> {
|
|||
}
|
||||
|
||||
/// The category of explicit self.
|
||||
#[deriving(Clone, Eq, PartialEq, Show)]
|
||||
#[deriving(Clone, Copy, Eq, PartialEq, Show)]
|
||||
pub enum ExplicitSelfCategory {
|
||||
StaticExplicitSelfCategory,
|
||||
ByValueExplicitSelfCategory,
|
||||
|
|
@ -6267,8 +6190,6 @@ pub enum ExplicitSelfCategory {
|
|||
ByBoxExplicitSelfCategory,
|
||||
}
|
||||
|
||||
impl Copy for ExplicitSelfCategory {}
|
||||
|
||||
/// Pushes all the lifetimes in the given type onto the given list. A
|
||||
/// "lifetime in a type" is a lifetime specified by a reference or a lifetime
|
||||
/// in a list of type substitutions. This does *not* traverse into nominal
|
||||
|
|
@ -6329,7 +6250,7 @@ pub fn accumulate_lifetimes_in_type(accumulator: &mut Vec<ty::Region>,
|
|||
}
|
||||
|
||||
/// A free variable referred to in a function.
|
||||
#[deriving(Encodable, Decodable)]
|
||||
#[deriving(Copy, Encodable, Decodable)]
|
||||
pub struct Freevar {
|
||||
/// The variable being accessed free.
|
||||
pub def: def::Def,
|
||||
|
|
@ -6338,8 +6259,6 @@ pub struct Freevar {
|
|||
pub span: Span
|
||||
}
|
||||
|
||||
impl Copy for Freevar {}
|
||||
|
||||
pub type FreevarMap = NodeMap<Vec<Freevar>>;
|
||||
|
||||
pub type CaptureModeMap = NodeMap<ast::CaptureClause>;
|
||||
|
|
@ -6469,8 +6388,6 @@ impl DebruijnIndex {
|
|||
}
|
||||
}
|
||||
|
||||
impl Copy for DebruijnIndex {}
|
||||
|
||||
impl<'tcx> Repr<'tcx> for AutoAdjustment<'tcx> {
|
||||
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
|
||||
match *self {
|
||||
|
|
@ -6589,14 +6506,13 @@ pub fn make_substs_for_receiver_types<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
trait_ref.substs.clone().with_method(meth_tps, meth_regions)
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum CopyImplementationError {
|
||||
FieldDoesNotImplementCopy(ast::Name),
|
||||
VariantDoesNotImplementCopy(ast::Name),
|
||||
TypeIsStructural,
|
||||
}
|
||||
|
||||
impl Copy for CopyImplementationError {}
|
||||
|
||||
pub fn can_type_implement_copy<'tcx>(tcx: &ctxt<'tcx>,
|
||||
self_type: Ty<'tcx>,
|
||||
param_env: &ParameterEnvironment<'tcx>)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ pub struct Config {
|
|||
pub uint_type: UintTy,
|
||||
}
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
pub enum OptLevel {
|
||||
No, // -O0
|
||||
Less, // -O1
|
||||
|
|
@ -55,18 +55,14 @@ pub enum OptLevel {
|
|||
Aggressive // -O3
|
||||
}
|
||||
|
||||
impl Copy for OptLevel {}
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
pub enum DebugInfoLevel {
|
||||
NoDebugInfo,
|
||||
LimitedDebugInfo,
|
||||
FullDebugInfo,
|
||||
}
|
||||
|
||||
impl Copy for DebugInfoLevel {}
|
||||
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
|
||||
pub enum OutputType {
|
||||
OutputTypeBitcode,
|
||||
OutputTypeAssembly,
|
||||
|
|
@ -75,8 +71,6 @@ pub enum OutputType {
|
|||
OutputTypeExe,
|
||||
}
|
||||
|
||||
impl Copy for OutputType {}
|
||||
|
||||
#[deriving(Clone)]
|
||||
pub struct Options {
|
||||
// The crate config requested for the session, which may be combined
|
||||
|
|
@ -220,16 +214,14 @@ pub fn basic_options() -> Options {
|
|||
// users can have their own entry
|
||||
// functions that don't start a
|
||||
// scheduler
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum EntryFnType {
|
||||
EntryMain,
|
||||
EntryStart,
|
||||
EntryNone,
|
||||
}
|
||||
|
||||
impl Copy for EntryFnType {}
|
||||
|
||||
#[deriving(PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
|
||||
#[deriving(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
|
||||
pub enum CrateType {
|
||||
CrateTypeExecutable,
|
||||
CrateTypeDylib,
|
||||
|
|
@ -237,8 +229,6 @@ pub enum CrateType {
|
|||
CrateTypeStaticlib,
|
||||
}
|
||||
|
||||
impl Copy for CrateType {}
|
||||
|
||||
macro_rules! debugging_opts {
|
||||
([ $opt:ident ] $cnt:expr ) => (
|
||||
pub const $opt: u64 = 1 << $cnt;
|
||||
|
|
|
|||
|
|
@ -22,11 +22,9 @@ use syntax::visit::Visitor;
|
|||
|
||||
// Useful type to use with `Result<>` indicate that an error has already
|
||||
// been reported to the user, so no need to continue checking.
|
||||
#[deriving(Clone,Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub struct ErrorReported;
|
||||
|
||||
impl Copy for ErrorReported {}
|
||||
|
||||
pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where
|
||||
F: FnOnce(U) -> T,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,11 +68,9 @@ pub mod DefIdSet {
|
|||
///
|
||||
/// This uses FNV hashing, as described here:
|
||||
/// http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
|
||||
#[deriving(Clone, Default)]
|
||||
#[deriving(Clone, Copy, Default)]
|
||||
pub struct FnvHasher;
|
||||
|
||||
impl Copy for FnvHasher {}
|
||||
|
||||
#[allow(missing_copy_implementations)]
|
||||
pub struct FnvState(u64);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,11 +56,9 @@ pub mod gather_loans;
|
|||
|
||||
pub mod move_data;
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct LoanDataFlowOperator;
|
||||
|
||||
impl Copy for LoanDataFlowOperator {}
|
||||
|
||||
pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator>;
|
||||
|
||||
impl<'a, 'tcx, 'v> Visitor<'v> for BorrowckCtxt<'a, 'tcx> {
|
||||
|
|
@ -325,14 +323,12 @@ impl<'tcx> LoanPath<'tcx> {
|
|||
// b2b39e8700e37ad32b486b9a8409b50a8a53aa51#commitcomment-7892003
|
||||
static DOWNCAST_PRINTED_OPERATOR : &'static str = " as ";
|
||||
|
||||
#[deriving(PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum LoanPathElem {
|
||||
LpDeref(mc::PointerKind), // `*LV` in doc.rs
|
||||
LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
|
||||
}
|
||||
|
||||
impl Copy for LoanPathElem {}
|
||||
|
||||
pub fn closure_to_block(closure_id: ast::NodeId,
|
||||
tcx: &ty::ctxt) -> ast::NodeId {
|
||||
match tcx.map.get(closure_id) {
|
||||
|
|
@ -494,21 +490,18 @@ pub struct BckError<'tcx> {
|
|||
code: bckerr_code
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum AliasableViolationKind {
|
||||
MutabilityViolation,
|
||||
BorrowViolation(euv::LoanCause)
|
||||
}
|
||||
|
||||
impl Copy for AliasableViolationKind {}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum MovedValueUseKind {
|
||||
MovedInUse,
|
||||
MovedInCapture,
|
||||
}
|
||||
|
||||
impl Copy for MovedValueUseKind {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Misc
|
||||
|
||||
|
|
|
|||
|
|
@ -78,11 +78,9 @@ pub struct FlowedMoveData<'a, 'tcx: 'a> {
|
|||
}
|
||||
|
||||
/// Index into `MoveData.paths`, used like a pointer
|
||||
#[deriving(PartialEq, Eq, PartialOrd, Ord, Show)]
|
||||
#[deriving(Copy, PartialEq, Eq, PartialOrd, Ord, Show)]
|
||||
pub struct MovePathIndex(uint);
|
||||
|
||||
impl Copy for MovePathIndex {}
|
||||
|
||||
impl MovePathIndex {
|
||||
fn get(&self) -> uint {
|
||||
let MovePathIndex(v) = *self; v
|
||||
|
|
@ -100,11 +98,9 @@ static InvalidMovePathIndex: MovePathIndex =
|
|||
MovePathIndex(uint::MAX);
|
||||
|
||||
/// Index into `MoveData.moves`, used like a pointer
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub struct MoveIndex(uint);
|
||||
|
||||
impl Copy for MoveIndex {}
|
||||
|
||||
impl MoveIndex {
|
||||
fn get(&self) -> uint {
|
||||
let MoveIndex(v) = *self; v
|
||||
|
|
@ -134,7 +130,7 @@ pub struct MovePath<'tcx> {
|
|||
pub next_sibling: MovePathIndex,
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum MoveKind {
|
||||
Declared, // When declared, variables start out "moved".
|
||||
MoveExpr, // Expression or binding that moves a variable
|
||||
|
|
@ -142,8 +138,7 @@ pub enum MoveKind {
|
|||
Captured // Closure creation that moves a value
|
||||
}
|
||||
|
||||
impl Copy for MoveKind {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct Move {
|
||||
/// Path being moved.
|
||||
pub path: MovePathIndex,
|
||||
|
|
@ -158,8 +153,7 @@ pub struct Move {
|
|||
pub next_move: MoveIndex
|
||||
}
|
||||
|
||||
impl Copy for Move {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct Assignment {
|
||||
/// Path being assigned.
|
||||
pub path: MovePathIndex,
|
||||
|
|
@ -171,8 +165,7 @@ pub struct Assignment {
|
|||
pub span: Span,
|
||||
}
|
||||
|
||||
impl Copy for Assignment {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct VariantMatch {
|
||||
/// downcast to the variant.
|
||||
pub path: MovePathIndex,
|
||||
|
|
@ -187,20 +180,14 @@ pub struct VariantMatch {
|
|||
pub mode: euv::MatchMode
|
||||
}
|
||||
|
||||
impl Copy for VariantMatch {}
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct MoveDataFlowOperator;
|
||||
|
||||
impl Copy for MoveDataFlowOperator {}
|
||||
|
||||
pub type MoveDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, MoveDataFlowOperator>;
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct AssignDataFlowOperator;
|
||||
|
||||
impl Copy for AssignDataFlowOperator {}
|
||||
|
||||
pub type AssignDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, AssignDataFlowOperator>;
|
||||
|
||||
fn loan_path_is_precise(loan_path: &LoanPath) -> bool {
|
||||
|
|
|
|||
|
|
@ -25,15 +25,13 @@ use rustc::middle::dataflow::{DataFlowOperator, DataFlowContext, EntryOrExit};
|
|||
use rustc::middle::dataflow;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Show, Copy)]
|
||||
pub enum Variant {
|
||||
Loans,
|
||||
Moves,
|
||||
Assigns,
|
||||
}
|
||||
|
||||
impl Copy for Variant {}
|
||||
|
||||
impl Variant {
|
||||
pub fn short_name(&self) -> &'static str {
|
||||
match *self {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ use std::option;
|
|||
use std::str::FromStr;
|
||||
use arena::TypedArena;
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum PpSourceMode {
|
||||
PpmNormal,
|
||||
PpmExpanded,
|
||||
|
|
@ -49,16 +49,12 @@ pub enum PpSourceMode {
|
|||
PpmExpandedHygiene,
|
||||
}
|
||||
|
||||
impl Copy for PpSourceMode {}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum PpMode {
|
||||
PpmSource(PpSourceMode),
|
||||
PpmFlowGraph,
|
||||
}
|
||||
|
||||
impl Copy for PpMode {}
|
||||
|
||||
pub fn parse_pretty(sess: &Session, name: &str) -> (PpMode, Option<UserIdentifiedItem>) {
|
||||
let mut split = name.splitn(1, '=');
|
||||
let first = split.next().unwrap();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use libc::c_char;
|
|||
|
||||
use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef};
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum OptimizationDiagnosticKind {
|
||||
OptimizationRemark,
|
||||
OptimizationMissed,
|
||||
|
|
@ -24,8 +25,6 @@ pub enum OptimizationDiagnosticKind {
|
|||
OptimizationFailure,
|
||||
}
|
||||
|
||||
impl Copy for OptimizationDiagnosticKind {}
|
||||
|
||||
impl OptimizationDiagnosticKind {
|
||||
pub fn describe(self) -> &'static str {
|
||||
match self {
|
||||
|
|
@ -69,6 +68,7 @@ impl OptimizationDiagnostic {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum Diagnostic {
|
||||
Optimization(OptimizationDiagnostic),
|
||||
|
||||
|
|
@ -76,8 +76,6 @@ pub enum Diagnostic {
|
|||
UnknownDiagnostic(DiagnosticInfoRef),
|
||||
}
|
||||
|
||||
impl Copy for Diagnostic {}
|
||||
|
||||
impl Diagnostic {
|
||||
pub unsafe fn unpack(di: DiagnosticInfoRef) -> Diagnostic {
|
||||
let kind = super::LLVMGetDiagInfoKind(di);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ pub const False: Bool = 0 as Bool;
|
|||
|
||||
// Consts for the LLVM CallConv type, pre-cast to uint.
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum CallConv {
|
||||
CCallConv = 0,
|
||||
FastCallConv = 8,
|
||||
|
|
@ -78,20 +78,18 @@ pub enum CallConv {
|
|||
X86_64_Win64 = 79,
|
||||
}
|
||||
|
||||
impl Copy for CallConv {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum Visibility {
|
||||
LLVMDefaultVisibility = 0,
|
||||
HiddenVisibility = 1,
|
||||
ProtectedVisibility = 2,
|
||||
}
|
||||
|
||||
impl Copy for Visibility {}
|
||||
|
||||
// This enum omits the obsolete (and no-op) linkage types DLLImportLinkage,
|
||||
// DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage.
|
||||
// LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either;
|
||||
// they've been removed in upstream LLVM commit r203866.
|
||||
#[deriving(Copy)]
|
||||
pub enum Linkage {
|
||||
ExternalLinkage = 0,
|
||||
AvailableExternallyLinkage = 1,
|
||||
|
|
@ -106,10 +104,8 @@ pub enum Linkage {
|
|||
CommonLinkage = 14,
|
||||
}
|
||||
|
||||
impl Copy for Linkage {}
|
||||
|
||||
#[repr(C)]
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum DiagnosticSeverity {
|
||||
Error,
|
||||
Warning,
|
||||
|
|
@ -117,8 +113,6 @@ pub enum DiagnosticSeverity {
|
|||
Note,
|
||||
}
|
||||
|
||||
impl Copy for DiagnosticSeverity {}
|
||||
|
||||
bitflags! {
|
||||
flags Attribute : u32 {
|
||||
const ZExtAttribute = 1 << 0,
|
||||
|
|
@ -152,6 +146,7 @@ bitflags! {
|
|||
|
||||
|
||||
#[repr(u64)]
|
||||
#[deriving(Copy)]
|
||||
pub enum OtherAttribute {
|
||||
// The following are not really exposed in
|
||||
// the LLVM c api so instead to add these
|
||||
|
|
@ -172,22 +167,18 @@ pub enum OtherAttribute {
|
|||
NonNullAttribute = 1 << 44,
|
||||
}
|
||||
|
||||
impl Copy for OtherAttribute {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum SpecialAttribute {
|
||||
DereferenceableAttribute(u64)
|
||||
}
|
||||
|
||||
impl Copy for SpecialAttribute {}
|
||||
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub enum AttributeSet {
|
||||
ReturnIndex = 0,
|
||||
FunctionIndex = !0
|
||||
}
|
||||
|
||||
impl Copy for AttributeSet {}
|
||||
|
||||
pub trait AttrHelper {
|
||||
fn apply_llfn(&self, idx: c_uint, llfn: ValueRef);
|
||||
fn apply_callsite(&self, idx: c_uint, callsite: ValueRef);
|
||||
|
|
@ -274,6 +265,7 @@ impl AttrBuilder {
|
|||
}
|
||||
|
||||
// enum for the LLVM IntPredicate type
|
||||
#[deriving(Copy)]
|
||||
pub enum IntPredicate {
|
||||
IntEQ = 32,
|
||||
IntNE = 33,
|
||||
|
|
@ -287,9 +279,8 @@ pub enum IntPredicate {
|
|||
IntSLE = 41,
|
||||
}
|
||||
|
||||
impl Copy for IntPredicate {}
|
||||
|
||||
// enum for the LLVM RealPredicate type
|
||||
#[deriving(Copy)]
|
||||
pub enum RealPredicate {
|
||||
RealPredicateFalse = 0,
|
||||
RealOEQ = 1,
|
||||
|
|
@ -309,11 +300,9 @@ pub enum RealPredicate {
|
|||
RealPredicateTrue = 15,
|
||||
}
|
||||
|
||||
impl Copy for RealPredicate {}
|
||||
|
||||
// The LLVM TypeKind type - must stay in sync with the def of
|
||||
// LLVMTypeKind in llvm/include/llvm-c/Core.h
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub enum TypeKind {
|
||||
Void = 0,
|
||||
|
|
@ -334,9 +323,8 @@ pub enum TypeKind {
|
|||
X86_MMX = 15,
|
||||
}
|
||||
|
||||
impl Copy for TypeKind {}
|
||||
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub enum AtomicBinOp {
|
||||
AtomicXchg = 0,
|
||||
AtomicAdd = 1,
|
||||
|
|
@ -351,9 +339,8 @@ pub enum AtomicBinOp {
|
|||
AtomicUMin = 10,
|
||||
}
|
||||
|
||||
impl Copy for AtomicBinOp {}
|
||||
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub enum AtomicOrdering {
|
||||
NotAtomic = 0,
|
||||
Unordered = 1,
|
||||
|
|
@ -365,17 +352,15 @@ pub enum AtomicOrdering {
|
|||
SequentiallyConsistent = 7
|
||||
}
|
||||
|
||||
impl Copy for AtomicOrdering {}
|
||||
|
||||
// Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub enum FileType {
|
||||
AssemblyFileType = 0,
|
||||
ObjectFileType = 1
|
||||
}
|
||||
|
||||
impl Copy for FileType {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum MetadataType {
|
||||
MD_dbg = 0,
|
||||
MD_tbaa = 1,
|
||||
|
|
@ -385,17 +370,14 @@ pub enum MetadataType {
|
|||
MD_tbaa_struct = 5
|
||||
}
|
||||
|
||||
impl Copy for MetadataType {}
|
||||
|
||||
// Inline Asm Dialect
|
||||
#[deriving(Copy)]
|
||||
pub enum AsmDialect {
|
||||
AD_ATT = 0,
|
||||
AD_Intel = 1
|
||||
}
|
||||
|
||||
impl Copy for AsmDialect {}
|
||||
|
||||
#[deriving(PartialEq, Clone)]
|
||||
#[deriving(Copy, PartialEq, Clone)]
|
||||
#[repr(C)]
|
||||
pub enum CodeGenOptLevel {
|
||||
CodeGenLevelNone = 0,
|
||||
|
|
@ -404,9 +386,7 @@ pub enum CodeGenOptLevel {
|
|||
CodeGenLevelAggressive = 3,
|
||||
}
|
||||
|
||||
impl Copy for CodeGenOptLevel {}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
#[repr(C)]
|
||||
pub enum RelocMode {
|
||||
RelocDefault = 0,
|
||||
|
|
@ -415,9 +395,8 @@ pub enum RelocMode {
|
|||
RelocDynamicNoPic = 3,
|
||||
}
|
||||
|
||||
impl Copy for RelocMode {}
|
||||
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub enum CodeGenModel {
|
||||
CodeModelDefault = 0,
|
||||
CodeModelJITDefault = 1,
|
||||
|
|
@ -427,9 +406,8 @@ pub enum CodeGenModel {
|
|||
CodeModelLarge = 5,
|
||||
}
|
||||
|
||||
impl Copy for CodeGenModel {}
|
||||
|
||||
#[repr(C)]
|
||||
#[deriving(Copy)]
|
||||
pub enum DiagnosticKind {
|
||||
DK_InlineAsm = 0,
|
||||
DK_StackSize,
|
||||
|
|
@ -441,8 +419,6 @@ pub enum DiagnosticKind {
|
|||
DK_OptimizationFailure,
|
||||
}
|
||||
|
||||
impl Copy for DiagnosticKind {}
|
||||
|
||||
// Opaque pointer types
|
||||
#[allow(missing_copy_implementations)]
|
||||
pub enum Module_opaque {}
|
||||
|
|
@ -537,6 +513,7 @@ pub mod debuginfo {
|
|||
pub type DIArray = DIDescriptor;
|
||||
pub type DISubrange = DIDescriptor;
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum DIDescriptorFlags {
|
||||
FlagPrivate = 1 << 0,
|
||||
FlagProtected = 1 << 1,
|
||||
|
|
@ -555,8 +532,6 @@ pub mod debuginfo {
|
|||
FlagLValueReference = 1 << 14,
|
||||
FlagRValueReference = 1 << 15
|
||||
}
|
||||
|
||||
impl Copy for DIDescriptorFlags {}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ use std::sync::{Arc, Mutex};
|
|||
use std::thread;
|
||||
use libc::{c_uint, c_int, c_void};
|
||||
|
||||
#[deriving(Clone, PartialEq, PartialOrd, Ord, Eq)]
|
||||
#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
|
||||
pub enum OutputType {
|
||||
OutputTypeBitcode,
|
||||
OutputTypeAssembly,
|
||||
|
|
@ -42,8 +42,6 @@ pub enum OutputType {
|
|||
OutputTypeExe,
|
||||
}
|
||||
|
||||
impl Copy for OutputType {}
|
||||
|
||||
pub fn llvm_err(handler: &diagnostic::Handler, msg: String) -> ! {
|
||||
unsafe {
|
||||
let cstr = llvm::LLVMRustGetLastError();
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ macro_rules! svec {
|
|||
})
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum Row {
|
||||
Variable,
|
||||
Enum,
|
||||
|
|
@ -87,8 +88,6 @@ pub enum Row {
|
|||
FnRef,
|
||||
}
|
||||
|
||||
impl Copy for Row {}
|
||||
|
||||
impl<'a> FmtStrs<'a> {
|
||||
pub fn new(rec: Box<Recorder>, span: SpanUtils<'a>, krate: String) -> FmtStrs<'a> {
|
||||
FmtStrs {
|
||||
|
|
|
|||
|
|
@ -228,11 +228,9 @@ use syntax::codemap::Span;
|
|||
use syntax::fold::Folder;
|
||||
use syntax::ptr::P;
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
struct ConstantExpr<'a>(&'a ast::Expr);
|
||||
|
||||
impl<'a> Copy for ConstantExpr<'a> {}
|
||||
|
||||
impl<'a> ConstantExpr<'a> {
|
||||
fn eq(self, other: ConstantExpr<'a>, tcx: &ty::ctxt) -> bool {
|
||||
let ConstantExpr(expr) = self;
|
||||
|
|
@ -301,7 +299,7 @@ impl<'a, 'tcx> Opt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum BranchKind {
|
||||
NoBranch,
|
||||
Single,
|
||||
|
|
@ -310,23 +308,19 @@ pub enum BranchKind {
|
|||
CompareSliceLength
|
||||
}
|
||||
|
||||
impl Copy for BranchKind {}
|
||||
|
||||
pub enum OptResult<'blk, 'tcx: 'blk> {
|
||||
SingleResult(Result<'blk, 'tcx>),
|
||||
RangeResult(Result<'blk, 'tcx>, Result<'blk, 'tcx>),
|
||||
LowerBound(Result<'blk, 'tcx>)
|
||||
}
|
||||
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub enum TransBindingMode {
|
||||
TrByCopy(/* llbinding */ ValueRef),
|
||||
TrByMove,
|
||||
TrByRef,
|
||||
}
|
||||
|
||||
impl Copy for TransBindingMode {}
|
||||
|
||||
/// Information about a pattern binding:
|
||||
/// - `llmatch` is a pointer to a stack slot. The stack slot contains a
|
||||
/// pointer into the value being matched. Hence, llmatch has type `T**`
|
||||
|
|
@ -334,7 +328,7 @@ impl Copy for TransBindingMode {}
|
|||
/// - `trmode` is the trans binding mode
|
||||
/// - `id` is the node id of the binding
|
||||
/// - `ty` is the Rust type of the binding
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct BindingInfo<'tcx> {
|
||||
pub llmatch: ValueRef,
|
||||
pub trmode: TransBindingMode,
|
||||
|
|
@ -343,8 +337,6 @@ pub struct BindingInfo<'tcx> {
|
|||
pub ty: Ty<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for BindingInfo<'tcx> {}
|
||||
|
||||
type BindingsMap<'tcx> = FnvHashMap<Ident, BindingInfo<'tcx>>;
|
||||
|
||||
struct ArmData<'p, 'blk, 'tcx: 'blk> {
|
||||
|
|
|
|||
|
|
@ -281,14 +281,12 @@ struct Case<'tcx> {
|
|||
}
|
||||
|
||||
|
||||
#[deriving(Eq, PartialEq, Show)]
|
||||
#[deriving(Copy, Eq, PartialEq, Show)]
|
||||
pub enum PointerField {
|
||||
ThinPointer(uint),
|
||||
FatPointer(uint)
|
||||
}
|
||||
|
||||
impl Copy for PointerField {}
|
||||
|
||||
impl<'tcx> Case<'tcx> {
|
||||
fn is_zerolen<'a>(&self, cx: &CrateContext<'a, 'tcx>, scapegoat: Ty<'tcx>)
|
||||
-> bool {
|
||||
|
|
|
|||
|
|
@ -565,10 +565,9 @@ pub fn maybe_name_value(cx: &CrateContext, v: ValueRef, s: &str) {
|
|||
|
||||
|
||||
// Used only for creating scalar comparison glue.
|
||||
#[deriving(Copy)]
|
||||
pub enum scalar_type { nil_type, signed_int, unsigned_int, floating_point, }
|
||||
|
||||
impl Copy for scalar_type {}
|
||||
|
||||
pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
|
||||
lhs: ValueRef,
|
||||
rhs: ValueRef,
|
||||
|
|
@ -1792,14 +1791,12 @@ pub fn build_return_block<'blk, 'tcx>(fcx: &FunctionContext<'blk, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, Eq, PartialEq)]
|
||||
#[deriving(Clone, Copy, Eq, PartialEq)]
|
||||
pub enum IsUnboxedClosureFlag {
|
||||
NotUnboxedClosure,
|
||||
IsUnboxedClosure,
|
||||
}
|
||||
|
||||
impl Copy for IsUnboxedClosureFlag {}
|
||||
|
||||
// trans_closure: Builds an LLVM function out of a source function.
|
||||
// If the function closes over its environment a closure will be
|
||||
// returned.
|
||||
|
|
@ -2194,6 +2191,7 @@ pub fn llvm_linkage_by_name(name: &str) -> Option<Linkage> {
|
|||
|
||||
|
||||
/// Enum describing the origin of an LLVM `Value`, for linkage purposes.
|
||||
#[deriving(Copy)]
|
||||
pub enum ValueOrigin {
|
||||
/// The LLVM `Value` is in this context because the corresponding item was
|
||||
/// assigned to the current compilation unit.
|
||||
|
|
@ -2204,8 +2202,6 @@ pub enum ValueOrigin {
|
|||
InlinedCopy,
|
||||
}
|
||||
|
||||
impl Copy for ValueOrigin {}
|
||||
|
||||
/// Set the appropriate linkage for an LLVM `ValueRef` (function or global).
|
||||
/// If the `llval` is the direct translation of a specific Rust item, `id`
|
||||
/// should be set to the `NodeId` of that item. (This mapping should be
|
||||
|
|
|
|||
|
|
@ -13,10 +13,9 @@ use llvm::{BasicBlockRef};
|
|||
use trans::value::{Users, Value};
|
||||
use std::iter::{Filter, Map};
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct BasicBlock(pub BasicBlockRef);
|
||||
|
||||
impl Copy for BasicBlock {}
|
||||
|
||||
pub type Preds = Map<
|
||||
Value,
|
||||
BasicBlock,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ use trans::cabi_arm;
|
|||
use trans::cabi_mips;
|
||||
use trans::type_::Type;
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
pub enum ArgKind {
|
||||
/// Pass the argument directly using the normal converted
|
||||
/// LLVM type or by coercing to another specified type
|
||||
|
|
@ -31,13 +31,11 @@ pub enum ArgKind {
|
|||
Ignore,
|
||||
}
|
||||
|
||||
impl Copy for ArgKind {}
|
||||
|
||||
/// Information about how a specific C type
|
||||
/// should be passed to or returned from a function
|
||||
///
|
||||
/// This is borrowed from clang's ABIInfo.h
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct ArgType {
|
||||
pub kind: ArgKind,
|
||||
/// Original LLVM type
|
||||
|
|
@ -50,8 +48,6 @@ pub struct ArgType {
|
|||
pub attr: option::Option<Attribute>
|
||||
}
|
||||
|
||||
impl Copy for ArgType {}
|
||||
|
||||
impl ArgType {
|
||||
pub fn direct(ty: Type, cast: option::Option<Type>,
|
||||
pad: option::Option<Type>,
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ use trans::type_::Type;
|
|||
|
||||
use std::cmp;
|
||||
|
||||
#[deriving(Clone, PartialEq)]
|
||||
#[deriving(Clone, Copy, PartialEq)]
|
||||
enum RegClass {
|
||||
NoClass,
|
||||
Int,
|
||||
|
|
@ -40,8 +40,6 @@ enum RegClass {
|
|||
Memory
|
||||
}
|
||||
|
||||
impl Copy for RegClass {}
|
||||
|
||||
trait TypeMethods {
|
||||
fn is_reg_ty(&self) -> bool;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,13 +57,12 @@ use syntax::ast;
|
|||
use syntax::ast_map;
|
||||
use syntax::ptr::P;
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct MethodData {
|
||||
pub llfn: ValueRef,
|
||||
pub llself: ValueRef,
|
||||
}
|
||||
|
||||
impl Copy for MethodData {}
|
||||
|
||||
pub enum CalleeData<'tcx> {
|
||||
Closure(Datum<'tcx, Lvalue>),
|
||||
|
||||
|
|
@ -1049,13 +1048,12 @@ pub fn trans_args<'a, 'blk, 'tcx>(cx: Block<'blk, 'tcx>,
|
|||
bcx
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub enum AutorefArg {
|
||||
DontAutorefArg,
|
||||
DoAutorefArg(ast::NodeId)
|
||||
}
|
||||
|
||||
impl Copy for AutorefArg {}
|
||||
|
||||
pub fn trans_arg_datum<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
formal_arg_ty: Ty<'tcx>,
|
||||
arg_datum: Datum<'tcx, Expr>,
|
||||
|
|
|
|||
|
|
@ -50,13 +50,11 @@ pub struct CleanupScope<'blk, 'tcx: 'blk> {
|
|||
cached_landing_pad: Option<BasicBlockRef>,
|
||||
}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub struct CustomScopeIndex {
|
||||
index: uint
|
||||
}
|
||||
|
||||
impl Copy for CustomScopeIndex {}
|
||||
|
||||
pub const EXIT_BREAK: uint = 0;
|
||||
pub const EXIT_LOOP: uint = 1;
|
||||
pub const EXIT_MAX: uint = 2;
|
||||
|
|
@ -83,22 +81,19 @@ impl<'blk, 'tcx: 'blk> fmt::Show for CleanupScopeKind<'blk, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum EarlyExitLabel {
|
||||
UnwindExit,
|
||||
ReturnExit,
|
||||
LoopExit(ast::NodeId, uint)
|
||||
}
|
||||
|
||||
impl Copy for EarlyExitLabel {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct CachedEarlyExit {
|
||||
label: EarlyExitLabel,
|
||||
cleanup_block: BasicBlockRef,
|
||||
}
|
||||
|
||||
impl Copy for CachedEarlyExit {}
|
||||
|
||||
pub trait Cleanup<'tcx> {
|
||||
fn must_unwind(&self) -> bool;
|
||||
fn clean_on_unwind(&self) -> bool;
|
||||
|
|
@ -111,14 +106,12 @@ pub trait Cleanup<'tcx> {
|
|||
|
||||
pub type CleanupObj<'tcx> = Box<Cleanup<'tcx>+'tcx>;
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum ScopeId {
|
||||
AstScope(ast::NodeId),
|
||||
CustomScope(CustomScopeIndex)
|
||||
}
|
||||
|
||||
impl Copy for ScopeId {}
|
||||
|
||||
impl<'blk, 'tcx> CleanupMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx> {
|
||||
/// Invoked when we start to trans the code contained within a new cleanup scope.
|
||||
fn push_ast_cleanup_scope(&self, debug_loc: NodeInfo) {
|
||||
|
|
@ -876,6 +869,7 @@ impl EarlyExitLabel {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Cleanup types
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct DropValue<'tcx> {
|
||||
is_immediate: bool,
|
||||
must_unwind: bool,
|
||||
|
|
@ -884,8 +878,6 @@ pub struct DropValue<'tcx> {
|
|||
zero: bool
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for DropValue<'tcx> {}
|
||||
|
||||
impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
|
||||
fn must_unwind(&self) -> bool {
|
||||
self.must_unwind
|
||||
|
|
@ -915,21 +907,18 @@ impl<'tcx> Cleanup<'tcx> for DropValue<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum Heap {
|
||||
HeapExchange
|
||||
}
|
||||
|
||||
impl Copy for Heap {}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct FreeValue<'tcx> {
|
||||
ptr: ValueRef,
|
||||
heap: Heap,
|
||||
content_ty: Ty<'tcx>
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for FreeValue<'tcx> {}
|
||||
|
||||
impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
|
||||
fn must_unwind(&self) -> bool {
|
||||
true
|
||||
|
|
@ -957,6 +946,7 @@ impl<'tcx> Cleanup<'tcx> for FreeValue<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct FreeSlice {
|
||||
ptr: ValueRef,
|
||||
size: ValueRef,
|
||||
|
|
@ -964,8 +954,6 @@ pub struct FreeSlice {
|
|||
heap: Heap,
|
||||
}
|
||||
|
||||
impl Copy for FreeSlice {}
|
||||
|
||||
impl<'tcx> Cleanup<'tcx> for FreeSlice {
|
||||
fn must_unwind(&self) -> bool {
|
||||
true
|
||||
|
|
@ -993,12 +981,11 @@ impl<'tcx> Cleanup<'tcx> for FreeSlice {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct LifetimeEnd {
|
||||
ptr: ValueRef,
|
||||
}
|
||||
|
||||
impl Copy for LifetimeEnd {}
|
||||
|
||||
impl<'tcx> Cleanup<'tcx> for LifetimeEnd {
|
||||
fn must_unwind(&self) -> bool {
|
||||
false
|
||||
|
|
|
|||
|
|
@ -102,13 +102,12 @@ use syntax::ast_util;
|
|||
//
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct EnvValue<'tcx> {
|
||||
action: ast::CaptureClause,
|
||||
datum: Datum<'tcx, Lvalue>
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for EnvValue<'tcx> {}
|
||||
|
||||
impl<'tcx> EnvValue<'tcx> {
|
||||
pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
|
||||
format!("{}({})", self.action, self.datum.to_string(ccx))
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ pub fn gensym_name(name: &str) -> PathElem {
|
|||
PathName(token::gensym(format!("{}:{}", name, num).as_slice()))
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct tydesc_info<'tcx> {
|
||||
pub ty: Ty<'tcx>,
|
||||
pub tydesc: ValueRef,
|
||||
|
|
@ -127,8 +128,6 @@ pub struct tydesc_info<'tcx> {
|
|||
pub name: ValueRef,
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for tydesc_info<'tcx> {}
|
||||
|
||||
/*
|
||||
* A note on nomenclature of linking: "extern", "foreign", and "upcall".
|
||||
*
|
||||
|
|
@ -155,13 +154,12 @@ impl<'tcx> Copy for tydesc_info<'tcx> {}
|
|||
*
|
||||
*/
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct NodeInfo {
|
||||
pub id: ast::NodeId,
|
||||
pub span: Span,
|
||||
}
|
||||
|
||||
impl Copy for NodeInfo {}
|
||||
|
||||
pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
|
||||
NodeInfo { id: expr.id, span: expr.span }
|
||||
}
|
||||
|
|
@ -863,7 +861,7 @@ pub fn fulfill_obligation<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
|
|||
}
|
||||
|
||||
// Key used to lookup values supplied for type parameters in an expr.
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum ExprOrMethodCall {
|
||||
// Type parameters for a path like `None::<int>`
|
||||
ExprId(ast::NodeId),
|
||||
|
|
@ -872,8 +870,6 @@ pub enum ExprOrMethodCall {
|
|||
MethodCall(ty::MethodCall)
|
||||
}
|
||||
|
||||
impl Copy for ExprOrMethodCall {}
|
||||
|
||||
pub fn node_id_substs<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
||||
node: ExprOrMethodCall)
|
||||
-> subst::Substs<'tcx> {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ use syntax::ast;
|
|||
/// describes where the value is stored, what Rust type the value has,
|
||||
/// whether it is addressed by reference, and so forth. Please refer
|
||||
/// the section on datums in `doc.rs` for more details.
|
||||
#[deriving(Clone)]
|
||||
#[deriving(Clone, Copy)]
|
||||
pub struct Datum<'tcx, K> {
|
||||
/// The llvm value. This is either a pointer to the Rust value or
|
||||
/// the value itself, depending on `kind` below.
|
||||
|
|
@ -46,8 +46,6 @@ pub struct Datum<'tcx, K> {
|
|||
pub kind: K,
|
||||
}
|
||||
|
||||
impl<'tcx,K:Copy> Copy for Datum<'tcx,K> {}
|
||||
|
||||
pub struct DatumBlock<'blk, 'tcx: 'blk, K> {
|
||||
pub bcx: Block<'blk, 'tcx>,
|
||||
pub datum: Datum<'tcx, K>,
|
||||
|
|
@ -65,11 +63,9 @@ pub enum Expr {
|
|||
LvalueExpr,
|
||||
}
|
||||
|
||||
#[deriving(Clone, Show)]
|
||||
#[deriving(Clone, Copy, Show)]
|
||||
pub struct Lvalue;
|
||||
|
||||
impl Copy for Lvalue {}
|
||||
|
||||
#[deriving(Show)]
|
||||
pub struct Rvalue {
|
||||
pub mode: RvalueMode
|
||||
|
|
@ -86,7 +82,7 @@ impl Drop for Rvalue {
|
|||
fn drop(&mut self) { }
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Eq, Hash, Show)]
|
||||
#[deriving(Copy, PartialEq, Eq, Hash, Show)]
|
||||
pub enum RvalueMode {
|
||||
/// `val` is a pointer to the actual value (and thus has type *T)
|
||||
ByRef,
|
||||
|
|
@ -95,8 +91,6 @@ pub enum RvalueMode {
|
|||
ByValue,
|
||||
}
|
||||
|
||||
impl Copy for RvalueMode {}
|
||||
|
||||
pub fn immediate_rvalue<'tcx>(val: ValueRef, ty: Ty<'tcx>) -> Datum<'tcx, Rvalue> {
|
||||
return Datum::new(val, ty, Rvalue::new(ByValue));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -248,11 +248,9 @@ static FLAGS_NONE: c_uint = 0;
|
|||
// Public Interface of debuginfo module
|
||||
//=-----------------------------------------------------------------------------
|
||||
|
||||
#[deriving(Show, Hash, Eq, PartialEq, Clone)]
|
||||
#[deriving(Copy, Show, Hash, Eq, PartialEq, Clone)]
|
||||
struct UniqueTypeId(ast::Name);
|
||||
|
||||
impl Copy for UniqueTypeId {}
|
||||
|
||||
// The TypeMap is where the CrateDebugContext holds the type metadata nodes
|
||||
// created so far. The metadata nodes are indexed by UniqueTypeId, and, for
|
||||
// faster lookup, also by Ty. The TypeMap is responsible for creating
|
||||
|
|
@ -2320,14 +2318,13 @@ impl<'tcx> VariantMemberDescriptionFactory<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum EnumDiscriminantInfo {
|
||||
RegularDiscriminant(DIType),
|
||||
OptimizedDiscriminant(adt::PointerField),
|
||||
NoDiscriminant
|
||||
}
|
||||
|
||||
impl Copy for EnumDiscriminantInfo {}
|
||||
|
||||
// Returns a tuple of (1) type_metadata_stub of the variant, (2) the llvm_type
|
||||
// of the variant, and (3) a MemberDescriptionFactory for producing the
|
||||
// descriptions of the fields of the variant. This is a rudimentary version of a
|
||||
|
|
@ -3047,14 +3044,12 @@ impl MetadataCreationResult {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
enum DebugLocation {
|
||||
KnownLocation { scope: DIScope, line: uint, col: uint },
|
||||
UnknownLocation
|
||||
}
|
||||
|
||||
impl Copy for DebugLocation {}
|
||||
|
||||
impl DebugLocation {
|
||||
fn new(scope: DIScope, line: uint, col: uint) -> DebugLocation {
|
||||
KnownLocation {
|
||||
|
|
|
|||
|
|
@ -73,14 +73,12 @@ use std::rc::Rc;
|
|||
// These are passed around by the code generating functions to track the
|
||||
// destination of a computation's value.
|
||||
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum Dest {
|
||||
SaveIn(ValueRef),
|
||||
Ignore,
|
||||
}
|
||||
|
||||
impl Copy for Dest {}
|
||||
|
||||
impl Dest {
|
||||
pub fn to_string(&self, ccx: &CrateContext) -> String {
|
||||
match *self {
|
||||
|
|
@ -1889,7 +1887,7 @@ fn float_cast(bcx: Block,
|
|||
} else { llsrc };
|
||||
}
|
||||
|
||||
#[deriving(PartialEq, Show)]
|
||||
#[deriving(Copy, PartialEq, Show)]
|
||||
pub enum cast_kind {
|
||||
cast_pointer,
|
||||
cast_integral,
|
||||
|
|
@ -1898,8 +1896,6 @@ pub enum cast_kind {
|
|||
cast_other,
|
||||
}
|
||||
|
||||
impl Copy for cast_kind {}
|
||||
|
||||
pub fn cast_type_kind<'tcx>(tcx: &ty::ctxt<'tcx>, t: Ty<'tcx>) -> cast_kind {
|
||||
match t.sty {
|
||||
ty::ty_char => cast_integral,
|
||||
|
|
|
|||
|
|
@ -54,13 +54,12 @@ mod basic_block;
|
|||
mod llrepr;
|
||||
mod cleanup;
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct ModuleTranslation {
|
||||
pub llcx: ContextRef,
|
||||
pub llmod: ModuleRef,
|
||||
}
|
||||
|
||||
impl Copy for ModuleTranslation {}
|
||||
|
||||
pub struct CrateTranslation {
|
||||
pub modules: Vec<ModuleTranslation>,
|
||||
pub metadata_module: ModuleTranslation,
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ pub fn make_drop_glue_unboxed<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
|
|||
})
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct VecTypes<'tcx> {
|
||||
pub unit_ty: Ty<'tcx>,
|
||||
pub llunit_ty: Type,
|
||||
|
|
@ -96,8 +97,6 @@ pub struct VecTypes<'tcx> {
|
|||
pub llunit_alloc_size: u64
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for VecTypes<'tcx> {}
|
||||
|
||||
impl<'tcx> VecTypes<'tcx> {
|
||||
pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
|
||||
format!("VecTypes {{unit_ty={}, llunit_ty={}, \
|
||||
|
|
|
|||
|
|
@ -25,14 +25,12 @@ use std::cell::RefCell;
|
|||
|
||||
use libc::c_uint;
|
||||
|
||||
#[deriving(Clone, PartialEq, Show)]
|
||||
#[deriving(Clone, Copy, PartialEq, Show)]
|
||||
#[repr(C)]
|
||||
pub struct Type {
|
||||
rf: TypeRef
|
||||
}
|
||||
|
||||
impl Copy for Type {}
|
||||
|
||||
macro_rules! ty {
|
||||
($e:expr) => ( Type::from_ref(unsafe { $e }))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -443,14 +443,13 @@ pub fn align_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, t: Ty<'tcx>)
|
|||
}
|
||||
|
||||
// Want refinements! (Or case classes, I guess
|
||||
#[deriving(Copy)]
|
||||
pub enum named_ty {
|
||||
a_struct,
|
||||
an_enum,
|
||||
an_unboxed_closure,
|
||||
}
|
||||
|
||||
impl Copy for named_ty {}
|
||||
|
||||
pub fn llvm_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
|
||||
what: named_ty,
|
||||
did: ast::DefId,
|
||||
|
|
|
|||
|
|
@ -14,10 +14,9 @@ use trans::basic_block::BasicBlock;
|
|||
use trans::common::Block;
|
||||
use libc::c_uint;
|
||||
|
||||
#[deriving(Copy)]
|
||||
pub struct Value(pub ValueRef);
|
||||
|
||||
impl Copy for Value {}
|
||||
|
||||
macro_rules! opt_val { ($e:expr) => (
|
||||
unsafe {
|
||||
match $e {
|
||||
|
|
@ -126,10 +125,9 @@ impl Value {
|
|||
}
|
||||
|
||||
/// Wrapper for LLVM UseRef
|
||||
#[deriving(Copy)]
|
||||
pub struct Use(UseRef);
|
||||
|
||||
impl Copy for Use {}
|
||||
|
||||
impl Use {
|
||||
pub fn get(&self) -> UseRef {
|
||||
let Use(v) = *self; v
|
||||
|
|
|
|||
|
|
@ -46,14 +46,12 @@ pub enum MethodError {
|
|||
|
||||
// A pared down enum describing just the places from which a method
|
||||
// candidate can arise. Used for error reporting only.
|
||||
#[deriving(PartialOrd, Ord, PartialEq, Eq)]
|
||||
#[deriving(Copy, PartialOrd, Ord, PartialEq, Eq)]
|
||||
pub enum CandidateSource {
|
||||
ImplSource(ast::DefId),
|
||||
TraitSource(/* trait id */ ast::DefId),
|
||||
}
|
||||
|
||||
impl Copy for CandidateSource {}
|
||||
|
||||
type MethodIndex = uint; // just for doc purposes
|
||||
|
||||
/// Determines whether the type `self_ty` supports a method name `method_name` or not.
|
||||
|
|
|
|||
|
|
@ -166,6 +166,7 @@ pub struct Inherited<'a, 'tcx: 'a> {
|
|||
|
||||
/// When type-checking an expression, we propagate downward
|
||||
/// whatever type hint we are able in the form of an `Expectation`.
|
||||
#[deriving(Copy)]
|
||||
enum Expectation<'tcx> {
|
||||
/// We know nothing about what type this expression should have.
|
||||
NoExpectation,
|
||||
|
|
@ -177,8 +178,6 @@ enum Expectation<'tcx> {
|
|||
ExpectCastableToType(Ty<'tcx>),
|
||||
}
|
||||
|
||||
impl<'tcx> Copy for Expectation<'tcx> {}
|
||||
|
||||
impl<'tcx> Expectation<'tcx> {
|
||||
// Disregard "castable to" expectations because they
|
||||
// can lead us astray. Consider for example `if cond
|
||||
|
|
@ -1976,14 +1975,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Show)]
|
||||
#[deriving(Copy, Show)]
|
||||
pub enum LvaluePreference {
|
||||
PreferMutLvalue,
|
||||
NoPreference
|
||||
}
|
||||
|
||||
impl Copy for LvaluePreference {}
|
||||
|
||||
/// Executes an autoderef loop for the type `t`. At each step, invokes `should_stop` to decide
|
||||
/// whether to terminate the loop. Returns the final type and number of derefs that it performed.
|
||||
///
|
||||
|
|
@ -2856,14 +2853,12 @@ pub fn lookup_tup_field_ty<'tcx>(tcx: &ty::ctxt<'tcx>,
|
|||
|
||||
// Controls whether the arguments are automatically referenced. This is useful
|
||||
// for overloaded binary and unary operators.
|
||||
#[deriving(PartialEq)]
|
||||
#[deriving(Copy, PartialEq)]
|
||||
pub enum AutorefArgs {
|
||||
Yes,
|
||||
No,
|
||||
}
|
||||
|
||||
impl Copy for AutorefArgs {}
|
||||
|
||||
/// Controls whether the arguments are tupled. This is used for the call
|
||||
/// operator.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -343,6 +343,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// Resolution reason.
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum ResolveReason {
|
||||
ResolvingExpr(Span),
|
||||
ResolvingLocal(Span),
|
||||
|
|
@ -351,8 +352,6 @@ enum ResolveReason {
|
|||
ResolvingUnboxedClosure(ast::DefId),
|
||||
}
|
||||
|
||||
impl Copy for ResolveReason {}
|
||||
|
||||
impl ResolveReason {
|
||||
fn span(&self, tcx: &ty::ctxt) -> Span {
|
||||
match *self {
|
||||
|
|
|
|||
|
|
@ -490,6 +490,7 @@ fn convert_associated_type<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
|
|||
}
|
||||
}
|
||||
|
||||
#[deriving(Copy)]
|
||||
enum ConvertMethodContext<'a> {
|
||||
/// Used when converting implementation methods.
|
||||
ImplConvertMethodContext,
|
||||
|
|
@ -498,8 +499,6 @@ enum ConvertMethodContext<'a> {
|
|||
TraitConvertMethodContext(ast::DefId, &'a [ast::TraitItem]),
|
||||
}
|
||||
|
||||
impl<'a> Copy for ConvertMethodContext<'a> {}
|
||||
|
||||
fn convert_methods<'a,'tcx,'i,I>(ccx: &CrateCtxt<'a, 'tcx>,
|
||||
convert_method_context: ConvertMethodContext,
|
||||
container: ImplOrTraitItemContainer,
|
||||
|
|
|
|||
|
|
@ -36,10 +36,9 @@ 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.
|
||||
#[deriving(Copy)]
|
||||
pub struct ExplicitRscope;
|
||||
|
||||
impl Copy for ExplicitRscope {}
|
||||
|
||||
impl RegionScope for ExplicitRscope {
|
||||
fn default_region_bound(&self, _span: Span) -> Option<ty::Region> {
|
||||
None
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue