use std::str::FromStr;
use regex::Regex;
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
pub enum Mode {
CompileFail,
RunFail,
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Config {
// The library paths required for running the compiler
pub compile_lib_path: String,
pub static EXPECTED_PATTERN : &'static str =
r"//~(?P<follow>\|)?(?P<adjusts>\^*)\s*(?P<kind>\S*)\s*(?P<msg>.*)";
-#[deriving(PartialEq, Show)]
+#[derive(PartialEq, Show)]
enum WhichLine { ThisLine, FollowPrevious(uint), AdjustBackward(uint) }
// Load any test directives embedded in the file
}
// Make sure deriving works with Arc<T>
- #[deriving(Eq, Ord, PartialEq, PartialOrd, Clone, Show, Default)]
+ #[derive(Eq, Ord, PartialEq, PartialOrd, Clone, Show, Default)]
struct Foo { inner: Arc<int> }
}
// The way arena uses arrays is really deeply awful. The arrays are
// allocated, and have capacities reserved, but the fill for the array
// will always stay at 0.
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
struct Chunk {
data: Rc<RefCell<Vec<u8>>>,
fill: Cell<uint>,
//! use std::collections::BinaryHeap;
//! use std::uint;
//!
-//! #[deriving(Copy, Eq, PartialEq)]
+//! #[derive(Copy, Eq, PartialEq)]
//! struct State {
//! cost: uint,
//! position: uint,
/// A priority queue implemented with a binary heap.
///
/// This will be a max-heap.
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct BinaryHeap<T> {
data: Vec<T>,
iter: slice::Iter<'a, T>,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> {
Iter { iter: self.iter.clone() }
/// An iterator for `Bitv`.
#[stable]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Iter<'a> {
bitv: &'a Bitv,
next_idx: uint,
/// let bv: Bitv = s.into_bitv();
/// assert!(bv[3]);
/// ```
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct BitvSet {
bitv: Bitv,
}
/// An iterator for `BitvSet`.
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct SetIter<'a> {
set: &'a BitvSet,
}
/// An iterator combining two `BitvSet` iterators.
-#[deriving(Clone)]
+#[derive(Clone)]
struct TwoBitPositions<'a> {
set: &'a BitvSet,
other: &'a BitvSet,
/// force this degenerate behaviour to occur on every operation. While the total amount of work
/// done on each operation isn't *catastrophic*, and *is* still bounded by O(B log<sub>B</sub>n),
/// it is certainly much slower when it does.
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct BTreeMap<K, V> {
root: Node<K, V>,
/// println!("Uninitialized memory: {}", handle.into_kv());
/// }
/// ```
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Handle<NodeRef, Type, NodeType> {
node: NodeRef,
index: uint
///
/// See BTreeMap's documentation for a detailed discussion of this collection's performance
/// benefits and drawbacks.
-#[deriving(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
+#[derive(Clone, Hash, PartialEq, Eq, Ord, PartialOrd)]
#[stable]
pub struct BTreeSet<T>{
map: BTreeMap<T, ()>,
}
/// An iterator over mutable references to the items of a `DList`.
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct IntoIter<T> {
list: DList<T>
// FIXME(contentions): implement union family of methods? (general design may be wrong here)
-#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
+#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
/// A specialized set implementation to use enum types.
pub struct EnumSet<E> {
// We must maintain the invariant that no bits are set
bits: uint,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<E> Clone for Iter<E> {
fn clone(&self) -> Iter<E> {
Iter {
use super::{EnumSet, CLike};
- #[deriving(Copy, PartialEq, Show)]
+ #[derive(Copy, PartialEq, Show)]
#[repr(uint)]
enum Foo {
A, B, C
#[should_fail]
fn test_overflow() {
#[allow(dead_code)]
- #[deriving(Copy)]
+ #[derive(Copy)]
#[repr(uint)]
enum Bar {
V00, V01, V02, V03, V04, V05, V06, V07, V08, V09,
head: uint
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> {
Iter {
})
}
- #[deriving(Clone, PartialEq, Show)]
+ #[derive(Clone, PartialEq, Show)]
enum Taggy {
One(int),
Two(int, int),
Three(int, int, int),
}
- #[deriving(Clone, PartialEq, Show)]
+ #[derive(Clone, PartialEq, Show)]
enum Taggypar<T> {
Onepar(int),
Twopar(int, int),
Threepar(int, int, int),
}
- #[deriving(Clone, PartialEq, Show)]
+ #[derive(Clone, PartialEq, Show)]
struct RecCy {
x: int,
y: int,
/// The last generated swap is always (0, 1), and it returns the
/// sequence to its initial order.
#[experimental]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct ElementSwaps {
sdir: Vec<SizeDirection>,
/// If `true`, emit the last swap that returns the sequence to initial
// Iterators
////////////////////////////////////////////////////////////////////////////////
-#[deriving(Copy, Clone)]
+#[derive(Copy, Clone)]
enum Direction { Pos, Neg }
/// An `Index` and `Direction` together.
-#[deriving(Copy, Clone)]
+#[derive(Copy, Clone)]
struct SizeDirection {
size: uint,
dir: Direction,
assert!(values == [2, 3, 5, 6, 7]);
}
- #[deriving(Clone, PartialEq)]
+ #[derive(Clone, PartialEq)]
struct Foo;
#[test]
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
enum DecompositionType {
Canonical,
Compatible
/// External iterator for a string's decomposition's characters.
/// Use with the `std::iter` module.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Decompositions<'a> {
kind: DecompositionType,
iter: Chars<'a>,
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
enum RecompositionState {
Composing,
Purging,
/// External iterator for a string's recomposition's characters.
/// Use with the `std::iter` module.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Recompositions<'a> {
iter: Decompositions<'a>,
state: RecompositionState,
/// External iterator for a string's UTF16 codeunits.
/// Use with the `std::iter` module.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Utf16Units<'a> {
encoder: Utf16Encoder<Chars<'a>>
}
use vec::{DerefVec, Vec, as_vec};
/// A growable string stored as a UTF-8 encoded buffer.
-#[deriving(Clone, PartialOrd, Eq, Ord)]
+#[derive(Clone, PartialOrd, Eq, Ord)]
#[stable]
pub struct String {
vec: Vec<u8>,
/// let w = v.map_in_place(|i| i + 3);
/// assert_eq!(w.as_slice(), [3, 4, 5].as_slice());
///
- /// #[deriving(PartialEq, Show)]
+ /// #[derive(PartialEq, Show)]
/// struct Newtype(u8);
/// let bytes = vec![0x11, 0x22];
/// let newtyped_bytes = bytes.map_in_place(|x| Newtype(x));
#[test]
fn test_map_in_place_zero_sized() {
let v = vec![(), ()];
- #[deriving(PartialEq, Show)]
+ #[derive(PartialEq, Show)]
struct ZeroSized;
assert_eq!(v.map_in_place(|_| ZeroSized), [ZeroSized, ZeroSized]);
}
use std::sync::atomic;
use std::sync::atomic::AtomicUint;
- #[deriving(Clone, PartialEq, Show)]
+ #[derive(Clone, PartialEq, Show)]
struct Nothing;
impl Drop for Nothing { fn drop(&mut self) { } }
- #[deriving(Clone, PartialEq, Show)]
+ #[derive(Clone, PartialEq, Show)]
struct ZeroSized;
impl Drop for ZeroSized {
fn drop(&mut self) {
iter: slice::Iter<'a, Option<V>>
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, V> Clone for Iter<'a, V> {
fn clone(&self) -> Iter<'a, V> {
Iter {
iter: Map<(uint, &'a V), uint, Iter<'a, V>, fn((uint, &'a V)) -> uint>
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, V> Clone for Keys<'a, V> {
fn clone(&self) -> Keys<'a, V> {
Keys {
iter: Map<(uint, &'a V), &'a V, Iter<'a, V>, fn((uint, &'a V)) -> &'a V>
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, V> Clone for Values<'a, V> {
fn clone(&self) -> Values<'a, V> {
Values {
/// Rust's memory orderings are [the same as
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
#[stable]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Ordering {
/// No ordering constraints, only atomic operations.
#[stable]
/// An iterator over the characters that represent a `char`, as escaped by
/// Rust's unicode escaping rules.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct EscapeUnicode {
c: char,
state: EscapeUnicodeState
}
-#[deriving(Clone)]
+#[derive(Clone)]
enum EscapeUnicodeState {
Backslash,
Type,
/// An iterator over the characters that represent a `char`, escaped
/// for maximum portability.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct EscapeDefault {
state: EscapeDefaultState
}
-#[deriving(Clone)]
+#[derive(Clone)]
enum EscapeDefaultState {
Backslash(char),
Char(char),
}
/// An ordering is, e.g, a result of a comparison between two values.
-#[deriving(Clone, Copy, PartialEq, Show)]
+#[derive(Clone, Copy, PartialEq, Show)]
#[stable]
pub enum Ordering {
/// An ordering where a compared value is less [than another].
//! ```
//! use std::default::Default;
//!
-//! #[deriving(Default)]
+//! #[derive(Default)]
//! struct SomeOptions {
//! foo: int,
//! bar: f32,
//! fn default() -> Kind { Kind::A }
//! }
//!
-//! #[deriving(Default)]
+//! #[derive(Default)]
//! struct SomeOptions {
//! foo: int,
//! bar: f32,
//!
//! ```
//! # use std::default::Default;
-//! # #[deriving(Default)]
+//! # #[derive(Default)]
//! # struct SomeOptions {
//! # foo: int,
//! # bar: f32,
/// A trait that types which have a useful default value should implement.
///
/// A struct can derive default implementations of `Default` for basic types using
-/// `#[deriving(Default)]`.
+/// `#[derive(Default)]`.
///
/// # Examples
///
/// ```
-/// #[deriving(Default)]
+/// #[derive(Default)]
/// struct SomeOptions {
/// foo: int,
/// bar: f32,
/// 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)]
+#[derive(Copy)]
pub struct Error;
/// A collection of methods that are required to format a message into a stream.
/// 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)]
+#[derive(Copy)]
pub struct Argument<'a> {
value: &'a Void,
formatter: fn(&Void, &mut Formatter) -> Result,
/// macro validates the format string at compile-time so usage of the `write`
/// and `format` functions can be safely performed.
#[stable]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Arguments<'a> {
// Format string pieces to print.
pieces: &'a [&'a str],
}
/// A binary (base 2) radix
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
struct Binary;
/// An octal (base 8) radix
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
struct Octal;
/// A decimal (base 10) radix
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
struct Decimal;
/// A hexadecimal (base 16) radix, formatted with lower-case characters
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
struct LowerHex;
/// A hexadecimal (base 16) radix, formatted with upper-case characters
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
pub struct UpperHex;
macro_rules! radix {
x @ 10 ... 15 => b'A' + (x - 10) }
/// A radix with in the range of `2..36`.
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
#[unstable = "may be renamed or move to a different module"]
pub struct Radix {
base: u8,
/// A helper type for formatting radixes.
#[unstable = "may be renamed or move to a different module"]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct RadixFmt<T, R>(T, R);
/// Constructs a radix formatter in the range of `2..36`.
pub use self::Flag::*;
#[doc(hidden)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Argument<'a> {
pub position: Position,
pub format: FormatSpec,
}
#[doc(hidden)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct FormatSpec {
pub fill: char,
pub align: Alignment,
}
/// Possible alignments that can be requested as part of a formatting directive.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Alignment {
/// Indication that contents should be left-aligned.
AlignLeft,
}
#[doc(hidden)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Count {
CountIs(uint), CountIsParam(uint), CountIsNextParam, CountImplied,
}
#[doc(hidden)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Position {
ArgumentNext, ArgumentIs(uint)
}
/// 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)]
+#[derive(Copy)]
pub enum Flag {
/// A flag which enables number formatting to always print the sign of a
/// number.
//! Generic hashing support.
//!
//! This module provides a generic way to compute the hash of a value. The
-//! simplest way to make a type hashable is to use `#[deriving(Hash)]`:
+//! simplest way to make a type hashable is to use `#[derive(Hash)]`:
//!
//! # Examples
//!
//! use std::hash;
//! use std::hash::Hash;
//!
-//! #[deriving(Hash)]
+//! #[derive(Hash)]
//! struct Person {
//! id: uint,
//! name: String,
use super::{Hash, Hasher, Writer};
/// `SipState` computes a SipHash 2-4 hash over a stream of bytes.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct SipState {
k0: u64,
k1: u64,
}
/// `SipHasher` computes the SipHash algorithm from a stream of bytes.
-#[deriving(Clone)]
+#[derive(Clone)]
#[allow(missing_copy_implementations)]
pub struct SipHasher {
k0: u64,
pub type GlueFn = extern "Rust" fn(*const i8);
#[lang="ty_desc"]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct TyDesc {
// sizeof(T)
pub size: uint,
/// `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, Copy, PartialEq, Eq, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Show)]
pub struct TypeId {
t: u64,
}
impl<A, B> ExactSizeIterator for Zip<A, B> where A: ExactSizeIterator, B: ExactSizeIterator {}
/// An double-ended iterator with the direction inverted
-#[deriving(Clone)]
+#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Rev<T> {
}
/// `MinMaxResult` is an enum returned by `min_max`. See `IteratorOrdExt::min_max` for more detail.
-#[deriving(Clone, PartialEq, Show)]
+#[derive(Clone, PartialEq, Show)]
#[unstable = "waiting on namespaced enum conventions"]
pub enum MinMaxResult<T> {
/// Empty iterator
}
/// An iterator that repeats endlessly
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Cycle<I> {
}
/// An iterator that strings two iterators together
-#[deriving(Clone)]
+#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Chain<A, B> {
}
/// An iterator that iterates two other iterators simultaneously
-#[deriving(Clone)]
+#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Zip<A, B> {
f: F,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, B, I, F> Clone for Map<A, B, I, F> where
I: Clone + Iterator<Item=A>,
predicate: P,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, I, P> Clone for Filter<A, I, P> where
I: Clone + Iterator<Item=A>,
f: F,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, B, I, F> Clone for FilterMap<A, B, I, F> where
I: Clone + Iterator<Item=A>,
}
/// An iterator that yields the current count and the element during iteration
-#[deriving(Clone)]
+#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Enumerate<I> {
/// 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)]
+#[derive(Copy)]
pub struct Peekable<T, I> where I: Iterator<Item=T> {
iter: I,
peeked: Option<T>,
predicate: P,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, I, P> Clone for SkipWhile<A, I, P> where
I: Clone + Iterator<Item=A>,
predicate: P,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, I, P> Clone for TakeWhile<A, I, P> where
I: Clone + Iterator<Item=A>,
}
/// An iterator that skips over `n` elements of `iter`.
-#[deriving(Clone)]
+#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Skip<I> {
}
/// An iterator that only iterates over the first `n` iterations of `iter`.
-#[deriving(Clone)]
+#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Take<I> {
pub state: St,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, B, I, St, F> Clone for Scan<A, B, I, St, F> where
I: Clone + Iterator<Item=A>,
backiter: Option<U>,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, B, I, U, F> Clone for FlatMap<A, B, I, U, F> where
I: Clone + Iterator<Item=A>,
/// An iterator that yields `None` forever after the underlying iterator
/// yields `None` once.
-#[deriving(Clone)]
+#[derive(Clone)]
#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]
#[stable]
pub struct Fuse<I> {
f: F,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, I, F> Clone for Inspect<A, I, F> where
I: Clone + Iterator<Item=A>,
pub state: St,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<A, St, F> Clone for Unfold<A, St, F> where
F: Clone + FnMut(&mut St) -> Option<A>,
/// An infinite iterator starting at `start` and advancing by `step` with each
/// iteration
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
#[unstable = "may be renamed"]
pub struct Counter<A> {
/// The current state the counter is at (next value to be yielded)
}
/// An iterator over the range [start, stop)
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
#[unstable = "may be refactored due to numerics reform or ops reform"]
pub struct Range<A> {
state: A,
}
/// An iterator over the range [start, stop]
-#[deriving(Clone)]
+#[derive(Clone)]
#[unstable = "may be refactored due to numerics reform or ops reform"]
pub struct RangeInclusive<A> {
range: Range<A>,
}
/// An iterator over the range [start, stop) by `step`. It handles overflow by stopping.
-#[deriving(Clone)]
+#[derive(Clone)]
#[unstable = "may be refactored due to numerics reform or ops reform"]
pub struct RangeStep<A> {
state: A,
}
/// An iterator over the range [start, stop] by `step`. It handles overflow by stopping.
-#[deriving(Clone)]
+#[derive(Clone)]
#[unstable = "may be refactored due to numerics reform or ops reform"]
pub struct RangeStepInclusive<A> {
state: A,
/// An iterator that repeats an element endlessly
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct Repeat<A> {
element: A
/// (for example, `S<&'static int>` is a subtype of `S<&'a int>`
/// for some lifetime `'a`, but not the other way around).
#[lang="covariant_type"]
- #[deriving(PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct CovariantType<Sized? T>;
impl<Sized? T> Copy for CovariantType<T> {}
/// function requires arguments of type `T`, it must also accept
/// arguments of type `U`, hence such a conversion is safe.
#[lang="contravariant_type"]
- #[deriving(PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct ContravariantType<Sized? T>;
impl<Sized? T> Copy for ContravariantType<T> {}
/// never written, but in fact `Cell` uses unsafe code to achieve
/// interior mutability.
#[lang="invariant_type"]
- #[deriving(PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct InvariantType<Sized? T>;
impl<Sized? T> Copy for InvariantType<T> {}
/// For more information about variance, refer to this Wikipedia
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
#[lang="covariant_lifetime"]
- #[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct CovariantLifetime<'a>;
/// As `ContravariantType`, but for lifetime parameters. Using
/// For more information about variance, refer to this Wikipedia
/// article <http://en.wikipedia.org/wiki/Variance_%28computer_science%29>.
#[lang="contravariant_lifetime"]
- #[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct ContravariantLifetime<'a>;
/// As `InvariantType`, but for lifetime parameters. Using
/// and this pointer is itself stored in an inherently mutable
/// location (such as a `Cell`).
#[lang="invariant_lifetime"]
- #[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct InvariantLifetime<'a>;
/// A type which is considered "not sendable", meaning that it cannot
/// typically embedded in other types, such as `Gc`, to ensure that
/// their instances remain thread-local.
#[lang="no_send_bound"]
- #[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct NoSend;
/// A type which is considered "not POD", meaning that it is not
/// implicitly copyable. This is typically embedded in other types to
/// ensure that they are never copied, even if they lack a destructor.
#[lang="no_copy_bound"]
- #[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
#[allow(missing_copy_implementations)]
pub struct NoCopy;
/// its contents are not threadsafe, hence they cannot be
/// shared between tasks.
#[lang="no_sync_bound"]
- #[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct NoSync;
/// A type which is considered managed by the GC. This is typically
/// embedded in other types.
#[lang="managed_bound"]
- #[deriving(Clone, PartialEq, Eq, PartialOrd, Ord)]
+ #[derive(Clone, PartialEq, Eq, PartialOrd, Ord)]
#[allow(missing_copy_implementations)]
pub struct Managed;
}
/// A wrapper type for raw pointers and integers that will never be
/// NULL or 0 that might allow certain optimizations.
#[lang="non_zero"]
-#[deriving(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Show)]
+#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Show)]
#[experimental]
pub struct NonZero<T: Zeroable>(T);
impl_num_cast! { f64, to_f64 }
/// Used for representing the classification of floating point numbers
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
#[unstable = "may be renamed"]
pub enum FpCategory {
/// "Not a Number", often obtained by dividing by zero
//!
//! use std::ops::{Add, Sub};
//!
-//! #[deriving(Show)]
+//! #[derive(Show)]
//! struct Point {
//! x: int,
//! y: int
///
/// use std::ops::Add;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Add for Foo {
///
/// use std::ops::Sub;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Sub for Foo {
///
/// use std::ops::Mul;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Mul for Foo {
///
/// use std::ops::Div;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Div for Foo {
///
/// use std::ops::Rem;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Rem for Foo {
///
/// use std::ops::BitAnd;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl BitAnd for Foo {
///
/// use std::ops::BitOr;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl BitOr for Foo {
///
/// use std::ops::BitXor;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl BitXor for Foo {
///
/// use std::ops::Shl;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Shl<Foo> for Foo {
///
/// use std::ops::Shr;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Shr<Foo> for Foo {
///
/// use std::ops::Index;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Index<Foo> for Foo {
///
/// use std::ops::IndexMut;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl IndexMut<Foo> for Foo {
/// ```ignore
/// use std::ops::Slice;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl Slice<Foo, Foo> for Foo {
/// ```ignore
/// use std::ops::SliceMut;
///
-/// #[deriving(Copy)]
+/// #[derive(Copy)]
/// struct Foo;
///
/// impl SliceMut<Foo, Foo> for Foo {
/// An unbounded range.
-#[deriving(Copy)]
+#[derive(Copy)]
#[lang="full_range"]
pub struct FullRange;
/// A (half-open) range which is bounded at both ends.
-#[deriving(Copy)]
+#[derive(Copy)]
#[lang="range"]
pub struct Range<Idx> {
/// The lower bound of the range (inclusive).
impl<Idx: Clone + Step> ExactSizeIterator for Range<Idx> {}
/// A range which is only bounded below.
-#[deriving(Copy)]
+#[derive(Copy)]
#[lang="range_from"]
pub struct RangeFrom<Idx> {
/// The lower bound of the range (inclusive).
}
/// A range which is only bounded above.
-#[deriving(Copy)]
+#[derive(Copy)]
#[lang="range_to"]
pub struct RangeTo<Idx> {
/// The upper bound of the range (exclusive).
// which basically means it must be `Option`.
/// The `Option` type.
-#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
+#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
#[stable]
pub enum Option<T> {
/// No value
// The Option Iterators
/////////////////////////////////////////////////////////////////////////////
-#[deriving(Clone)]
+#[derive(Clone)]
struct Item<A> {
opt: Option<A>
}
/// The representation of a Rust closure
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Closure {
pub code: *mut (),
pub env: *mut (),
/// This struct does not have a `Repr` implementation
/// because there is no way to refer to all trait objects generically.
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct TraitObject {
pub data: *mut (),
pub vtable: *mut (),
//! defined and used like so:
//!
//! ```
-//! #[deriving(Show)]
+//! #[derive(Show)]
//! enum Version { Version1, Version2 }
//!
//! fn parse_version(header: &[u8]) -> Result<Version, &'static str> {
/// `Result` is a type that represents either success (`Ok`) or failure (`Err`).
///
/// See the [`std::result`](index.html) module documentation for details.
-#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
+#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Show, Hash)]
#[must_use]
#[stable]
pub enum Result<T, E> {
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
pub i8, pub i8, pub i8, pub i8,
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
pub i16, pub i16, pub i16, pub i16);
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct i64x2(pub i64, pub i64);
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
pub u8, pub u8, pub u8, pub u8,
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
pub u16, pub u16, pub u16, pub u16);
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct u64x2(pub u64, pub u64);
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
#[experimental]
#[simd]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
#[repr(C)]
pub struct f64x2(pub f64, pub f64);
finished: bool
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
#[stable]
impl<'a, T, P> Clone for Split<'a, T, P> where P: Clone + FnMut(&T) -> bool {
fn clone(&self) -> Split<'a, T, P> {
forward_iterator! { RSplitNMut: T, &'a mut [T] }
/// An iterator over overlapping subslices of length `size`.
-#[deriving(Clone)]
+#[derive(Clone)]
#[experimental = "needs review"]
pub struct Windows<'a, T:'a> {
v: &'a [T],
///
/// When the slice len is not evenly divided by the chunk size, the last slice
/// of the iteration will be the remainder.
-#[deriving(Clone)]
+#[derive(Clone)]
#[experimental = "needs review"]
pub struct Chunks<'a, T:'a> {
v: &'a [T],
*/
/// Errors which can occur when attempting to interpret a byte slice as a `str`.
-#[deriving(Copy, Eq, PartialEq, Clone)]
+#[derive(Copy, Eq, PartialEq, Clone)]
pub enum Utf8Error {
/// An invalid byte was detected at the byte offset given.
///
/// Iterator for the char (representing *Unicode Scalar Values*) of a string
///
/// Created with the method `.chars()`.
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct Chars<'a> {
iter: slice::Iter<'a, u8>
}
/// External iterator for a string's characters and their byte offsets.
/// Use with the `std::iter` module.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct CharIndices<'a> {
front_offset: uint,
iter: Chars<'a>,
///
/// Created with `StrExt::bytes`
#[stable]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Bytes<'a>(Map<&'a u8, u8, slice::Iter<'a, u8>, BytesDeref>);
delegate_iter!{exact u8 in Bytes<'a>}
/// A temporary fn new type that ensures that the `Bytes` iterator
/// is cloneable.
-#[deriving(Copy, Clone)]
+#[derive(Copy, Clone)]
struct BytesDeref;
impl<'a> Fn(&'a u8) -> u8 for BytesDeref {
}
/// An iterator over the substrings of a string, separated by `sep`.
-#[deriving(Clone)]
+#[derive(Clone)]
#[deprecated = "Type is now named `Split` or `SplitTerminator`"]
pub struct CharSplits<'a, Sep> {
/// The slice remaining to be iterated
/// An iterator over the substrings of a string, separated by `sep`,
/// splitting at most `count` times.
-#[deriving(Clone)]
+#[derive(Clone)]
#[deprecated = "Type is now named `SplitN` or `RSplitN`"]
pub struct CharSplitsN<'a, Sep> {
iter: CharSplits<'a, Sep>,
/// The internal state of an iterator that searches for matches of a substring
/// within a larger string using naive search
-#[deriving(Clone)]
+#[derive(Clone)]
struct NaiveSearcher {
position: uint
}
/// The internal state of an iterator that searches for matches of a substring
/// within a larger string using two-way search
-#[deriving(Clone)]
+#[derive(Clone)]
struct TwoWaySearcher {
// constants
crit_pos: uint,
/// The internal state of an iterator that searches for matches of a substring
/// within a larger string using a dynamically chosen search algorithm
-#[deriving(Clone)]
+#[derive(Clone)]
enum Searcher {
Naive(NaiveSearcher),
TwoWay(TwoWaySearcher),
/// An iterator over the start and end indices of the matches of a
/// substring within a larger string
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct MatchIndices<'a> {
// constants
haystack: &'a str,
/// An iterator over the substrings of a string separated by a given
/// search string
-#[deriving(Clone)]
+#[derive(Clone)]
#[unstable = "Type might get removed"]
pub struct SplitStr<'a> {
it: MatchIndices<'a>,
/// 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)]
+#[derive(Copy)]
#[unstable = "naming is uncertain with container conventions"]
pub struct CharRange {
/// Current `char`
}
/// Return type of `StrExt::split`
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct Split<'a, P>(CharSplits<'a, P>);
delegate_iter!{pattern &'a str in Split<'a, P>}
/// Return type of `StrExt::split_terminator`
-#[deriving(Clone)]
+#[derive(Clone)]
#[unstable = "might get removed in favour of a constructor method on Split"]
pub struct SplitTerminator<'a, P>(CharSplits<'a, P>);
delegate_iter!{pattern &'a str in SplitTerminator<'a, P>}
/// Return type of `StrExt::splitn`
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct SplitN<'a, P>(CharSplitsN<'a, P>);
delegate_iter!{pattern forward &'a str in SplitN<'a, P>}
/// Return type of `StrExt::rsplitn`
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct RSplitN<'a, P>(CharSplitsN<'a, P>);
delegate_iter!{pattern forward &'a str in RSplitN<'a, P>}
use test::Bencher;
use test;
-#[deriving(PartialEq, Show)]
+#[derive(PartialEq, Show)]
struct Test;
static TEST: &'static str = "Test";
/// 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(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Piece<'a> {
/// A literal string which should directly be emitted
String(&'a str),
}
/// Representation of an argument specification.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub struct Argument<'a> {
/// Where to find this argument
pub position: Position<'a>,
}
/// Specification for the formatting of an argument in the format string.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub struct FormatSpec<'a> {
/// Optionally specified character to fill alignment with
pub fill: Option<char>,
}
/// Enum describing where an argument for a format can be located.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Position<'a> {
/// The argument will be in the next position. This is the default.
ArgumentNext,
}
/// Enum of alignments which are supported.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Alignment {
/// The value will be aligned to the left.
AlignLeft,
/// Various flags which can be applied to format strings. The meaning of these
/// flags is defined by the formatters themselves.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Flag {
/// A `+` will be used to denote positive numbers.
FlagSignPlus,
/// A count is used for the precision and width parameters of an integer, and
/// can reference either an argument or a literal integer.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Count<'a> {
/// The count is specified explicitly.
CountIs(uint),
use std::result;
/// Name of an option. Either a string or a single char.
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub enum Name {
/// A string representing the long name of an option.
/// For example: "help"
}
/// Describes whether an option has an argument.
-#[deriving(Clone, Copy, PartialEq, Eq)]
+#[derive(Clone, Copy, PartialEq, Eq)]
pub enum HasArg {
/// The option requires an argument.
Yes,
}
/// Describes how often an option may occur.
-#[deriving(Clone, Copy, PartialEq, Eq)]
+#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Occur {
/// The option occurs once.
Req,
}
/// A description of a possible option.
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub struct Opt {
/// Name of the option
pub name: Name,
/// One group of options, e.g., both `-h` and `--help`, along with
/// their shared description and properties.
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub struct OptGroup {
/// Short name of the option, e.g. `h` for a `-h` option
pub short_name: String,
}
/// Describes whether an option is given at all or has a value.
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
enum Optval {
Val(String),
Given,
/// The result of checking command line arguments. Contains a vector
/// of matches and a vector of free strings.
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub struct Matches {
/// Options that matched
opts: Vec<Opt>,
/// The type returned when the command line does not conform to the
/// expected format. Use the `Show` implementation to output detailed
/// information.
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub enum Fail {
/// The option requires an argument but none was passed.
ArgumentMissing(String),
}
/// The type of failure that occurred.
-#[deriving(Copy, PartialEq, Eq)]
+#[derive(Copy, PartialEq, Eq)]
#[allow(missing_docs)]
pub enum FailType {
ArgumentMissing_,
line
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum SplitWithinState {
A, // leading whitespace, initial state
B, // words
C, // internal and trailing whitespace
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum Whitespace {
Ws, // current char is whitespace
Cr // current char is not whitespace
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum LengthLimit {
UnderLim, // current char makes current substring still fit in limit
OverLim // current char makes current substring no longer fit in limit
fn target(&'a self, edge: &E) -> N;
}
-#[deriving(Copy, PartialEq, Eq, Show)]
+#[derive(Copy, PartialEq, Eq, Show)]
pub enum RenderOption {
NoEdgeLabels,
NoNodeLabels,
pub type pthread_t = c_ulong;
#[repr(C)]
- #[deriving(Copy)] pub struct glob_t {
+ #[derive(Copy)] pub struct glob_t {
pub gl_pathc: size_t,
pub gl_pathv: *mut *mut c_char,
pub gl_offs: size_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timeval {
+ #[derive(Copy)] pub struct timeval {
pub tv_sec: time_t,
pub tv_usec: suseconds_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timespec {
+ #[derive(Copy)] pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
}
- #[deriving(Copy)] pub enum timezone {}
+ #[derive(Copy)] pub enum timezone {}
pub type sighandler_t = size_t;
}
pub type in_port_t = u16;
pub type in_addr_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr {
+ #[derive(Copy)] pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_storage {
+ #[derive(Copy)] pub struct sockaddr_storage {
pub ss_family: sa_family_t,
pub __ss_align: i64,
pub __ss_pad2: [u8; 112],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in {
+ #[derive(Copy)] pub struct sockaddr_in {
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_addr: in_addr,
pub sin_zero: [u8; 8],
}
#[repr(C)]
- #[deriving(Copy)] pub struct in_addr {
+ #[derive(Copy)] pub struct in_addr {
pub s_addr: in_addr_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in6 {
+ #[derive(Copy)] pub struct sockaddr_in6 {
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
pub sin6_flowinfo: u32,
pub sin6_scope_id: u32,
}
#[repr(C)]
- #[deriving(Copy)] pub struct in6_addr {
+ #[derive(Copy)] pub struct in6_addr {
pub s6_addr: [u16; 8]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip_mreq {
+ #[derive(Copy)] pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip6_mreq {
+ #[derive(Copy)] pub struct ip6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
#[repr(C)]
- #[deriving(Copy)] pub struct addrinfo {
+ #[derive(Copy)] pub struct addrinfo {
pub ai_flags: c_int,
pub ai_family: c_int,
pub ai_socktype: c_int,
pub ai_next: *mut addrinfo,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_un {
+ #[derive(Copy)] pub struct sockaddr_un {
pub sun_family: sa_family_t,
pub sun_path: [c_char; 108]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ifaddrs {
+ #[derive(Copy)] pub struct ifaddrs {
pub ifa_next: *mut ifaddrs,
pub ifa_name: *mut c_char,
pub ifa_flags: c_uint,
pub type blkcnt_t = i32;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: dev_t,
pub __pad1: c_short,
pub st_ino: ino_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct pthread_attr_t {
+ #[derive(Copy)] pub struct pthread_attr_t {
pub __size: [u32; 9]
}
}
pub type blkcnt_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: c_ulonglong,
pub __pad0: [c_uchar; 4],
pub __st_ino: ino_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct pthread_attr_t {
+ #[derive(Copy)] pub struct pthread_attr_t {
pub __size: [u32; 9]
}
}
pub type blkcnt_t = i32;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: c_ulong,
pub st_pad1: [c_long; 3],
pub st_ino: ino_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct pthread_attr_t {
+ #[derive(Copy)] pub struct pthread_attr_t {
pub __size: [u32; 9]
}
}
pub mod extra {
use types::os::arch::c95::{c_ushort, c_int, c_uchar};
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_ll {
+ #[derive(Copy)] pub struct sockaddr_ll {
pub sll_family: c_ushort,
pub sll_protocol: c_ushort,
pub sll_ifindex: c_int,
pub type blkcnt_t = i64;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_nlink: nlink_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct pthread_attr_t {
+ #[derive(Copy)] pub struct pthread_attr_t {
pub __size: [u64; 7]
}
}
pub type blkcnt_t = i64;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_mode: mode_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct pthread_attr_t {
+ #[derive(Copy)] pub struct pthread_attr_t {
pub __size: [u64; 8]
}
}
}
pub mod extra {
use types::os::arch::c95::{c_ushort, c_int, c_uchar};
- #[deriving(Copy)] pub struct sockaddr_ll {
+ #[derive(Copy)] pub struct sockaddr_ll {
pub sll_family: c_ushort,
pub sll_protocol: c_ushort,
pub sll_ifindex: c_int,
pub type pthread_t = uintptr_t;
#[repr(C)]
- #[deriving(Copy)] pub struct glob_t {
+ #[derive(Copy)] pub struct glob_t {
pub gl_pathc: size_t,
pub __unused1: size_t,
pub gl_offs: size_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timeval {
+ #[derive(Copy)] pub struct timeval {
pub tv_sec: time_t,
pub tv_usec: suseconds_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timespec {
+ #[derive(Copy)] pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
}
- #[deriving(Copy)] pub enum timezone {}
+ #[derive(Copy)] pub enum timezone {}
pub type sighandler_t = size_t;
}
pub type in_port_t = u16;
pub type in_addr_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr {
+ #[derive(Copy)] pub struct sockaddr {
pub sa_len: u8,
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_storage {
+ #[derive(Copy)] pub struct sockaddr_storage {
pub ss_len: u8,
pub ss_family: sa_family_t,
pub __ss_pad1: [u8; 6],
pub __ss_pad2: [u8; 112],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in {
+ #[derive(Copy)] pub struct sockaddr_in {
pub sin_len: u8,
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_zero: [u8; 8],
}
#[repr(C)]
- #[deriving(Copy)] pub struct in_addr {
+ #[derive(Copy)] pub struct in_addr {
pub s_addr: in_addr_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in6 {
+ #[derive(Copy)] pub struct sockaddr_in6 {
pub sin6_len: u8,
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
pub sin6_scope_id: u32,
}
#[repr(C)]
- #[deriving(Copy)] pub struct in6_addr {
+ #[derive(Copy)] pub struct in6_addr {
pub s6_addr: [u16; 8]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip_mreq {
+ #[derive(Copy)] pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip6_mreq {
+ #[derive(Copy)] pub struct ip6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
#[repr(C)]
- #[deriving(Copy)] pub struct addrinfo {
+ #[derive(Copy)] pub struct addrinfo {
pub ai_flags: c_int,
pub ai_family: c_int,
pub ai_socktype: c_int,
pub ai_next: *mut addrinfo,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_un {
+ #[derive(Copy)] pub struct sockaddr_un {
pub sun_len: u8,
pub sun_family: sa_family_t,
pub sun_path: [c_char; 104]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ifaddrs {
+ #[derive(Copy)] pub struct ifaddrs {
pub ifa_next: *mut ifaddrs,
pub ifa_name: *mut c_char,
pub ifa_flags: c_uint,
pub type blkcnt_t = i64;
pub type fflags_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_mode: mode_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
pub type pthread_t = uintptr_t;
#[repr(C)]
- #[deriving(Copy)] pub struct glob_t {
+ #[derive(Copy)] pub struct glob_t {
pub gl_pathc: size_t,
pub __unused1: size_t,
pub gl_offs: size_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timeval {
+ #[derive(Copy)] pub struct timeval {
pub tv_sec: time_t,
pub tv_usec: suseconds_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timespec {
+ #[derive(Copy)] pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
}
- #[deriving(Copy)] pub enum timezone {}
+ #[derive(Copy)] pub enum timezone {}
pub type sighandler_t = size_t;
}
pub type in_port_t = u16;
pub type in_addr_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr {
+ #[derive(Copy)] pub struct sockaddr {
pub sa_len: u8,
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_storage {
+ #[derive(Copy)] pub struct sockaddr_storage {
pub ss_len: u8,
pub ss_family: sa_family_t,
pub __ss_pad1: [u8; 6],
pub __ss_pad2: [u8; 112],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in {
+ #[derive(Copy)] pub struct sockaddr_in {
pub sin_len: u8,
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_zero: [u8; 8],
}
#[repr(C)]
- #[deriving(Copy)] pub struct in_addr {
+ #[derive(Copy)] pub struct in_addr {
pub s_addr: in_addr_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in6 {
+ #[derive(Copy)] pub struct sockaddr_in6 {
pub sin6_len: u8,
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
pub sin6_scope_id: u32,
}
#[repr(C)]
- #[deriving(Copy)] pub struct in6_addr {
+ #[derive(Copy)] pub struct in6_addr {
pub s6_addr: [u16; 8]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip_mreq {
+ #[derive(Copy)] pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip6_mreq {
+ #[derive(Copy)] pub struct ip6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
#[repr(C)]
- #[deriving(Copy)] pub struct addrinfo {
+ #[derive(Copy)] pub struct addrinfo {
pub ai_flags: c_int,
pub ai_family: c_int,
pub ai_socktype: c_int,
pub ai_next: *mut addrinfo,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_un {
+ #[derive(Copy)] pub struct sockaddr_un {
pub sun_len: u8,
pub sun_family: sa_family_t,
pub sun_path: [c_char; 104]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ifaddrs {
+ #[derive(Copy)] pub struct ifaddrs {
pub ifa_next: *mut ifaddrs,
pub ifa_name: *mut c_char,
pub ifa_flags: c_uint,
pub type fflags_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_ino: ino_t,
pub st_nlink: nlink_t,
pub st_dev: dev_t,
pub st_qspare2: int64_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
// pub Note: this is the struct called stat64 in Windows. Not stat,
// nor stati64.
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: dev_t,
pub st_ino: ino_t,
pub st_mode: u16,
// note that this is called utimbuf64 in Windows
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time64_t,
pub modtime: time64_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timeval {
+ #[derive(Copy)] pub struct timeval {
pub tv_sec: c_long,
pub tv_usec: c_long,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timespec {
+ #[derive(Copy)] pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
}
- #[deriving(Copy)] pub enum timezone {}
+ #[derive(Copy)] pub enum timezone {}
}
pub mod bsd44 {
pub type in_port_t = u16;
pub type in_addr_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr {
+ #[derive(Copy)] pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_storage {
+ #[derive(Copy)] pub struct sockaddr_storage {
pub ss_family: sa_family_t,
pub __ss_pad1: [u8; 6],
pub __ss_align: i64,
pub __ss_pad2: [u8; 112],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in {
+ #[derive(Copy)] pub struct sockaddr_in {
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
pub sin_addr: in_addr,
pub sin_zero: [u8; 8],
}
#[repr(C)]
- #[deriving(Copy)] pub struct in_addr {
+ #[derive(Copy)] pub struct in_addr {
pub s_addr: in_addr_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in6 {
+ #[derive(Copy)] pub struct sockaddr_in6 {
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
pub sin6_flowinfo: u32,
pub sin6_scope_id: u32,
}
#[repr(C)]
- #[deriving(Copy)] pub struct in6_addr {
+ #[derive(Copy)] pub struct in6_addr {
pub s6_addr: [u16; 8]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip_mreq {
+ #[derive(Copy)] pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip6_mreq {
+ #[derive(Copy)] pub struct ip6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
#[repr(C)]
- #[deriving(Copy)] pub struct addrinfo {
+ #[derive(Copy)] pub struct addrinfo {
pub ai_flags: c_int,
pub ai_family: c_int,
pub ai_socktype: c_int,
pub ai_next: *mut addrinfo,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_un {
+ #[derive(Copy)] pub struct sockaddr_un {
pub sun_family: sa_family_t,
pub sun_path: [c_char; 108]
}
pub type LPCH = *mut CHAR;
#[repr(C)]
- #[deriving(Copy)] pub struct SECURITY_ATTRIBUTES {
+ #[derive(Copy)] pub struct SECURITY_ATTRIBUTES {
pub nLength: DWORD,
pub lpSecurityDescriptor: LPVOID,
pub bInheritHandle: BOOL,
pub type int64 = i64;
#[repr(C)]
- #[deriving(Copy)] pub struct STARTUPINFO {
+ #[derive(Copy)] pub struct STARTUPINFO {
pub cb: DWORD,
pub lpReserved: LPWSTR,
pub lpDesktop: LPWSTR,
pub type LPSTARTUPINFO = *mut STARTUPINFO;
#[repr(C)]
- #[deriving(Copy)] pub struct PROCESS_INFORMATION {
+ #[derive(Copy)] pub struct PROCESS_INFORMATION {
pub hProcess: HANDLE,
pub hThread: HANDLE,
pub dwProcessId: DWORD,
pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
#[repr(C)]
- #[deriving(Copy)] pub struct SYSTEM_INFO {
+ #[derive(Copy)] pub struct SYSTEM_INFO {
pub wProcessorArchitecture: WORD,
pub wReserved: WORD,
pub dwPageSize: DWORD,
pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
#[repr(C)]
- #[deriving(Copy)] pub struct MEMORY_BASIC_INFORMATION {
+ #[derive(Copy)] pub struct MEMORY_BASIC_INFORMATION {
pub BaseAddress: LPVOID,
pub AllocationBase: LPVOID,
pub AllocationProtect: DWORD,
pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
#[repr(C)]
- #[deriving(Copy)] pub struct OVERLAPPED {
+ #[derive(Copy)] pub struct OVERLAPPED {
pub Internal: *mut c_ulong,
pub InternalHigh: *mut c_ulong,
pub Offset: DWORD,
pub type LPOVERLAPPED = *mut OVERLAPPED;
#[repr(C)]
- #[deriving(Copy)] pub struct FILETIME {
+ #[derive(Copy)] pub struct FILETIME {
pub dwLowDateTime: DWORD,
pub dwHighDateTime: DWORD,
}
pub type LPFILETIME = *mut FILETIME;
#[repr(C)]
- #[deriving(Copy)] pub struct GUID {
+ #[derive(Copy)] pub struct GUID {
pub Data1: DWORD,
pub Data2: WORD,
pub Data3: WORD,
}
#[repr(C)]
- #[deriving(Copy)] pub struct WSAPROTOCOLCHAIN {
+ #[derive(Copy)] pub struct WSAPROTOCOLCHAIN {
pub ChainLen: c_int,
pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as uint],
}
pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
#[repr(C)]
- #[deriving(Copy)] pub struct WSAPROTOCOL_INFO {
+ #[derive(Copy)] pub struct WSAPROTOCOL_INFO {
pub dwServiceFlags1: DWORD,
pub dwServiceFlags2: DWORD,
pub dwServiceFlags3: DWORD,
pub type GROUP = c_uint;
#[repr(C)]
- #[deriving(Copy)] pub struct WIN32_FIND_DATAW {
+ #[derive(Copy)] pub struct WIN32_FIND_DATAW {
pub dwFileAttributes: DWORD,
pub ftCreationTime: FILETIME,
pub ftLastAccessTime: FILETIME,
pub type pthread_t = uintptr_t;
#[repr(C)]
- #[deriving(Copy)] pub struct glob_t {
+ #[derive(Copy)] pub struct glob_t {
pub gl_pathc: size_t,
pub __unused1: c_int,
pub gl_offs: size_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timeval {
+ #[derive(Copy)] pub struct timeval {
pub tv_sec: time_t,
pub tv_usec: suseconds_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct timespec {
+ #[derive(Copy)] pub struct timespec {
pub tv_sec: time_t,
pub tv_nsec: c_long,
}
- #[deriving(Copy)] pub enum timezone {}
+ #[derive(Copy)] pub enum timezone {}
pub type sighandler_t = size_t;
}
pub type in_port_t = u16;
pub type in_addr_t = u32;
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr {
+ #[derive(Copy)] pub struct sockaddr {
pub sa_len: u8,
pub sa_family: sa_family_t,
pub sa_data: [u8; 14],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_storage {
+ #[derive(Copy)] pub struct sockaddr_storage {
pub ss_len: u8,
pub ss_family: sa_family_t,
pub __ss_pad1: [u8; 6],
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in {
+ #[derive(Copy)] pub struct sockaddr_in {
pub sin_len: u8,
pub sin_family: sa_family_t,
pub sin_port: in_port_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct in_addr {
+ #[derive(Copy)] pub struct in_addr {
pub s_addr: in_addr_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_in6 {
+ #[derive(Copy)] pub struct sockaddr_in6 {
pub sin6_len: u8,
pub sin6_family: sa_family_t,
pub sin6_port: in_port_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct in6_addr {
+ #[derive(Copy)] pub struct in6_addr {
pub s6_addr: [u16; 8]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip_mreq {
+ #[derive(Copy)] pub struct ip_mreq {
pub imr_multiaddr: in_addr,
pub imr_interface: in_addr,
}
#[repr(C)]
- #[deriving(Copy)] pub struct ip6_mreq {
+ #[derive(Copy)] pub struct ip6_mreq {
pub ipv6mr_multiaddr: in6_addr,
pub ipv6mr_interface: c_uint,
}
#[repr(C)]
- #[deriving(Copy)] pub struct addrinfo {
+ #[derive(Copy)] pub struct addrinfo {
pub ai_flags: c_int,
pub ai_family: c_int,
pub ai_socktype: c_int,
}
#[repr(C)]
- #[deriving(Copy)] pub struct sockaddr_un {
+ #[derive(Copy)] pub struct sockaddr_un {
pub sun_len: u8,
pub sun_family: sa_family_t,
pub sun_path: [c_char; 104]
}
#[repr(C)]
- #[deriving(Copy)] pub struct ifaddrs {
+ #[derive(Copy)] pub struct ifaddrs {
pub ifa_next: *mut ifaddrs,
pub ifa_name: *mut c_char,
pub ifa_flags: c_uint,
pub type blkcnt_t = i32;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: dev_t,
pub st_mode: mode_t,
pub st_nlink: nlink_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct pthread_attr_t {
+ #[derive(Copy)] pub struct pthread_attr_t {
pub __sig: c_long,
pub __opaque: [c_char; 36]
}
}
pub mod extra {
#[repr(C)]
- #[deriving(Copy)] pub struct mach_timebase_info {
+ #[derive(Copy)] pub struct mach_timebase_info {
pub numer: u32,
pub denom: u32,
}
pub type blkcnt_t = i32;
#[repr(C)]
- #[deriving(Copy)] pub struct stat {
+ #[derive(Copy)] pub struct stat {
pub st_dev: dev_t,
pub st_mode: mode_t,
pub st_nlink: nlink_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct utimbuf {
+ #[derive(Copy)] pub struct utimbuf {
pub actime: time_t,
pub modtime: time_t,
}
#[repr(C)]
- #[deriving(Copy)] pub struct pthread_attr_t {
+ #[derive(Copy)] pub struct pthread_attr_t {
pub __sig: c_long,
pub __opaque: [c_char; 56]
}
}
pub mod extra {
#[repr(C)]
- #[deriving(Copy)] pub struct mach_timebase_info {
+ #[derive(Copy)] pub struct mach_timebase_info {
pub numer: u32,
pub denom: u32,
}
use std::ascii::AsciiExt;
use std::cmp;
-#[deriving(Show, Clone)]
+#[derive(Show, Clone)]
pub struct LogDirective {
pub name: Option<String>,
pub level: u32,
}
/// Wraps the log level with fmt implementations.
-#[deriving(Copy, PartialEq, PartialOrd)]
+#[derive(Copy, PartialEq, PartialOrd)]
pub struct LogLevel(pub u32);
impl fmt::Show for LogLevel {
/// A LogRecord is created by the logging macros, and passed as the only
/// argument to Loggers.
-#[deriving(Show)]
+#[derive(Show)]
pub struct LogRecord<'a> {
/// The module path of where the LogRecord originated.
}
#[doc(hidden)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct LogLocation {
pub module_path: &'static str,
pub file: &'static str,
/// [1]: D. J. Bernstein, [*ChaCha, a variant of
/// Salsa20*](http://cr.yp.to/chacha.html)
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ChaChaRng {
buffer: [u32; STATE_WORDS], // Internal buffer of output
state: [u32; STATE_WORDS], // Initial state
/// Generate Normal Random
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
/// College, Oxford
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Exp1(pub f64);
// This could be done via `-rng.gen::<f64>().ln()` but that is slower.
/// let v = exp.ind_sample(&mut rand::thread_rng());
/// println!("{} is from a Exp(2) distribution", v);
/// ```
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Exp {
/// `lambda` stored as `1/lambda`, since this is what we scale by.
lambda_inverse: f64
use {Rng, Rand};
use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample};
- #[deriving(PartialEq, Show)]
+ #[derive(PartialEq, Show)]
struct ConstRand(uint);
impl Rand for ConstRand {
fn rand<R: Rng>(_: &mut R) -> ConstRand {
/// Generate Normal Random
/// Samples*](http://www.doornik.com/research/ziggurat.pdf). Nuffield
/// College, Oxford
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct StandardNormal(pub f64);
impl Rand for StandardNormal {
/// let v = normal.ind_sample(&mut rand::thread_rng());
/// println!("{} is from a N(2, 9) distribution", v)
/// ```
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Normal {
mean: f64,
std_dev: f64,
/// let v = log_normal.ind_sample(&mut rand::thread_rng());
/// println!("{} is from an ln N(2, 9) distribution", v)
/// ```
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct LogNormal {
norm: Normal
}
///
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
/// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct IsaacRng {
cnt: u32,
rsl: [u32; RAND_SIZE_UINT],
///
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
/// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Isaac64Rng {
cnt: uint,
rsl: [u64; RAND_SIZE_64],
/// Reseed an RNG using a `Default` instance. This reseeds by
/// replacing the RNG with the result of a `Default::default` call.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ReseedWithDefault;
impl<R: Rng + Default> Reseeder<R> for ReseedWithDefault {
pub mod io;
/// Common data structures
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct Doc<'a> {
pub data: &'a [u8],
pub start: uint,
pub doc: Doc<'a>,
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum EbmlEncoderTag {
EsUint, // 0
EsU64, // 1
EsLabel, // Used only when debugging
}
-#[deriving(Show)]
+#[derive(Show)]
pub enum Error {
IntTooBig(uint),
Expected(String),
)
}
- #[deriving(Copy)]
+ #[derive(Copy)]
pub struct Res {
pub val: uint,
pub next: uint
type InstIdx = uint;
-#[deriving(Show, Clone)]
+#[derive(Show, Clone)]
pub enum Inst {
// When a Match instruction is executed, the current thread is successful.
Match,
/// All of the data in a compiled expression is wrapped in "MaybeStatic" or
/// "MaybeOwned" types so that a `Program` can be represented as static data.
/// (This makes it convenient and efficient for use with the `regex!` macro.)
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Program {
/// A sequence of instructions.
pub insts: Vec<Inst>,
///
/// Note that this representation prevents one from reproducing the regex as
/// it was typed. (But it could be used to reproduce an equivalent regex.)
-#[deriving(Show, Clone)]
+#[derive(Show, Clone)]
pub enum Ast {
Nothing,
Literal(char, Flags),
Rep(Box<Ast>, Repeater, Greed),
}
-#[deriving(Show, PartialEq, Clone)]
+#[derive(Show, PartialEq, Clone)]
pub enum Repeater {
ZeroOne,
ZeroMore,
OneMore,
}
-#[deriving(Copy, Show, Clone)]
+#[derive(Copy, Show, Clone)]
pub enum Greed {
Greedy,
Ungreedy,
/// constructing an abstract syntax tree. Its central purpose is to facilitate
/// parsing groups and alternations while also maintaining a stack of flag
/// state.
-#[deriving(Show)]
+#[derive(Show)]
enum BuildAst {
Expr(Ast),
Paren(Flags, uint, String), // '('
/// makes it much faster when searching text.
/// More details about the `regex!` macro can be found in the `regex` crate
/// documentation.
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum Regex {
// The representation of `Regex` is exported to support the `regex!`
// syntax extension. Do not rely on it.
Native(ExNative),
}
-#[deriving(Clone)]
+#[derive(Clone)]
#[doc(hidden)]
pub struct ExDynamic {
original: String,
}
#[doc(hidden)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ExNative {
#[doc(hidden)]
pub original: &'static str,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum NamesIter<'a> {
NamesIterNative(::std::slice::Iter<'a, Option<&'static str>>),
NamesIterDynamic(::std::slice::Iter<'a, Option<String>>)
///
/// `'r` is the lifetime of the compiled expression and `'t` is the lifetime
/// of the string being split.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct RegexSplits<'r, 't> {
finder: FindMatches<'r, 't>,
last: uint,
///
/// `'r` is the lifetime of the compiled expression and `'t` is the lifetime
/// of the string being split.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct RegexSplitsN<'r, 't> {
splits: RegexSplits<'r, 't>,
cur: uint,
/// expression.
///
/// `'t` is the lifetime of the matched text.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct SubCaptures<'t> {
idx: uint,
caps: &'t Captures<'t>,
/// Positions are byte indices in terms of the original string matched.
///
/// `'t` is the lifetime of the matched text.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct SubCapturesPos<'t> {
idx: uint,
caps: &'t Captures<'t>,
///
/// `'r` is the lifetime of the compiled expression and `'t` is the lifetime
/// of the matched string.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct FindCaptures<'r, 't> {
re: &'r Regex,
search: &'t str,
///
/// `'r` is the lifetime of the compiled expression and `'t` is the lifetime
/// of the matched string.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct FindMatches<'r, 't> {
re: &'r Regex,
search: &'t str,
pub type CaptureLocs = Vec<Option<uint>>;
/// Indicates the type of match to be performed by the VM.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum MatchKind {
/// Only checks if a match exists or not. Does not return location.
Exists,
/// Indicates the next action to take after a single non-empty instruction
/// is processed.
-#[deriving(Copy)]
+#[derive(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
"suggest using `loop { }` instead of `while true { }`"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct WhileTrue;
impl LintPass for WhileTrue {
"detects unnecessary type casts that can be removed"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedCasts;
impl LintPass for UnusedCasts {
"shift exceeds the type's number of bits"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct TypeLimits {
/// Id of the last visited negated expression
negated_expr_id: ast::NodeId,
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ImproperCTypes;
impl LintPass for ImproperCTypes {
"use of owned (Box type) heap memory"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct BoxPointers;
impl BoxPointers {
"detects attributes that were not used by the compiler"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedAttributes;
impl LintPass for UnusedAttributes {
"path statements with no effect"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct PathStatements;
impl LintPass for PathStatements {
"unused result of an expression in a statement"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedResults;
impl LintPass for UnusedResults {
"types, variants, traits and type parameters should have camel case names"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NonCamelCaseTypes;
impl NonCamelCaseTypes {
}
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
enum MethodContext {
TraitDefaultImpl,
TraitImpl,
"methods, functions, lifetime parameters and modules should have snake case names"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NonSnakeCase;
impl NonSnakeCase {
"static constants should have uppercase identifiers"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NonUpperCaseGlobals;
impl LintPass for NonUpperCaseGlobals {
"`if`, `match`, `while` and `return` do not need parentheses"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedParens;
impl UnusedParens {
"unnecessary braces around an imported item"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedImportBraces;
impl LintPass for UnusedImportBraces {
"using `Struct { x: x }` instead of `Struct { x }`"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NonShorthandFieldPatterns;
impl LintPass for NonShorthandFieldPatterns {
"unnecessary use of an `unsafe` block"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedUnsafe;
impl LintPass for UnusedUnsafe {
"usage of an `unsafe` block"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnsafeBlocks;
impl LintPass for UnsafeBlocks {
"detect mut variables which don't need to be mutable"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedMut;
impl UnusedMut {
"detects unnecessary allocations that can be eliminated"
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnusedAllocation;
impl LintPass for UnusedAllocation {
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct MissingCopyImplementations;
impl LintPass for MissingCopyImplementations {
/// Checks for use of items with `#[deprecated]`, `#[experimental]` and
/// `#[unstable]` attributes, or no stability attribute.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Stability;
impl Stability {
/// Does nothing as a lint pass, but registers some `Lint`s
/// which are used by other parts of the compiler.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct HardwiredLints;
impl LintPass for HardwiredLints {
pub use lint::context::{Context, LintStore, raw_emit_lint, check_crate, gather_attrs};
/// Specification of a single lint.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Lint {
/// A string identifier for the lint.
///
pub type LintPassObject = Box<LintPass + 'static>;
/// Identifies a lint known to the compiler.
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct LintId {
// Identity is based on pointer equality of this field.
lint: &'static Lint,
}
/// Setting for how to handle a lint.
-#[deriving(Clone, Copy, PartialEq, PartialOrd, Eq, Ord)]
+#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord)]
pub enum Level {
Allow, Warn, Deny, Forbid
}
}
/// How a lint level was set.
-#[deriving(Clone, Copy, PartialEq, Eq)]
+#[derive(Clone, Copy, PartialEq, Eq)]
pub enum LintSource {
/// Lint is at the default level as declared
/// in rustc or a plugin.
pub const tag_items_data_item_reexport_name: uint = 0x3a;
// used to encode crate_ctxt side tables
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
#[repr(uint)]
pub enum astencode_tag { // Reserves 0x40 -- 0x5f
tag_ast = 0x40,
pub const tag_items_data_item_repr: uint = 0x93;
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct LinkMeta {
pub crate_name: String,
pub crate_hash: Svh,
use std::collections::hash_map::HashMap;
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct MethodInfo {
pub name: ast::Name,
pub def_id: ast::DefId,
pub span: Span,
}
-#[deriving(Copy, Show, PartialEq, Clone)]
+#[derive(Copy, Show, PartialEq, Clone)]
pub enum LinkagePreference {
RequireDynamic,
RequireStatic,
}
-#[deriving(Copy, Clone, PartialEq, FromPrimitive)]
+#[derive(Copy, Clone, PartialEq, FromPrimitive)]
pub enum NativeLibraryKind {
NativeStatic, // native static library (.a archive)
NativeFramework, // OSX-specific
// Where a crate came from on the local filesystem. One of these two options
// must be non-None.
-#[deriving(PartialEq, Clone)]
+#[derive(PartialEq, Clone)]
pub struct CrateSource {
pub dylib: Option<Path>,
pub rlib: Option<Path>,
find_item(item_id, items)
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
enum Family {
ImmStatic, // c
MutStatic, // b
}
// Something that a name can resolve to.
-#[deriving(Copy, Clone, Show)]
+#[derive(Copy, Clone, Show)]
pub enum DefLike {
DlDef(def::Def),
DlImpl(ast::DefId),
get_attributes(rbml::Doc::new(data))
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct CrateDep {
pub cnum: ast::CrateNum,
pub name: String,
rbml_w.wr_tagged_str(tag_def_id, def_to_string(id)[]);
}
-#[deriving(Clone)]
+#[derive(Clone)]
struct entry<T> {
val: T,
pos: u64
use util::fs as myfs;
use session::search_paths::{SearchPaths, PathKind};
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum FileMatch {
FileMatches,
FileDoesntMatch,
// 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(Copy, Show)]
+#[derive(Copy, Show)]
pub enum DefIdSource {
// Identifies a struct, trait, enum, etc.
NominalType,
loop_scopes: Vec<LoopScope>,
}
-#[deriving(Copy)]
+#[derive(Copy)]
struct LoopScope {
loop_id: ast::NodeId, // id of loop/while node
continue_index: CFGIndex, // where to go on a `loop`
pub exit: CFGIndex,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct CFGNodeData {
pub id: ast::NodeId
}
use syntax::visit::Visitor;
use syntax::visit;
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
enum Context {
Normal, Loop, Closure
}
-#[deriving(Copy)]
+#[derive(Copy)]
struct CheckLoopVisitor<'a> {
sess: &'a Session,
cx: Context
pub param_env: ParameterEnvironment<'a, 'tcx>,
}
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
pub enum Constructor {
/// The constructor of all patterns that don't vary by constructor,
/// e.g. struct patterns and fixed-length arrays.
SliceWithSubslice(uint, uint)
}
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
enum Usefulness {
Useful,
UsefulWithWitness(Vec<P<Pat>>),
NotUseful
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum WitnessPreference {
ConstructWitness,
LeaveOutWitness
use syntax::codemap::Span;
use syntax::visit;
-#[deriving(Copy, Eq, PartialEq)]
+#[derive(Copy, Eq, PartialEq)]
enum Mode {
InConstant,
InStatic,
// - Non-constants: everything else.
//
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum constness {
integral_const,
general_const,
// FIXME (#33): this doesn't handle big integer/float literals correctly
// (nor does the rest of our literal handling).
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
pub enum const_val {
const_float(f64),
const_int(i64),
use syntax::print::{pp, pprust};
use util::nodemap::NodeMap;
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum EntryOrExit {
Entry,
Exit,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct DataFlowContext<'a, 'tcx: 'a, O> {
tcx: &'a ty::ctxt<'tcx>,
use std::cell::RefCell;
-#[deriving(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Def {
DefFn(ast::DefId, bool /* is_ctor */),
DefStaticMethod(/* method */ ast::DefId, MethodProvenance),
// within.
pub type ExportMap = NodeMap<Vec<Export>>;
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Export {
pub name: ast::Name, // The name of the target.
pub def_id: ast::DefId, // The definition of the target.
}
-#[deriving(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum MethodProvenance {
FromTrait(ast::DefId),
FromImpl(ast::DefId),
}
-#[deriving(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum TyParamProvenance {
FromSelf(ast::DefId),
FromParam(ast::DefId),
}
}
-#[deriving(Clone, Copy, Eq, PartialEq)]
+#[derive(Clone, Copy, Eq, PartialEq)]
pub enum TraitItemKind {
NonstaticMethodTraitItemKind,
StaticMethodTraitItemKind,
use syntax::visit;
use syntax::visit::Visitor;
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum UnsafeContext {
SafeContext,
UnsafeFn,
mode: MutateMode);
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum LoanCause {
ClosureCapture(Span),
AddrOf,
MatchDiscriminant
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(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
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum MoveReason {
DirectRefMove,
PatBindingMove,
CaptureMove,
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum MatchMode {
NonBindingMatch,
BorrowingMatch,
MovingMatch,
}
-#[deriving(PartialEq,Show)]
+#[derive(PartialEq,Show)]
enum TrackMatchMode<T> {
Unknown,
Definite(MatchMode),
}
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum MutateMode {
Init,
JustWrite, // x = y
WriteAndRead, // x += y
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum OverloadedCallType {
FnOverloadedCall,
FnMutOverloadedCall,
use self::SimplifiedType::*;
/// See `simplify_type
-#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub enum SimplifiedType {
BoolSimplifiedType,
CharSimplifiedType,
}
}
-#[deriving(Clone, Copy, PartialEq, Show)]
+#[derive(Clone, Copy, PartialEq, Show)]
pub struct NodeIndex(pub uint);
#[allow(non_upper_case_globals)]
pub const InvalidNodeIndex: NodeIndex = NodeIndex(uint::MAX);
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub struct EdgeIndex(pub uint);
#[allow(non_upper_case_globals)]
pub const InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
// Use a private field here to guarantee no more instances are created:
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub struct Direction { repr: uint }
#[allow(non_upper_case_globals)]
pub const Outgoing: Direction = Direction { repr: 0 };
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct CombineFields<'a, 'tcx: 'a> {
pub infcx: &'a InferCtxt<'a, 'tcx>,
pub a_is_expected: bool,
/// Why did we require that the two types be related?
///
/// See `error_reporting.rs` for more details
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub enum TypeOrigin {
// Not yet categorized in a better way
Misc(Span),
}
/// See `error_reporting.rs` for more details
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum ValuePairs<'tcx> {
Types(ty::expected_found<Ty<'tcx>>),
TraitRefs(ty::expected_found<Rc<ty::TraitRef<'tcx>>>),
/// encounter an error or subtyping constraint.
///
/// See `error_reporting.rs` for more details.
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct TypeTrace<'tcx> {
origin: TypeOrigin,
values: ValuePairs<'tcx>,
/// The origin of a `r1 <= r2` constraint.
///
/// See `error_reporting.rs` for more details
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum SubregionOrigin<'tcx> {
// Arose from a subtyping relation
Subtype(TypeTrace<'tcx>),
}
/// Times when we replace late-bound regions with variables:
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub enum LateBoundRegionConversionTime {
/// when a fn is called
FnCall,
/// Reasons to create a region inference variable
///
/// See `error_reporting.rs` for more details
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum RegionVariableOrigin<'tcx> {
// Region variables created for ill-categorized reasons,
// mostly indicates places in need of refactoring
BoundRegionInCoherence(ast::Name),
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum fixup_err {
unresolved_int_ty(IntVid),
unresolved_float_ty(FloatVid),
node_ids: FnvHashMap<Node, uint>,
}
-#[deriving(Clone, Hash, PartialEq, Eq, Show)]
+#[derive(Clone, Hash, PartialEq, Eq, Show)]
enum Node {
RegionVid(ty::RegionVid),
Region(ty::Region),
mod graphviz;
// A constraint that influences the inference process.
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub enum Constraint {
// One region variable is subregion of another
ConstrainVarSubVar(RegionVid, RegionVid),
VerifyParamBound(ty::ParamTy, SubregionOrigin<'tcx>, Region, Vec<Region>),
}
-#[deriving(Copy, PartialEq, Eq, Hash)]
+#[derive(Copy, PartialEq, Eq, Hash)]
pub struct TwoRegions {
a: Region,
b: Region,
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum UndoLogEntry {
OpenSnapshot,
CommitedSnapshot,
AddCombination(CombineMapType, TwoRegions)
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum CombineMapType {
Lub, Glb
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum RegionResolutionError<'tcx> {
/// `ConcreteFailure(o, a, b)`:
///
/// ```
/// would report an error because we expect 'a and 'b to match, and so we group
/// 'a and 'b together inside a SameRegions struct
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct SameRegions {
pub scope_id: ast::NodeId,
pub regions: Vec<BoundRegion>
values: RefCell<Option<Vec<VarValue>>>,
}
-#[deriving(Show)]
+#[derive(Show)]
#[allow(missing_copy_implementations)]
pub struct RegionSnapshot {
length: uint,
// ______________________________________________________________________
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
enum Classification { Expanding, Contracting }
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum VarValue { NoValue, Value(Region), ErrorValue }
struct VarData {
type Relation = (RelationDir, ty::TyVid);
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum RelationDir {
SubtypeOf, SupertypeOf, EqTo
}
/// to keep the DAG relatively balanced, which helps keep the running
/// time of the algorithm under control. For more information, see
/// <http://en.wikipedia.org/wiki/Disjoint-set_data_structure>.
-#[deriving(PartialEq,Clone)]
+#[derive(PartialEq,Clone)]
pub enum VarValue<K,V> {
Redirect(K),
Root(V, uint),
pub rank: uint,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Delegate;
// We can't use V:LatticeValue, much as I would like to,
$( $variant:ident, $name:expr, $method:ident; )*
) => {
-#[deriving(Copy, FromPrimitive, PartialEq, Eq, Hash)]
+#[derive(Copy, FromPrimitive, PartialEq, Eq, Hash)]
pub enum LangItem {
$($variant),*
}
ForLoop(&'a ast::Pat),
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
struct Variable(uint);
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
struct LiveNode(uint);
impl Variable {
}
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
enum LiveNodeKind {
FreeVarNode(Span),
ExprNode(Span),
var_nid: NodeId
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
struct LocalInfo {
id: NodeId,
ident: ast::Ident
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
enum VarKind {
Arg(NodeId, ast::Ident),
Local(LocalInfo),
// Actually we compute just a bit more than just liveness, but we use
// the same basic propagation framework in all cases.
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
struct Users {
reader: LiveNode,
writer: LiveNode,
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
struct Specials {
exit_ln: LiveNode,
fallthrough_ln: LiveNode,
use std::cell::RefCell;
use std::rc::Rc;
-#[deriving(Clone, PartialEq, Show)]
+#[derive(Clone, PartialEq, Show)]
pub enum categorization<'tcx> {
cat_rvalue(ty::Region), // temporary val, argument is its scope
cat_static_item,
}
// Represents any kind of upvar
-#[deriving(Clone, Copy, PartialEq, Show)]
+#[derive(Clone, Copy, PartialEq, Show)]
pub struct Upvar {
pub id: ty::UpvarId,
// Unboxed closure kinds are used even for old-style closures for simplicity
}
// different kinds of pointers:
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub enum PointerKind {
Unique,
BorrowedPtr(ty::BorrowKind, ty::Region),
// We use the term "interior" to mean "something reachable from the
// base without a pointer dereference", e.g. a field
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub enum InteriorKind {
InteriorField(FieldName),
InteriorElement(ElementKind),
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub enum FieldName {
NamedField(ast::Name),
PositionalField(uint)
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub enum ElementKind {
VecElement,
OtherElement,
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub enum MutabilityCategory {
McImmutable, // Immutable.
McDeclared, // Directly declared as mutable.
// Upvar categorization can generate a variable number of nested
// derefs. The note allows detecting them without deep pattern
// matching on the categorization.
-#[deriving(Clone, Copy, PartialEq, Show)]
+#[derive(Clone, Copy, PartialEq, Show)]
pub enum Note {
NoteClosureEnv(ty::UpvarId), // Deref through closure env
NoteUpvarRef(ty::UpvarId), // Deref through by-ref upvar
// dereference, but its type is the type *before* the dereference
// (`@T`). So use `cmt.ty` to find the type of the value in a consistent
// fashion. For more details, see the method `cat_pattern`
-#[deriving(Clone, PartialEq, Show)]
+#[derive(Clone, PartialEq, Show)]
pub struct cmt_<'tcx> {
pub id: ast::NodeId, // id of expr/pat producing this value
pub span: Span, // span of same expr/pat
// We pun on *T to mean both actual deref of a ptr as well
// as accessing of components:
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum deref_kind {
deref_ptr(PointerKind),
deref_interior(InteriorKind),
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum InteriorSafety {
InteriorUnsafe,
InteriorSafe
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AliasableReason {
AliasableBorrowed,
AliasableClosure(ast::NodeId), // Aliasable due to capture Fn closure env
// FIXME: dox
pub type LastPrivateMap = NodeMap<LastPrivate>;
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum LastPrivate {
LastMod(PrivateDep),
// `use` directives (imports) can refer to two separate definitions in the
type_used: ImportUse},
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum PrivateDep {
AllPublic,
DependsOn(ast::DefId),
}
// How an import is used.
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum ImportUse {
Unused, // The import is not used.
Used, // The import is used.
/// 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, RustcEncodable,
+#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, RustcEncodable,
RustcDecodable, Show, Copy)]
pub enum CodeExtent {
Misc(ast::NodeId)
terminating_scopes: RefCell<FnvHashSet<CodeExtent>>,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Context {
var_parent: Option<ast::NodeId>,
use syntax::visit::Visitor;
use util::nodemap::NodeMap;
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)]
pub enum DefRegion {
DefStaticRegion,
DefEarlyBoundRegion(/* space */ subst::ParamSpace,
/// identify each in-scope parameter by an *index* and a *parameter
/// space* (which indices where the parameter is defined; see
/// `ParamSpace`).
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct Substs<'tcx> {
pub types: VecPerParamSpace<Ty<'tcx>>,
pub regions: RegionSubsts,
/// Represents the values to use when substituting lifetime parameters.
/// If the value is `ErasedRegions`, then this subst is occurring during
/// trans, and all region parameters will be replaced with `ty::ReStatic`.
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub enum RegionSubsts {
ErasedRegions,
NonerasedRegions(VecPerParamSpace<ty::Region>)
///////////////////////////////////////////////////////////////////////////
// ParamSpace
-#[deriving(PartialOrd, Ord, PartialEq, Eq, Copy,
+#[derive(PartialOrd, Ord, PartialEq, Eq, Copy,
Clone, Hash, RustcEncodable, RustcDecodable, Show)]
pub enum ParamSpace {
TypeSpace, // Type parameters attached to a type definition, trait, or impl
/// Vector of things sorted by param space. Used to keep
/// the set of things declared on the type, self, or method
/// distinct.
-#[deriving(PartialEq, Eq, Clone, Hash, RustcEncodable, RustcDecodable)]
+#[derive(PartialEq, Eq, Clone, Hash, RustcEncodable, RustcDecodable)]
pub struct VecPerParamSpace<T> {
// This was originally represented as a tuple with one Vec<T> for
// each variant of ParamSpace, and that remains the abstraction
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct EnumeratedItems<'a,T:'a> {
vec: &'a VecPerParamSpace<T>,
space_index: uint,
/// either identifying an `impl` (e.g., `impl Eq for int`) that
/// provides the required vtable, or else finding a bound that is in
/// scope. The eventual result is usually a `Selection` (defined below).
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Obligation<'tcx, T> {
pub cause: ObligationCause<'tcx>,
pub recursion_depth: uint,
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
/// Why did we incur this obligation? Used for error reporting.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct ObligationCause<'tcx> {
pub span: Span,
pub code: ObligationCauseCode<'tcx>
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum ObligationCauseCode<'tcx> {
/// Not well classified or should be obvious from span.
MiscObligation,
ImplDerivedObligation(DerivedObligationCause<'tcx>),
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct DerivedObligationCause<'tcx> {
/// The trait reference of the parent obligation that led to the
/// current obligation. Note that only trait obligations lead to
pub type Selection<'tcx> = Vtable<'tcx, PredicateObligation<'tcx>>;
-#[deriving(Clone,Show)]
+#[derive(Clone,Show)]
pub enum SelectionError<'tcx> {
Unimplemented,
Overflow,
pub code: FulfillmentErrorCode<'tcx>
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum FulfillmentErrorCode<'tcx> {
CodeSelectionError(SelectionError<'tcx>),
CodeProjectionError(MismatchedProjectionTypes<'tcx>),
/// ### The type parameter `N`
///
/// See explanation on `VtableImplData`.
-#[deriving(Show,Clone)]
+#[derive(Show,Clone)]
pub enum Vtable<'tcx, N> {
/// Vtable identifying a particular impl.
VtableImpl(VtableImplData<'tcx, N>),
/// is `Obligation`, as one might expect. During trans, however, this
/// is `()`, because trans only requires a shallow resolution of an
/// impl, and nested obligations are satisfied later.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct VtableImplData<'tcx, N> {
pub impl_def_id: ast::DefId,
pub substs: subst::Substs<'tcx>,
pub nested: subst::VecPerParamSpace<N>
}
-#[deriving(Show,Clone)]
+#[derive(Show,Clone)]
pub struct VtableBuiltinData<N> {
pub nested: subst::VecPerParamSpace<N>
}
/// A vtable for some object-safe trait `Foo` automatically derived
/// for the object type `Foo`.
-#[deriving(PartialEq,Eq,Clone)]
+#[derive(PartialEq,Eq,Clone)]
pub struct VtableObjectData<'tcx> {
pub object_ty: Ty<'tcx>,
}
}
/// Reasons a method might not be object-safe.
-#[deriving(Copy,Clone,Show)]
+#[derive(Copy,Clone,Show)]
pub enum MethodViolationCode {
/// e.g., `fn(self)`
ByValueSelf,
TraitSelectionError(SelectionError<'tcx>),
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct MismatchedProjectionTypes<'tcx> {
pub err: ty::type_err<'tcx>
}
previous: Option<&'prev TraitObligationStack<'prev, 'tcx>>
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct SelectionCache<'tcx> {
hashmap: RefCell<HashMap<Rc<ty::TraitRef<'tcx>>,
SelectionResult<'tcx, SelectionCandidate<'tcx>>>>,
MethodDidNotMatch,
}
-#[deriving(Copy, Show)]
+#[derive(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.
/// matching where clause. Part of the reason for this is that where
/// clauses can give additional information (like, the types of output
/// parameters) that would have to be inferred from the impl.
-#[deriving(PartialEq,Eq,Show,Clone)]
+#[derive(PartialEq,Eq,Show,Clone)]
enum SelectionCandidate<'tcx> {
BuiltinCandidate(ty::BuiltinBound),
ParamCandidate(ty::PolyTraitRef<'tcx>),
AmbiguousBuiltin
}
-#[deriving(Show)]
+#[derive(Show)]
enum EvaluationResult<'tcx> {
EvaluatedToOk,
EvaluatedToAmbig,
pub glob_map: Option<GlobMap>,
}
-#[deriving(Copy, PartialEq, Eq, Hash)]
+#[derive(Copy, PartialEq, Eq, Hash)]
pub struct field<'tcx> {
pub name: ast::Name,
pub mt: mt<'tcx>
}
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub enum ImplOrTraitItemContainer {
TraitContainer(ast::DefId),
ImplContainer(ast::DefId),
}
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum ImplOrTraitItem<'tcx> {
MethodTraitItem(Rc<Method<'tcx>>),
TypeTraitItem(Rc<AssociatedType>),
}
}
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub enum ImplOrTraitItemId {
MethodTraitItemId(ast::DefId),
TypeTraitItemId(ast::DefId),
}
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct Method<'tcx> {
pub name: ast::Name,
pub generics: ty::Generics<'tcx>,
}
}
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub struct AssociatedType {
pub name: ast::Name,
pub vis: ast::Visibility,
pub container: ImplOrTraitItemContainer,
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub struct mt<'tcx> {
pub ty: Ty<'tcx>,
pub mutbl: ast::Mutability,
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)]
pub enum TraitStore {
/// Box<Trait>
UniqTraitStore,
RegionTraitStore(Region, ast::Mutability),
}
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub struct field_ty {
pub name: Name,
pub id: DefId,
// Contains information needed to resolve types and (in the future) look up
// the types of AST nodes.
-#[deriving(Copy, PartialEq, Eq, Hash)]
+#[derive(Copy, PartialEq, Eq, Hash)]
pub struct creader_cache_key {
pub cnum: CrateNum,
pub pos: uint,
pub len: uint
}
-#[deriving(Copy)]
+#[derive(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 */
}
-#[deriving(Clone, PartialEq, RustcDecodable, RustcEncodable)]
+#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable)]
pub struct ItemVariances {
pub types: VecPerParamSpace<Variance>,
pub regions: VecPerParamSpace<Variance>,
}
-#[deriving(Clone, PartialEq, RustcDecodable, RustcEncodable, Show, Copy)]
+#[derive(Clone, PartialEq, RustcDecodable, RustcEncodable, Show, Copy)]
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
Bivariant, // T<A> <: T<B> -- e.g., unused type parameter
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum AutoAdjustment<'tcx> {
AdjustAddEnv(ast::DefId, ty::TraitStore),
AdjustReifyFnPointer(ast::DefId), // go from a fn-item type to a fn-pointer type
AdjustDerefRef(AutoDerefRef<'tcx>)
}
-#[deriving(Clone, PartialEq, Show)]
+#[derive(Clone, PartialEq, Show)]
pub enum UnsizeKind<'tcx> {
// [T, ..n] -> [T], the uint field is n.
UnsizeLength(uint),
UnsizeVtable(TyTrait<'tcx>, /* the self type of the trait */ Ty<'tcx>)
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct AutoDerefRef<'tcx> {
pub autoderefs: uint,
pub autoref: Option<AutoRef<'tcx>>
}
-#[deriving(Clone, PartialEq, Show)]
+#[derive(Clone, PartialEq, Show)]
pub enum AutoRef<'tcx> {
/// Convert from T to &T
/// The third field allows us to wrap other AutoRef adjustments.
}
}
-#[deriving(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Show)]
+#[derive(Clone, Copy, RustcEncodable, RustcDecodable, PartialEq, PartialOrd, Show)]
pub struct param_index {
pub space: subst::ParamSpace,
pub index: uint
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum MethodOrigin<'tcx> {
// fully statically resolved method
MethodStatic(ast::DefId),
// details for a method invoked with a receiver whose type is a type parameter
// with a bounded trait.
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct MethodParam<'tcx> {
// the precise trait reference that occurs as a bound -- this may
// be a supertrait of what the user actually typed. Note that it
}
// details for a method invoked with a receiver whose type is an object
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct MethodObject<'tcx> {
// the (super)trait containing the method to be invoked
pub trait_ref: Rc<ty::TraitRef<'tcx>>,
pub real_index: uint,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct MethodCallee<'tcx> {
pub origin: MethodOrigin<'tcx>,
pub ty: Ty<'tcx>,
/// 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, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub struct MethodCall {
pub expr_id: ast::NodeId,
pub adjustment: ExprAdjustment
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)]
+#[derive(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)]
pub enum ExprAdjustment {
NoAdjustment,
AutoDeref(uint),
// Resolutions for bounds of all parameters, left to right, for a given path.
pub type vtable_res<'tcx> = VecPerParamSpace<vtable_param_res<'tcx>>;
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum vtable_origin<'tcx> {
/*
Statically known vtable. def_id gives the impl item
/// will push one or more such restriction into the
/// `transmute_restrictions` vector during `intrinsicck`. They are
/// then checked during `trans` by the fn `check_intrinsics`.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct TransmuteRestriction<'tcx> {
/// The span whence the restriction comes.
pub span: Span,
// variable names.
mod inner {
use middle::ty;
- #[deriving(Copy)]
+ #[derive(Copy)]
struct DebugStat {
total: uint,
region_infer: uint,
}
}
-#[deriving(Show)]
+#[derive(Show)]
pub struct TyS<'tcx> {
pub sty: sty<'tcx>,
pub flags: TypeFlags,
ty.region_depth > depth
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct BareFnTy<'tcx> {
pub unsafety: ast::Unsafety,
pub abi: abi::Abi,
pub sig: PolyFnSig<'tcx>,
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct ClosureTy<'tcx> {
pub unsafety: ast::Unsafety,
pub onceness: ast::Onceness,
pub abi: abi::Abi,
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub enum FnOutput<'tcx> {
FnConverging(Ty<'tcx>),
FnDiverging
/// - `inputs` is the list of arguments and their modes.
/// - `output` is the return type.
/// - `variadic` indicates whether this is a varidic function. (only true for foreign fns)
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[derive(Clone, PartialEq, Eq, Hash)]
pub struct FnSig<'tcx> {
pub inputs: Vec<Ty<'tcx>>,
pub output: FnOutput<'tcx>,
pub type PolyFnSig<'tcx> = Binder<FnSig<'tcx>>;
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub struct ParamTy {
pub space: subst::ParamSpace,
pub idx: u32,
/// is the outer fn.
///
/// [dbi]: http://en.wikipedia.org/wiki/De_Bruijn_index
-#[deriving(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)]
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`.
}
/// Representation of regions:
-#[deriving(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show, Copy)]
pub enum Region {
// Region bound in a type or fn declaration which will be
// substituted 'early' -- that is, at the same time when type
/// 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, Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
pub struct UpvarId {
pub var_id: ast::NodeId,
pub closure_expr_id: ast::NodeId,
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)]
+#[derive(Clone, PartialEq, Eq, Hash, Show, RustcEncodable, RustcDecodable, Copy)]
pub enum BorrowKind {
/// Data must be immutable and is aliasable.
ImmBorrow,
/// - 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, RustcEncodable, RustcDecodable, Show, Copy)]
+#[derive(PartialEq, Clone, RustcEncodable, RustcDecodable, Show, Copy)]
pub struct UpvarBorrow {
pub kind: BorrowKind,
pub region: ty::Region,
}
}
-#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash,
+#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash,
RustcEncodable, RustcDecodable, Show, Copy)]
/// A "free" region `fr` can be interpreted as "some region
/// at least as big as the scope `fr.scope`".
pub bound_region: BoundRegion
}
-#[deriving(Clone, PartialEq, PartialOrd, Eq, Ord, Hash,
+#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash,
RustcEncodable, RustcDecodable, Show, Copy)]
pub enum BoundRegion {
/// An anonymous region parameter for a given fn (&T)
// NB: If you change this, you'll probably want to change the corresponding
// AST structure in libsyntax/ast.rs as well.
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub enum sty<'tcx> {
ty_bool,
ty_char,
// on non-useful type error messages)
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct TyTrait<'tcx> {
pub principal: ty::PolyTraitRef<'tcx>,
pub bounds: ExistentialBounds<'tcx>,
/// Note that a `TraitRef` introduces a level of region binding, to
/// account for higher-ranked trait bounds like `T : for<'a> Foo<&'a
/// U>` or higher-ranked object types.
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct TraitRef<'tcx> {
pub def_id: DefId,
pub substs: &'tcx Substs<'tcx>,
/// erase, or otherwise "discharge" these bound reons, we change the
/// type from `Binder<T>` to just `T` (see
/// e.g. `liberate_late_bound_regions`).
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct Binder<T>(pub T);
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum IntVarValue {
IntType(ast::IntTy),
UintType(ast::UintTy),
}
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub enum terr_vstore_kind {
terr_vec,
terr_str,
terr_trait
}
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub struct expected_found<T> {
pub expected: T,
pub found: T
}
// Data structures used in type unification
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub enum type_err<'tcx> {
terr_mismatch,
terr_unsafety_mismatch(expected_found<ast::Unsafety>),
/// 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)]
+#[derive(PartialEq, Eq, Hash, Clone, Show)]
pub struct ParamBounds<'tcx> {
pub region_bounds: Vec<ty::Region>,
pub builtin_bounds: BuiltinBounds,
/// 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)]
+#[derive(PartialEq, Eq, Hash, Clone, Show)]
pub struct ExistentialBounds<'tcx> {
pub region_bound: ty::Region,
pub builtin_bounds: BuiltinBounds,
pub type BuiltinBounds = EnumSet<BuiltinBound>;
-#[deriving(Clone, RustcEncodable, PartialEq, Eq, RustcDecodable, Hash,
+#[derive(Clone, RustcEncodable, PartialEq, Eq, RustcDecodable, Hash,
Show, Copy)]
#[repr(uint)]
pub enum BuiltinBound {
}
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct TyVid {
pub index: u32
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct IntVid {
pub index: u32
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct FloatVid {
pub index: u32
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub struct RegionVid {
pub index: u32
}
-#[deriving(Clone, Copy, PartialEq, Eq, Hash)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub enum InferTy {
TyVar(TyVid),
IntVar(IntVid),
FreshIntTy(u32),
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
pub enum UnconstrainedNumeric {
UnconstrainedFloat,
UnconstrainedInt,
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, Eq, Hash, Show, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, Eq, Hash, Show, Copy)]
pub enum InferRegion {
ReVar(RegionVid),
ReSkolemized(u32, BoundRegion)
}
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct TypeParameterDef<'tcx> {
pub name: ast::Name,
pub def_id: ast::DefId,
pub default: Option<Ty<'tcx>>,
}
-#[deriving(RustcEncodable, RustcDecodable, Clone, Show)]
+#[derive(RustcEncodable, RustcDecodable, Clone, Show)]
pub struct RegionParameterDef {
pub name: ast::Name,
pub def_id: ast::DefId,
/// Information about the formal type/lifetime parameters associated
/// with an item or method. Analogous to ast::Generics.
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct Generics<'tcx> {
pub types: VecPerParamSpace<TypeParameterDef<'tcx>>,
pub regions: VecPerParamSpace<RegionParameterDef>,
}
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub enum Predicate<'tcx> {
/// Corresponds to `where Foo : Bar<A,B,C>`. `Foo` here would be
/// the `Self` type of the trait reference and `A`, `B`, and `C`
Projection(PolyProjectionPredicate<'tcx>),
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct TraitPredicate<'tcx> {
pub trait_ref: Rc<TraitRef<'tcx>>
}
}
}
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct EquatePredicate<'tcx>(pub Ty<'tcx>, pub Ty<'tcx>); // `0 == 1`
pub type PolyEquatePredicate<'tcx> = ty::Binder<EquatePredicate<'tcx>>;
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct OutlivesPredicate<A,B>(pub A, pub B); // `A : B`
pub type PolyOutlivesPredicate<A,B> = ty::Binder<OutlivesPredicate<A,B>>;
pub type PolyRegionOutlivesPredicate = PolyOutlivesPredicate<ty::Region, ty::Region>;
/// equality between arbitrary types. Processing an instance of Form
/// #2 eventually yields one of these `ProjectionPredicate`
/// instances to normalize the LHS.
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct ProjectionPredicate<'tcx> {
pub projection_ty: ProjectionTy<'tcx>,
pub ty: Ty<'tcx>,
/// Represents the projection of an associated type. In explicit UFCS
/// form this would be written `<T as Trait<..>>::N`.
-#[deriving(Clone, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct ProjectionTy<'tcx> {
/// The trait reference `T as Trait<..>`.
pub trait_ref: Rc<ty::TraitRef<'tcx>>,
/// `[[], [U:Bar<T>]]`. Now if there were some particular reference
/// like `Foo<int,uint>`, then the `GenericBounds` would be `[[],
/// [uint:Bar<int>]]`.
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct GenericBounds<'tcx> {
pub predicates: VecPerParamSpace<Predicate<'tcx>>,
}
/// bound lifetime parameters are replaced with free ones, but in the
/// future I hope to refine the representation of types so as to make
/// more distinctions clearer.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct ParameterEnvironment<'a, 'tcx:'a> {
pub tcx: &'a ctxt<'tcx>,
/// stray references in a comment or something). We try to reserve the
/// "poly" prefix to refer to higher-ranked things, as in
/// `PolyTraitRef`.
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct TypeScheme<'tcx> {
pub generics: Generics<'tcx>,
pub ty: Ty<'tcx>
/// Records the substitutions used to translate the polytype for an
/// item into the monotype of an item reference.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct ItemSubsts<'tcx> {
pub substs: Substs<'tcx>,
}
/// Records information about each unboxed closure.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct UnboxedClosure<'tcx> {
/// The type of the unboxed closure.
pub closure_type: ClosureTy<'tcx>,
pub kind: UnboxedClosureKind,
}
-#[deriving(Clone, Copy, PartialEq, Eq, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Show)]
pub enum UnboxedClosureKind {
FnUnboxedClosureKind,
FnMutUnboxedClosureKind,
/// 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, Copy)]
+#[derive(Clone, Copy)]
pub struct TypeContents {
pub bits: u64
}
///
/// The ordering of the cases is significant. They are sorted so that cmp::max
/// will keep the "more erroneous" of two values.
-#[deriving(Copy, PartialOrd, Ord, Eq, PartialEq, Show)]
+#[derive(Copy, PartialOrd, Ord, Eq, PartialEq, Show)]
pub enum Representability {
Representable,
ContainsRecursive,
/// 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)]
+#[derive(Copy)]
pub enum ExprKind {
LvalueExpr,
RvalueDpsExpr,
cx.sess.bug("couldn't find associated type parameter index")
}
-#[deriving(Copy, PartialEq, Eq)]
+#[derive(Copy, PartialEq, Eq)]
pub struct AssociatedTypeInfo {
pub def_id: ast::DefId,
pub index: uint,
}
// Enum information
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct VariantInfo<'tcx> {
pub args: Vec<Ty<'tcx>>,
pub arg_names: Option<Vec<ast::Ident>>,
with_path(cx, id, |path| ast_map::path_to_string(path)).to_string()
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum DtorKind {
NoDtor,
TraitDtor(DefId, bool)
}).collect()
}
-#[deriving(Copy, Clone)]
+#[derive(Copy, Clone)]
pub struct UnboxedClosureUpvar<'tcx> {
pub def: def::Def,
pub span: Span,
/// The category of explicit self.
-#[deriving(Clone, Copy, Eq, PartialEq, Show)]
+#[derive(Clone, Copy, Eq, PartialEq, Show)]
pub enum ExplicitSelfCategory {
StaticExplicitSelfCategory,
ByValueExplicitSelfCategory,
}
/// A free variable referred to in a function.
-#[deriving(Copy, RustcEncodable, RustcDecodable)]
+#[derive(Copy, RustcEncodable, RustcDecodable)]
pub struct Freevar {
/// The variable being accessed free.
pub def: def::Def,
trait_ref.substs.clone().with_method(meth_tps, meth_regions)
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum CopyImplementationError {
FieldDoesNotImplementCopy(ast::Name),
VariantDoesNotImplementCopy(ast::Name),
pub uint_type: UintTy,
}
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum OptLevel {
No, // -O0
Less, // -O1
Aggressive // -O3
}
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum DebugInfoLevel {
NoDebugInfo,
LimitedDebugInfo,
FullDebugInfo,
}
-#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
pub enum OutputType {
OutputTypeBitcode,
OutputTypeAssembly,
OutputTypeDepInfo,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Options {
// The crate config requested for the session, which may be combined
// with additional crate configurations during the compile process
pub alt_std_name: Option<String>
}
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
#[allow(missing_copy_implementations)]
pub enum PrintRequest {
FileNames,
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct OutputFilenames {
pub out_directory: Path,
pub out_filestem: String,
// users can have their own entry
// functions that don't start a
// scheduler
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum EntryFnType {
EntryMain,
EntryStart,
EntryNone,
}
-#[deriving(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
+#[derive(Copy, PartialEq, PartialOrd, Clone, Ord, Eq, Hash)]
pub enum CrateType {
CrateTypeExecutable,
CrateTypeDylib,
]
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum Passes {
SomePasses(Vec<String>),
AllPasses,
macro_rules! cgoptions {
($($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) =>
(
- #[deriving(Clone)]
+ #[derive(Clone)]
pub struct CodegenOptions { $(pub $opt: $t),* }
pub fn basic_codegen_options() -> CodegenOptions {
.collect()
}
-#[deriving(Copy, Clone, PartialEq, Eq, Show)]
+#[derive(Copy, Clone, PartialEq, Eq, Show)]
pub enum OptionStability { Stable, Unstable }
-#[deriving(Clone, PartialEq, Eq)]
+#[derive(Clone, PartialEq, Eq)]
pub struct RustcOptGroup {
pub opt_group: getopts::OptGroup,
pub stability: OptionStability,
use std::slice;
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct SearchPaths {
paths: Vec<(PathKind, Path)>,
}
iter: slice::Iter<'a, (PathKind, Path)>,
}
-#[deriving(Eq, PartialEq, Clone, Copy)]
+#[derive(Eq, PartialEq, Clone, Copy)]
pub enum PathKind {
Native,
Crate,
// 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, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub struct ErrorReported;
pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where
///
/// This uses FNV hashing, as described here:
/// http://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
-#[deriving(Clone, Copy, Default)]
+#[derive(Clone, Copy, Default)]
pub struct FnvHasher;
#[allow(missing_copy_implementations)]
use std::mem;
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub enum UndoLog<T,U> {
/// Indicates where a snapshot started.
OpenSnapshot,
use syntax::ast;
use syntax::visit;
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
pub struct Svh {
hash: String,
}
// This enum represents the different potential bits of code the
// visitor could encounter that could affect the ABI for the crate,
// and assigns each a distinct tag to feed into the hash computation.
- #[deriving(Hash)]
+ #[derive(Hash)]
enum SawAbiComponent<'a> {
// FIXME (#14132): should we include (some function of)
/// because the SVH is just a developer convenience; there is no
/// guarantee of collision-freedom, hash collisions are just
/// (hopefully) unlikely.)
- #[deriving(Hash)]
+ #[derive(Hash)]
pub enum SawExprComponent<'a> {
SawExprLoop(Option<token::InternedString>),
}
/// SawStmtComponent is analogous to SawExprComponent, but for statements.
- #[deriving(Hash)]
+ #[derive(Hash)]
pub enum SawStmtComponent {
SawStmtDecl,
SawStmtExpr,
/// Everything `rustc` knows about how to compile for a specific target.
///
/// Every field here must be specified, and has no default value.
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct Target {
/// [Data layout](http://llvm.org/docs/LangRef.html#data-layout) to pass to LLVM.
pub data_layout: String,
///
/// This has an implementation of `Default`, see each field for what the default is. In general,
/// these try to take "minimal defaults" that don't assume anything about the runtime they run in.
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub struct TargetOptions {
/// Linker to invoke. Defaults to "cc".
pub linker: String,
}
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
enum UseError<'tcx> {
UseOk,
UseWhileBorrowed(/*loan*/Rc<LoanPath<'tcx>>, /*loan*/Span)
use syntax::attr::AttrMetaMethods;
use syntax::codemap::Span;
-#[deriving(PartialEq, Eq, PartialOrd, Ord)]
+#[derive(PartialEq, Eq, PartialOrd, Ord)]
enum Fragment {
// This represents the path described by the move path index
Just(MovePathIndex),
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct MoveSpanAndPath {
pub span: codemap::Span,
pub ident: ast::Ident
use std::rc::Rc;
-#[deriving(Show)]
+#[derive(Show)]
pub enum RestrictionResult<'tcx> {
Safe,
SafeIf(Rc<LoanPath<'tcx>>, Vec<Rc<LoanPath<'tcx>>>)
pub mod move_data;
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct LoanDataFlowOperator;
pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator>;
}
}
-#[deriving(Eq, Hash, Show)]
+#[derive(Eq, Hash, Show)]
pub struct LoanPath<'tcx> {
kind: LoanPathKind<'tcx>,
ty: ty::Ty<'tcx>,
}
}
-#[deriving(PartialEq, Eq, Hash, Show)]
+#[derive(PartialEq, Eq, Hash, Show)]
pub enum LoanPathKind<'tcx> {
LpVar(ast::NodeId), // `x` in doc.rs
LpUpvar(ty::UpvarId), // `x` captured by-value into closure
// b2b39e8700e37ad32b486b9a8409b50a8a53aa51#commitcomment-7892003
static DOWNCAST_PRINTED_OPERATOR : &'static str = " as ";
-#[deriving(Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Copy, PartialEq, Eq, Hash, Show)]
pub enum LoanPathElem {
LpDeref(mc::PointerKind), // `*LV` in doc.rs
LpInterior(mc::InteriorKind) // `LV.f` in doc.rs
// Errors
// Errors that can occur
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
#[allow(missing_copy_implementations)]
pub enum bckerr_code {
err_mutbl,
// Combination of an error code and the categorization of the expression
// that caused it
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub struct BckError<'tcx> {
span: Span,
cause: euv::LoanCause,
code: bckerr_code
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AliasableViolationKind {
MutabilityViolation,
BorrowViolation(euv::LoanCause)
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum MovedValueUseKind {
MovedInUse,
MovedInCapture,
}
/// Index into `MoveData.paths`, used like a pointer
-#[deriving(Copy, PartialEq, Eq, PartialOrd, Ord, Show)]
+#[derive(Copy, PartialEq, Eq, PartialOrd, Ord, Show)]
pub struct MovePathIndex(uint);
impl MovePathIndex {
MovePathIndex(uint::MAX);
/// Index into `MoveData.moves`, used like a pointer
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub struct MoveIndex(uint);
impl MoveIndex {
pub next_sibling: MovePathIndex,
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum MoveKind {
Declared, // When declared, variables start out "moved".
MoveExpr, // Expression or binding that moves a variable
Captured // Closure creation that moves a value
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Move {
/// Path being moved.
pub path: MovePathIndex,
pub next_move: MoveIndex
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Assignment {
/// Path being assigned.
pub path: MovePathIndex,
pub span: Span,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct VariantMatch {
/// downcast to the variant.
pub path: MovePathIndex,
pub mode: euv::MatchMode
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct MoveDataFlowOperator;
pub type MoveDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, MoveDataFlowOperator>;
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct AssignDataFlowOperator;
pub type AssignDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, AssignDataFlowOperator>;
use std::rc::Rc;
use std::borrow::IntoCow;
-#[deriving(Show, Copy)]
+#[derive(Show, Copy)]
pub enum Variant {
Loans,
Moves,
use std::option;
use std::str::FromStr;
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum PpSourceMode {
PpmNormal,
PpmEveryBodyLoops,
PpmExpandedHygiene,
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum PpMode {
PpmSource(PpSourceMode),
PpmFlowGraph,
variants
}
-#[deriving(Clone, Show)]
+#[derive(Clone, Show)]
pub enum UserIdentifiedItem {
ItemViaNode(ast::NodeId),
ItemViaPath(Vec<String>),
use {ValueRef, TwineRef, DebugLocRef, DiagnosticInfoRef};
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum OptimizationDiagnosticKind {
OptimizationRemark,
OptimizationMissed,
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Diagnostic {
Optimization(OptimizationDiagnostic),
// Consts for the LLVM CallConv type, pre-cast to uint.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum CallConv {
CCallConv = 0,
FastCallConv = 8,
X86_64_Win64 = 79,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Visibility {
LLVMDefaultVisibility = 0,
HiddenVisibility = 1,
// DLLExportLinkage, GhostLinkage and LinkOnceODRAutoHideLinkage.
// LinkerPrivateLinkage and LinkerPrivateWeakLinkage are not included either;
// they've been removed in upstream LLVM commit r203866.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Linkage {
ExternalLinkage = 0,
AvailableExternallyLinkage = 1,
}
#[repr(C)]
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum DiagnosticSeverity {
Error,
Warning,
#[repr(u64)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum OtherAttribute {
// The following are not really exposed in
// the LLVM c api so instead to add these
NonNullAttribute = 1 << 44,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum SpecialAttribute {
DereferenceableAttribute(u64)
}
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AttributeSet {
ReturnIndex = 0,
FunctionIndex = !0
}
// enum for the LLVM IntPredicate type
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum IntPredicate {
IntEQ = 32,
IntNE = 33,
}
// enum for the LLVM RealPredicate type
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum RealPredicate {
RealPredicateFalse = 0,
RealOEQ = 1,
// The LLVM TypeKind type - must stay in sync with the def of
// LLVMTypeKind in llvm/include/llvm-c/Core.h
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
#[repr(C)]
pub enum TypeKind {
Void = 0,
}
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AtomicBinOp {
AtomicXchg = 0,
AtomicAdd = 1,
}
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AtomicOrdering {
NotAtomic = 0,
Unordered = 1,
// Consts for the LLVMCodeGenFileType type (in include/llvm/c/TargetMachine.h)
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum FileType {
AssemblyFileType = 0,
ObjectFileType = 1
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum MetadataType {
MD_dbg = 0,
MD_tbaa = 1,
}
// Inline Asm Dialect
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AsmDialect {
AD_ATT = 0,
AD_Intel = 1
}
-#[deriving(Copy, PartialEq, Clone)]
+#[derive(Copy, PartialEq, Clone)]
#[repr(C)]
pub enum CodeGenOptLevel {
CodeGenLevelNone = 0,
CodeGenLevelAggressive = 3,
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
#[repr(C)]
pub enum RelocMode {
RelocDefault = 0,
}
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum CodeGenModel {
CodeModelDefault = 0,
CodeModelJITDefault = 1,
}
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum DiagnosticKind {
DK_InlineAsm = 0,
DK_StackSize,
pub type DIArray = DIDescriptor;
pub type DISubrange = DIDescriptor;
- #[deriving(Copy)]
+ #[derive(Copy)]
pub enum DIDescriptorFlags {
FlagPrivate = 1 << 0,
FlagProtected = 1 << 1,
// Specifies how duplicates should be handled when adding a child item if
// another item exists with the same name in some namespace.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum DuplicateCheckingMode {
ForbidDuplicateModules,
ForbidDuplicateTypesAndModules,
OverwriteDuplicates
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum NamespaceError {
NoError,
ModuleError,
mod record_exports;
mod build_reduced_graph;
-#[deriving(Copy)]
+#[derive(Copy)]
struct BindingInfo {
span: Span,
binding_mode: BindingMode,
// Map from the name in a pattern to its binding mode.
type BindingMap = HashMap<Name, BindingInfo>;
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum PatternBindingMode {
RefutableMode,
LocalIrrefutableMode,
ArgumentIrrefutableMode,
}
-#[deriving(Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Copy, PartialEq, Eq, Hash, Show)]
enum Namespace {
TypeNS,
ValueNS
/// A NamespaceResult represents the result of resolving an import in
/// a particular namespace. The result is either definitely-resolved,
/// definitely- unresolved, or unknown.
-#[deriving(Clone)]
+#[derive(Clone)]
enum NamespaceResult {
/// Means that resolve hasn't gathered enough information yet to determine
/// whether the name is bound in this namespace. (That is, it hasn't
}
/// Contains data for specific types of import directives.
-#[deriving(Copy,Show)]
+#[derive(Copy,Show)]
enum ImportDirectiveSubclass {
SingleImport(Name /* target */, Name /* source */),
GlobImport
TraitMethod(String),
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum TypeParameters<'a> {
NoTypeParameters,
HasTypeParameters(
// The rib kind controls the translation of local
// definitions (`DefLocal`) to upvars (`DefUpvar`).
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
enum RibKind {
// No translation needs to be applied.
NormalRibKind,
}
// Methods can be required or provided. RequiredMethod methods only occur in traits.
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
enum MethodSort {
RequiredMethod,
ProvidedMethod(NodeId)
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum UseLexicalScopeFlag {
DontUseLexicalScope,
UseLexicalScope
PrefixFound(Rc<Module>, uint)
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum NameSearchType {
/// We're doing a name search in order to resolve a `use` directive.
ImportSearch,
PathSearch,
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum BareIdentifierPatternResolution {
FoundStructOrEnumVariant(Def, LastPrivate),
FoundConst(Def, LastPrivate),
}
/// One local scope.
-#[deriving(Show)]
+#[derive(Show)]
struct Rib {
bindings: HashMap<Name, DefLike>,
kind: RibKind,
}
/// Whether an import can be shadowed by another import.
-#[deriving(Show,PartialEq,Clone,Copy)]
+#[derive(Show,PartialEq,Clone,Copy)]
enum Shadowable {
Always,
Never
}
/// One import directive.
-#[deriving(Show)]
+#[derive(Show)]
struct ImportDirective {
module_path: Vec<Name>,
subclass: ImportDirectiveSubclass,
}
/// The item that an import resolves to.
-#[deriving(Clone,Show)]
+#[derive(Clone,Show)]
struct Target {
target_module: Rc<Module>,
bindings: Rc<NameBindings>,
}
/// An ImportResolution represents a particular `use` directive.
-#[deriving(Show)]
+#[derive(Show)]
struct ImportResolution {
/// Whether this resolution came from a `use` or a `pub use`. Note that this
/// should *not* be used whenever resolution is being performed, this is
}
/// The link from a module up to its nearest parent node.
-#[deriving(Clone,Show)]
+#[derive(Clone,Show)]
enum ParentLink {
NoParentLink,
ModuleParentLink(Weak<Module>, Name),
}
/// The type of module this is.
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
enum ModuleKind {
NormalModuleKind,
TraitModuleKind,
}
bitflags! {
- #[deriving(Show)]
+ #[derive(Show)]
flags DefModifiers: u8 {
const PUBLIC = 0b0000_0001,
const IMPORTABLE = 0b0000_0010,
}
// Records a possibly-private type definition.
-#[deriving(Clone,Show)]
+#[derive(Clone,Show)]
struct TypeNsDef {
modifiers: DefModifiers, // see note in ImportResolution about how to use this
module_def: Option<Rc<Module>>,
}
// Records a possibly-private value definition.
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
struct ValueNsDef {
modifiers: DefModifiers, // see note in ImportResolution about how to use this
def: Def,
// Records the definitions (at most one for each namespace) that a name is
// bound to.
-#[deriving(Show)]
+#[derive(Show)]
struct NameBindings {
type_def: RefCell<Option<TypeNsDef>>, //< Meaning in type namespace.
value_def: RefCell<Option<ValueNsDef>>, //< Meaning in value namespace.
}
/// Ways in which a trait can be referenced
-#[deriving(Copy)]
+#[derive(Copy)]
enum TraitReferenceType {
TraitImplementation, // impl SomeTrait for T { ... }
TraitDerivation, // trait T : SomeTrait { ... }
used_crates: HashSet<CrateNum>,
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
enum FallbackChecks {
Everything,
OnlyTraitAndStatics
pub glob_map: Option<GlobMap>
}
-#[deriving(PartialEq,Copy)]
+#[derive(PartialEq,Copy)]
pub enum MakeGlobMap {
Yes,
No
use std::thread;
use libc::{c_uint, c_int, c_void};
-#[deriving(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
+#[derive(Clone, Copy, PartialEq, PartialOrd, Ord, Eq)]
pub enum OutputType {
OutputTypeBitcode,
OutputTypeAssembly,
// We use an Arc instead of just returning a list of diagnostics from the
// child task because we need to make sure that the messages are seen even
// if the child task panics (for example, when `fatal` is called).
-#[deriving(Clone)]
+#[derive(Clone)]
struct SharedEmitter {
buffer: Arc<Mutex<Vec<Diagnostic>>>,
}
/// Module-specific configuration for `optimize_and_codegen`.
-#[deriving(Clone)]
+#[derive(Clone)]
struct ModuleConfig {
/// LLVM TargetMachine to use for codegen.
tm: TargetMachineRef,
})
}
-#[deriving(Copy,Show)]
+#[derive(Copy,Show)]
pub enum Row {
Variable,
Enum,
use syntax::parse::token;
use syntax::parse::token::{keywords, Token};
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct SpanUtils<'a> {
pub sess: &'a Session,
pub err_count: Cell<int>,
use syntax::fold::Folder;
use syntax::ptr::P;
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
struct ConstantExpr<'a>(&'a ast::Expr);
impl<'a> ConstantExpr<'a> {
}
// An option identifying a branch (either a literal, an enum variant or a range)
-#[deriving(Show)]
+#[derive(Show)]
enum Opt<'a, 'tcx> {
ConstantValue(ConstantExpr<'a>),
ConstantRange(ConstantExpr<'a>, ConstantExpr<'a>),
}
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum BranchKind {
NoBranch,
Single,
LowerBound(Result<'blk, 'tcx>)
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub enum TransBindingMode {
TrByCopy(/* llbinding */ ValueRef),
TrByMove,
/// - `trmode` is the trans binding mode
/// - `id` is the node id of the binding
/// - `ty` is the Rust type of the binding
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct BindingInfo<'tcx> {
pub llmatch: ValueRef,
pub trmode: TransBindingMode,
type Hint = attr::ReprAttr;
/// Representations.
-#[deriving(Eq, PartialEq, Show)]
+#[derive(Eq, PartialEq, Show)]
pub enum Repr<'tcx> {
/// C-like enums; basically an int.
CEnum(IntType, Disr, Disr), // discriminant range (signedness based on the IntType)
}
/// For structs, and struct-like parts of anything fancier.
-#[deriving(Eq, PartialEq, Show)]
+#[derive(Eq, PartialEq, Show)]
pub struct Struct<'tcx> {
// If the struct is DST, then the size and alignment do not take into
// account the unsized fields of the struct.
}
}
-#[deriving(Show)]
+#[derive(Show)]
struct IntBounds {
slo: i64,
shi: i64,
// Used only for creating scalar comparison glue.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum scalar_type { nil_type, signed_int, unsigned_int, floating_point, }
pub fn compare_scalar_types<'blk, 'tcx>(cx: Block<'blk, 'tcx>,
}
}
-#[deriving(Clone, Copy, Eq, PartialEq)]
+#[derive(Clone, Copy, Eq, PartialEq)]
pub enum IsUnboxedClosureFlag {
NotUnboxedClosure,
IsUnboxedClosure,
/// Enum describing the origin of an LLVM `Value`, for linkage purposes.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum ValueOrigin {
/// The LLVM `Value` is in this context because the corresponding item was
/// assigned to the current compilation unit.
use trans::value::{Users, Value};
use std::iter::{Filter, Map};
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct BasicBlock(pub BasicBlockRef);
pub type Preds = Map<
use trans::cabi_mips;
use trans::type_::Type;
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum ArgKind {
/// Pass the argument directly using the normal converted
/// LLVM type or by coercing to another specified type
/// should be passed to or returned from a function
///
/// This is borrowed from clang's ABIInfo.h
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct ArgType {
pub kind: ArgKind,
/// Original LLVM type
use std::cmp;
use std::iter::repeat;
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
enum RegClass {
NoClass,
Int,
use syntax::ast_map;
use syntax::ptr::P;
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct MethodData {
pub llfn: ValueRef,
pub llself: ValueRef,
bcx
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AutorefArg {
DontAutorefArg,
DoAutorefArg(ast::NodeId)
cached_landing_pad: Option<BasicBlockRef>,
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub struct CustomScopeIndex {
index: uint
}
}
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum EarlyExitLabel {
UnwindExit,
ReturnExit,
LoopExit(ast::NodeId, uint)
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct CachedEarlyExit {
label: EarlyExitLabel,
cleanup_block: BasicBlockRef,
pub type CleanupObj<'tcx> = Box<Cleanup<'tcx>+'tcx>;
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum ScopeId {
AstScope(ast::NodeId),
CustomScope(CustomScopeIndex)
///////////////////////////////////////////////////////////////////////////
// Cleanup types
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct DropValue<'tcx> {
is_immediate: bool,
must_unwind: bool,
}
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum Heap {
HeapExchange
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct FreeValue<'tcx> {
ptr: ValueRef,
heap: Heap,
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct FreeSlice {
ptr: ValueRef,
size: ValueRef,
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct LifetimeEnd {
ptr: ValueRef,
}
//
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct EnvValue<'tcx> {
action: ast::CaptureClause,
datum: Datum<'tcx, Lvalue>
Store(bcx, llenvptr, GEPi(bcx, pair, &[0u, abi::FAT_PTR_EXTRA]));
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub enum ClosureKind<'tcx> {
NotClosure,
// See load_environment.
PathName(token::gensym(format!("{}:{}", name, num)[]))
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct tydesc_info<'tcx> {
pub ty: Ty<'tcx>,
pub tydesc: ValueRef,
*
*/
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NodeInfo {
pub id: ast::NodeId,
pub span: Span,
}
// Key used to lookup values supplied for type parameters in an expr.
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum ExprOrMethodCall {
// Type parameters for a path like `None::<int>`
ExprId(ast::NodeId),
/// 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, Copy)]
+#[derive(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.
pub datum: Datum<'tcx, K>,
}
-#[deriving(Show)]
+#[derive(Show)]
pub enum Expr {
/// a fresh value that was produced and which has no cleanup yet
/// because it has not yet "landed" into its permanent home
LvalueExpr,
}
-#[deriving(Clone, Copy, Show)]
+#[derive(Clone, Copy, Show)]
pub struct Lvalue;
-#[deriving(Show)]
+#[derive(Show)]
pub struct Rvalue {
pub mode: RvalueMode
}
fn drop(&mut self) { }
}
-#[deriving(Copy, PartialEq, Eq, Hash, Show)]
+#[derive(Copy, PartialEq, Eq, Hash, Show)]
pub enum RvalueMode {
/// `val` is a pointer to the actual value (and thus has type *T)
ByRef,
// Public Interface of debuginfo module
//=-----------------------------------------------------------------------------
-#[deriving(Copy, Show, Hash, Eq, PartialEq, Clone)]
+#[derive(Copy, Show, Hash, Eq, PartialEq, Clone)]
struct UniqueTypeId(ast::Name);
// The TypeMap is where the CrateDebugContext holds the type metadata nodes
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum EnumDiscriminantInfo {
RegularDiscriminant(DIType),
OptimizedDiscriminant,
}
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum DebugLocation {
KnownLocation { scope: DIScope, line: uint, col: uint },
UnknownLocation
// These are passed around by the code generating functions to track the
// destination of a computation's value.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Dest {
SaveIn(ValueRef),
Ignore,
} else { llsrc };
}
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum cast_kind {
cast_pointer,
cast_integral,
mod llrepr;
mod cleanup;
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ModuleTranslation {
pub llcx: ContextRef,
pub llmod: ModuleRef,
(lldecl, true)
}
-#[deriving(PartialEq, Eq, Hash, Show)]
+#[derive(PartialEq, Eq, Hash, Show)]
pub struct MonoId<'tcx> {
pub def: ast::DefId,
pub params: subst::VecPerParamSpace<Ty<'tcx>>
})
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct VecTypes<'tcx> {
pub unit_ty: Ty<'tcx>,
pub llunit_ty: Type,
use libc::c_uint;
-#[deriving(Clone, Copy, PartialEq, Show)]
+#[derive(Clone, Copy, PartialEq, Show)]
#[repr(C)]
pub struct Type {
rf: TypeRef
}
// Want refinements! (Or case classes, I guess
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum named_ty {
a_struct,
an_enum,
use trans::common::Block;
use libc::c_uint;
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Value(pub ValueRef);
macro_rules! opt_val { ($e:expr) => (
}
/// Wrapper for LLVM UseRef
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Use(UseRef);
impl Use {
// A pared down enum describing just the places from which a method
// candidate can arise. Used for error reporting only.
-#[deriving(Copy, PartialOrd, Ord, PartialEq, Eq)]
+#[derive(Copy, PartialOrd, Ord, PartialEq, Eq)]
pub enum CandidateSource {
ImplSource(ast::DefId),
TraitSource(/* trait id */ ast::DefId),
pub kind: PickKind<'tcx>,
}
-#[deriving(Clone,Show)]
+#[derive(Clone,Show)]
pub enum PickKind<'tcx> {
InherentImplPick(/* Impl */ ast::DefId),
ObjectPick(/* Trait */ ast::DefId, /* method_num */ uint, /* real_index */ uint),
// difference is that it doesn't embed any regions or other
// specifics. The "confirmation" step recreates those details as
// needed.
-#[deriving(Clone,Show)]
+#[derive(Clone,Show)]
pub enum PickAdjustment {
// Indicates that the source expression should be autoderef'd N times
//
/// When type-checking an expression, we propagate downward
/// whatever type hint we are able in the form of an `Expectation`.
-#[deriving(Copy)]
+#[derive(Copy)]
enum Expectation<'tcx> {
/// We know nothing about what type this expression should have.
NoExpectation,
}
}
-#[deriving(Copy, Clone)]
+#[derive(Copy, Clone)]
pub struct UnsafetyState {
pub def: ast::NodeId,
pub unsafety: ast::Unsafety,
/// Whether `check_binop` is part of an assignment or not.
/// Used to know whether we allow user overloads and to print
/// better messages on error.
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
enum IsBinopAssignment{
SimpleBinop,
BinopAssignment,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct FnCtxt<'a, 'tcx: 'a> {
body_id: ast::NodeId,
}
}
-#[deriving(Copy, Show, PartialEq, Eq)]
+#[derive(Copy, Show, PartialEq, Eq)]
pub enum LvaluePreference {
PreferMutLvalue,
NoPreference
// Controls whether the arguments are automatically referenced. This is useful
// for overloaded binary and unary operators.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum AutorefArgs {
Yes,
No,
/// Instead of:
///
/// f((1, 2));
-#[deriving(Clone, Eq, PartialEq)]
+#[derive(Clone, Eq, PartialEq)]
enum TupleArgumentsFlag {
DontTupleArguments,
TupleArguments,
///////////////////////////////////////////////////////////////////////////
// Resolution reason.
-#[deriving(Copy)]
+#[derive(Copy)]
enum ResolveReason {
ResolvingExpr(Span),
ResolvingLocal(Span),
// A scope in which all regions must be explicitly named. This is used
// for types that appear in structs and so on.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ExplicitRscope;
impl RegionScope for ExplicitRscope {
type VarianceTermPtr<'a> = &'a VarianceTerm<'a>;
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
struct InferredIndex(uint);
-#[deriving(Copy)]
+#[derive(Copy)]
enum VarianceTerm<'a> {
ConstantTerm(ty::Variance),
TransformTerm(VarianceTermPtr<'a>, VarianceTermPtr<'a>),
inferred_infos: Vec<InferredInfo<'a>> ,
}
-#[deriving(Copy, Show, PartialEq)]
+#[derive(Copy, Show, PartialEq)]
enum ParamKind {
TypeParam,
RegionParam
/// Declares that the variable `decl_id` appears in a location with
/// variance `variance`.
-#[deriving(Copy)]
+#[derive(Copy)]
struct Constraint<'a> {
inferred: InferredIndex,
variance: &'a VarianceTerm<'a>,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Crate {
pub name: String,
pub src: FsPath,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct ExternalCrate {
pub name: String,
pub attrs: Vec<Attribute>,
/// Anything with a source location and set of attributes and, optionally, a
/// name. That is, anything that can be documented. This doesn't correspond
/// directly to the AST's concept of an item; it's a strict superset.
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Item {
/// Stringified span
pub source: Span,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum ItemEnum {
StructItem(Struct),
EnumItem(Enum),
AssociatedTypeItem(TyParam),
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Module {
pub items: Vec<Item>,
pub is_crate: bool,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub enum Attribute {
Word(String),
List(String, Vec<Attribute> ),
fn meta_item_list(&self) -> Option<&[P<ast::MetaItem>]> { None }
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct TyParam {
pub name: String,
pub did: ast::DefId,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub enum TyParamBound {
RegionBound(Lifetime),
TraitBound(PolyTrait, ast::TraitBoundModifier)
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct Lifetime(String);
impl Lifetime {
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub enum WherePredicate {
BoundPredicate { ty: Type, bounds: Vec<TyParamBound> },
RegionPredicate { lifetime: Lifetime, bounds: Vec<Lifetime>},
}
// maybe use a Generic enum and use ~[Generic]?
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct Generics {
pub lifetimes: Vec<Lifetime>,
pub type_params: Vec<TyParam>,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Method {
pub generics: Generics,
pub self_: SelfTy,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct TyMethod {
pub unsafety: ast::Unsafety,
pub decl: FnDecl,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub enum SelfTy {
SelfStatic,
SelfValue,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Function {
pub decl: FnDecl,
pub generics: Generics,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct ClosureDecl {
pub lifetimes: Vec<Lifetime>,
pub decl: FnDecl,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct FnDecl {
pub inputs: Arguments,
pub output: FunctionRetTy,
pub attrs: Vec<Attribute>,
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct Arguments {
pub values: Vec<Argument>,
}
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct Argument {
pub type_: Type,
pub name: String,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub enum FunctionRetTy {
Return(Type),
NoReturn
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Trait {
pub unsafety: ast::Unsafety,
pub items: Vec<TraitMethod>,
/// An item belonging to a trait, whether a method or associated. Could be named
/// TraitItem except that's already taken by an exported enum variant.
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum TraitMethod {
RequiredMethod(Item),
ProvidedMethod(Item),
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum ImplMethod {
MethodImplItem(Item),
TypeImplItem(Item),
}
/// A trait reference, which may have higher ranked lifetimes.
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct PolyTrait {
pub trait_: Type,
pub lifetimes: Vec<Lifetime>
/// A representation of a Type suitable for hyperlinking purposes. Ideally one can get the original
/// type out of the AST/ty::ctxt given one of these, if more information is needed. Most importantly
/// it does not preserve mutability or boxes.
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub enum Type {
/// structs/enums/traits (anything that'd be an ast::TyPath)
ResolvedPath {
PolyTraitRef(Vec<TyParamBound>),
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Copy)]
pub enum PrimitiveType {
Int, I8, I16, I32, I64,
Uint, U8, U16, U32, U64,
PrimitiveTuple,
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, Copy)]
pub enum TypeKind {
TypeEnum,
TypeFunction,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum StructField {
HiddenStructField, // inserted later by strip passes
TypedStructField(Type),
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Struct {
pub struct_type: doctree::StructType,
pub generics: Generics,
/// This is a more limited form of the standard Struct, different in that
/// it lacks the things most items have (name, id, parameterization). Found
/// only as a variant in an enum.
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct VariantStruct {
pub struct_type: doctree::StructType,
pub fields: Vec<Item>,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Enum {
pub variants: Vec<Item>,
pub generics: Generics,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Variant {
pub kind: VariantKind,
}
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum VariantKind {
CLikeVariant,
TupleVariant(Vec<Type>),
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, Show)]
+#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
pub struct Span {
pub filename: String,
pub loline: uint,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct Path {
pub global: bool,
pub segments: Vec<PathSegment>,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub enum PathParameters {
AngleBracketed {
lifetimes: Vec<Lifetime>,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct PathSegment {
pub name: String,
pub params: PathParameters
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Typedef {
pub type_: Type,
pub generics: Generics,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq)]
pub struct BareFunctionDecl {
pub unsafety: ast::Unsafety,
pub generics: Generics,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, Show)]
+#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
pub struct Static {
pub type_: Type,
pub mutability: Mutability,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, Show)]
+#[derive(Clone, RustcEncodable, RustcDecodable, Show)]
pub struct Constant {
pub type_: Type,
pub expr: String,
}
}
-#[deriving(Show, Clone, RustcEncodable, RustcDecodable, PartialEq, Copy)]
+#[derive(Show, Clone, RustcEncodable, RustcDecodable, PartialEq, Copy)]
pub enum Mutability {
Mutable,
Immutable,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Impl {
pub generics: Generics,
pub trait_: Option<Type>,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct ViewItem {
pub inner: ViewItemInner,
}
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum ViewItemInner {
ExternCrate(String, Option<String>, ast::NodeId),
Import(ViewPath)
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub enum ViewPath {
// use source as str;
SimpleImport(String, ImportSource),
ImportList(ImportSource, Vec<ViewListIdent>),
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct ImportSource {
pub path: Path,
pub did: Option<ast::DefId>,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct ViewListIdent {
pub name: String,
pub source: Option<ast::DefId>,
})
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Macro {
pub source: String,
}
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable)]
+#[derive(Clone, RustcEncodable, RustcDecodable)]
pub struct Stability {
pub level: attr::StabilityLevel,
pub text: String
}
}
-#[deriving(Show, Clone, RustcEncodable, RustcDecodable, Copy)]
+#[derive(Show, Clone, RustcEncodable, RustcDecodable, Copy)]
pub enum StructType {
/// A normal struct
Plain,
pub stab: Option<attr::Stability>,
}
-#[deriving(Show)]
+#[derive(Show)]
pub struct Static {
pub type_: P<ast::Ty>,
pub mutability: ast::Mutability,
use std::{io, str};
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct ExternalHtml{
pub in_header: String,
pub before_content: String,
/// Helper to render an optional visibility with a space after it (if the
/// visibility is preset)
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct VisSpace(pub Option<ast::Visibility>);
/// Similarly to VisSpace, this structure is used to render a function style with a
/// space after it.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct UnsafetySpace(pub ast::Unsafety);
/// Wrapper struct for properly emitting a method declaration.
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
/// Similar to VisSpace, but used for mutability
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct MutableSpace(pub clean::Mutability);
/// Similar to VisSpace, but used for mutability
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct RawMutableSpace(pub clean::Mutability);
/// Wrapper struct for properly emitting the stability level.
pub struct Stability<'a>(pub &'a Option<clean::Stability>);
/// discriminants. JavaScript then is used to decode them into the original value.
/// Consequently, every change to this type should be synchronized to
/// the `itemTypes` mapping table in `static/main.js`.
-#[deriving(Copy, PartialEq, Clone)]
+#[derive(Copy, PartialEq, Clone)]
pub enum ItemType {
Module = 0,
Struct = 1,
use externalfiles::ExternalHtml;
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Layout {
pub logo: String,
pub favicon: String,
}
}
-#[deriving(Eq, PartialEq, Clone, Show)]
+#[derive(Eq, PartialEq, Clone, Show)]
struct LangString {
should_fail: bool,
no_run: bool,
/// It is intended that this context is a lightweight object which can be fairly
/// easily cloned because it is cloned per work-job (about once per item in the
/// rustdoc tree).
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Context {
/// Current hierarchy of components leading down to what's currently being
/// rendered
}
/// Metadata about implementations for a type.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Impl {
pub impl_: clean::Impl,
pub dox: Option<String>,
/// to be a fairly large and expensive structure to clone. Instead this adheres
/// to `Send` so it may be stored in a `Arc` instance and shared among the various
/// rendering tasks.
-#[deriving(Default)]
+#[derive(Default)]
pub struct Cache {
/// Mapping of typaram ids to the name of the type parameter. This is used
/// when pretty-printing a type (so pretty printing doesn't have to
// Helper structs for rendering items/sidebars and carrying along contextual
// information
-#[deriving(Copy)]
+#[derive(Copy)]
struct Item<'a> {
cx: &'a Context,
item: &'a clean::Item,
use std::string::String;
/// A (recursive) table of contents
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub struct Toc {
/// The levels are strictly decreasing, i.e.
///
}
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub struct TocEntry {
level: u32,
sec_number: String,
}
/// Progressive construction of a table of contents.
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub struct TocBuilder {
top_level: Toc,
/// The current hierarchy of parent headings, the levels are
use html::render::cache;
-#[deriving(Zero, RustcEncodable, RustcDecodable, PartialEq, Eq)]
+#[derive(Zero, RustcEncodable, RustcDecodable, PartialEq, Eq)]
/// The counts for each stability level.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Counts {
pub deprecated: uint,
pub experimental: uint,
}
}
-#[deriving(RustcEncodable, RustcDecodable, PartialEq, Eq)]
+#[derive(RustcEncodable, RustcDecodable, PartialEq, Eq)]
/// A summarized module, which includes total counts and summarized children
/// modules.
pub struct ModuleSummary {
use std::error;
/// Available encoding character sets
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum CharacterSet {
/// The standard character set (uses `+` and `/`)
Standard,
}
/// Available newline types
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Newline {
/// A linefeed (i.e. Unix-style newline)
LF,
}
/// Contains configuration parameters for `to_base64`.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Config {
/// Character set to use
pub char_set: CharacterSet,
}
/// Errors that can occur when decoding a base64 encoded string
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum FromBase64Error {
/// The input contained a character not part of the base64 format
InvalidBase64Byte(u8, uint),
}
/// Errors that can occur when decoding a hex encoded string
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum FromHexError {
/// The input contained a character not part of the hex format
InvalidHexCharacter(char, uint),
//! To be able to encode a piece of data, it must implement the `serialize::RustcEncodable` trait.
//! To be able to decode a piece of data, it must implement the `serialize::RustcDecodable` trait.
//! The Rust compiler provides an annotation to automatically generate the code for these traits:
-//! `#[deriving(RustcDecodable, RustcEncodable)]`
+//! `#[derive(RustcDecodable, RustcEncodable)]`
//!
//! The JSON API provides an enum `json::Json` and a trait `ToJson` to encode objects.
//! The `ToJson` trait provides a `to_json` method to convert an object into a `json::Json` value.
//! use serialize::json;
//!
//! // Automatically generate `Decodable` and `Encodable` trait implementations
-//! #[deriving(RustcDecodable, RustcEncodable)]
+//! #[derive(RustcDecodable, RustcEncodable)]
//! pub struct TestStruct {
//! data_int: u8,
//! data_str: String,
//! }
//!
//! // Only generate `RustcEncodable` trait implementation
-//! #[deriving(Encodable)]
+//! #[derive(Encodable)]
//! pub struct ComplexNumRecord {
//! uid: u8,
//! dsc: String,
//! use serialize::json::{self, Json, ToJson};
//!
//! // Only generate `Decodable` trait implementation
-//! #[deriving(Decodable)]
+//! #[derive(Decodable)]
//! pub struct TestStruct {
//! data_int: u8,
//! data_str: String,
use Encodable;
/// Represents a json value
-#[deriving(Clone, PartialEq, PartialOrd)]
+#[derive(Clone, PartialEq, PartialOrd)]
pub enum Json {
I64(i64),
U64(u64),
pub struct AsPrettyJson<'a, T: 'a> { inner: &'a T, indent: Option<uint> }
/// The errors that can arise while parsing a JSON stream.
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum ErrorCode {
InvalidSyntax,
InvalidNumber,
NotUtf8,
}
-#[deriving(Clone, Copy, PartialEq, Show)]
+#[derive(Clone, Copy, PartialEq, Show)]
pub enum ParserError {
/// msg, line, col
SyntaxError(ErrorCode, uint, uint),
// Builder and Parser have the same errors.
pub type BuilderError = ParserError;
-#[deriving(Clone, PartialEq, Show)]
+#[derive(Clone, PartialEq, Show)]
pub enum DecoderError {
ParseError(ParserError),
ExpectedError(string::String, string::String),
}
/// The output of the streaming parser.
-#[deriving(PartialEq, Clone, Show)]
+#[derive(PartialEq, Clone, Show)]
pub enum JsonEvent {
ObjectStart,
ObjectEnd,
Error(ParserError),
}
-#[deriving(PartialEq, Show)]
+#[derive(PartialEq, Show)]
enum ParserState {
// Parse a value in an array, true means first element.
ParseArray(bool),
/// StackElements compose a Stack.
/// For example, Key("foo"), Key("bar"), Index(3) and Key("x") are the
/// StackElements compositing the stack that represents foo.bar[3].x
-#[deriving(PartialEq, Clone, Show)]
+#[derive(PartialEq, Clone, Show)]
pub enum StackElement<'l> {
Index(u32),
Key(&'l str),
// Internally, Key elements are stored as indices in a buffer to avoid
// allocating a string for every member of an object.
-#[deriving(PartialEq, Clone, Show)]
+#[derive(PartialEq, Clone, Show)]
enum InternalStackElement {
InternalIndex(u32),
InternalKey(u16, u16), // start, size
use std::num::Float;
use std::string;
- #[deriving(RustcDecodable, Eq, PartialEq, Show)]
+ #[derive(RustcDecodable, Eq, PartialEq, Show)]
struct OptionData {
opt: Option<uint>,
}
ExpectedError("Number".to_string(), "false".to_string()));
}
- #[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)]
+ #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)]
enum Animal {
Dog,
Frog(string::String, int)
}
- #[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)]
+ #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)]
struct Inner {
a: (),
b: uint,
c: Vec<string::String>,
}
- #[deriving(PartialEq, RustcEncodable, RustcDecodable, Show)]
+ #[derive(PartialEq, RustcEncodable, RustcDecodable, Show)]
struct Outer {
inner: Vec<Inner>,
}
);
}
- #[deriving(RustcDecodable)]
+ #[derive(RustcDecodable)]
struct FloatStruct {
f: f64,
a: Vec<f64>
Err(SyntaxError(EOFWhileParsingObject, 3u, 8u)));
}
- #[deriving(RustcDecodable)]
+ #[derive(RustcDecodable)]
#[allow(dead_code)]
struct DecodeStruct {
x: f64,
z: string::String,
w: Vec<DecodeStruct>
}
- #[deriving(RustcDecodable)]
+ #[derive(RustcDecodable)]
enum DecodeEnum {
A(f64),
B(string::String)
($(#[$attr:meta])* flags $BitFlags:ident: $T:ty {
$($(#[$Flag_attr:meta])* const $Flag:ident = $value:expr),+
}) => {
- #[deriving(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
+ #[derive(Copy, PartialEq, Eq, Clone, PartialOrd, Ord, Hash)]
$(#[$attr])*
pub struct $BitFlags {
bits: $T,
///
/// Use with the `std::iter` module.
#[allow(raw_pointer_deriving)]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct CChars<'a> {
ptr: *const libc::c_char,
marker: marker::ContravariantLifetime<'a>,
/// This behavior is characterized by the following condition:
///
/// - if size > 0.909 * capacity: grow the map
-#[deriving(Clone)]
+#[derive(Clone)]
struct DefaultResizePolicy;
impl DefaultResizePolicy {
/// overridden with one of the constructors.
///
/// It is required that the keys implement the `Eq` and `Hash` traits, although
-/// this can frequently be achieved by using `#[deriving(Eq, Hash)]`.
+/// this can frequently be achieved by using `#[derive(Eq, Hash)]`.
///
/// Relevant papers/articles:
///
/// ```
/// use std::collections::HashMap;
///
-/// #[deriving(Hash, Eq, PartialEq, Show)]
+/// #[derive(Hash, Eq, PartialEq, Show)]
/// struct Viking {
/// name: String,
/// country: String,
/// println!("{} has {} hp", viking, health);
/// }
/// ```
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct HashMap<K, V, H = RandomSipHasher> {
// All hashes are keyed on these values, to prevent hash collision attacks.
inner: table::Iter<'a, K, V>
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, K, V> Clone for Iter<'a, K, V> {
fn clone(&self) -> Iter<'a, K, V> {
Iter {
inner: Map<(&'a K, &'a V), &'a K, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a K>
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, K, V> Clone for Keys<'a, K, V> {
fn clone(&self) -> Keys<'a, K, V> {
Keys {
inner: Map<(&'a K, &'a V), &'a V, Iter<'a, K, V>, fn((&'a K, &'a V)) -> &'a V>
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, K, V> Clone for Values<'a, K, V> {
fn clone(&self) -> Values<'a, K, V> {
Values {
thread_local! { static DROP_VECTOR: RefCell<Vec<int>> = RefCell::new(Vec::new()) }
- #[deriving(Hash, PartialEq, Eq)]
+ #[derive(Hash, PartialEq, Eq)]
struct Dropable {
k: uint
}
///
/// ```
/// use std::collections::HashSet;
-/// #[deriving(Hash, Eq, PartialEq, Show)]
+/// #[derive(Hash, Eq, PartialEq, Show)]
/// struct Viking<'a> {
/// name: &'a str,
/// power: uint,
/// println!("{}", x);
/// }
/// ```
-#[deriving(Clone)]
+#[derive(Clone)]
#[stable]
pub struct HashSet<T, H = RandomSipHasher> {
map: HashMap<T, (), H>
/// A hash that is not zero, since we use a hash of zero to represent empty
/// buckets.
-#[deriving(PartialEq, Copy)]
+#[derive(PartialEq, Copy)]
pub struct SafeHash {
hash: u64,
}
marker: marker::ContravariantLifetime<'a>,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, K, V> Clone for RawBuckets<'a, K, V> {
fn clone(&self) -> RawBuckets<'a, K, V> {
RawBuckets {
elems_left: uint,
}
-// FIXME(#19839) Remove in favor of `#[deriving(Clone)]`
+// FIXME(#19839) Remove in favor of `#[derive(Clone)]`
impl<'a, K, V> Clone for Iter<'a, K, V> {
fn clone(&self) -> Iter<'a, K, V> {
Iter {
dlclose(handle as *mut libc::c_void); ()
}
- #[deriving(Copy)]
+ #[derive(Copy)]
pub enum Rtld {
Lazy = 1,
Now = 2,
//! Generic hashing support.
//!
//! This module provides a generic way to compute the hash of a value. The
-//! simplest way to make a type hashable is to use `#[deriving(Hash)]`:
+//! simplest way to make a type hashable is to use `#[derive(Hash)]`:
//!
//! # Example
//!
//! use std::hash;
//! use std::hash::Hash;
//!
-//! #[deriving(Hash)]
+//! #[derive(Hash)]
//! struct Person {
//! id: uint,
//! name: String,
/// `RandomSipHasher` computes the SipHash algorithm from a stream of bytes
/// initialized with random keys.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct RandomSipHasher {
hasher: sip::SipHasher,
}
/// A type, free to create, primarily intended for benchmarking creation of
/// wrappers that, just for construction, don't need a Reader/Writer that
/// does anything useful. Is equivalent to `/dev/null` in semantics.
- #[deriving(Clone,PartialEq,PartialOrd)]
+ #[derive(Clone,PartialEq,PartialOrd)]
pub struct NullStream;
impl Reader for NullStream {
}
/// An iterator that walks over a directory
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Directories {
stack: Vec<Path>,
}
/// assert_eq!(w.into_inner(), vec!(0, 1, 2));
/// ```
#[deprecated = "use the Vec<u8> Writer implementation directly"]
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct MemWriter {
buf: Vec<u8>,
}
/// # FIXME
///
/// Is something like this sufficient? It's kind of archaic
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
pub struct IoError {
/// An enumeration which can be matched against for determining the flavor
/// of error.
}
/// A list specifying general categories of I/O error.
-#[deriving(Copy, PartialEq, Eq, Clone, Show)]
+#[derive(Copy, PartialEq, Eq, Clone, Show)]
pub enum IoErrorKind {
/// Any I/O error not part of this list.
OtherIoError,
/// When seeking, the resulting cursor is offset from a base by the offset given
/// to the `seek` function. The base used is specified by this enumeration.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum SeekStyle {
/// Seek from the beginning of the stream
SeekSet,
/// A mode specifies how a file should be opened or created. These modes are
/// passed to `File::open_mode` and are used to control where the file is
/// positioned when it is initially opened.
-#[deriving(Copy, Clone, PartialEq, Eq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
pub enum FileMode {
/// Opens a file positioned at the beginning.
Open,
/// Access permissions with which the file should be opened. `File`s
/// opened with `Read` will return an error if written to.
-#[deriving(Copy, Clone, PartialEq, Eq)]
+#[derive(Copy, Clone, PartialEq, Eq)]
pub enum FileAccess {
/// Read-only access, requests to write will result in an error
Read,
}
/// Different kinds of files which can be identified by a call to stat
-#[deriving(Copy, PartialEq, Show, Hash, Clone)]
+#[derive(Copy, PartialEq, Show, Hash, Clone)]
pub enum FileType {
/// This is a normal file, corresponding to `S_IFREG`
RegularFile,
/// println!("byte size: {}", info.size);
/// # }
/// ```
-#[deriving(Copy, Hash)]
+#[derive(Copy, Hash)]
pub struct FileStat {
/// The size of the file, in bytes
pub size: u64,
/// structure. This information is not necessarily platform independent, and may
/// have different meanings or no meaning at all on some platforms.
#[unstable]
-#[deriving(Copy, Hash)]
+#[derive(Copy, Hash)]
pub struct UnstableFileStat {
/// The ID of the device containing the file.
pub device: u64,
use prelude::v1::{Ok, Vec, Buffer, SliceExt};
use uint;
- #[deriving(Clone, PartialEq, Show)]
+ #[derive(Clone, PartialEq, Show)]
enum BadReaderBehavior {
GoodBehavior(uint),
BadBehavior(uint)
use vec::Vec;
/// Hints to the types of sockets that are desired when looking up hosts
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum SocketType {
Stream, Datagram, Raw
}
/// to manipulate how a query is performed.
///
/// The meaning of each of these flags can be found with `man -s 3 getaddrinfo`
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Flag {
AddrConfig,
All,
/// A transport protocol associated with either a hint or a return value of
/// `lookup`
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Protocol {
TCP, UDP
}
///
/// For details on these fields, see their corresponding definitions via
/// `man -s 3 getaddrinfo`
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Hint {
pub family: uint,
pub socktype: Option<SocketType>,
pub flags: uint,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Info {
pub address: SocketAddr,
pub family: uint,
pub type Port = u16;
-#[deriving(Copy, PartialEq, Eq, Clone, Hash)]
+#[derive(Copy, PartialEq, Eq, Clone, Hash)]
pub enum IpAddr {
Ipv4Addr(u8, u8, u8, u8),
Ipv6Addr(u16, u16, u16, u16, u16, u16, u16, u16)
}
}
-#[deriving(Copy, PartialEq, Eq, Clone, Hash)]
+#[derive(Copy, PartialEq, Eq, Clone, Hash)]
pub struct SocketAddr {
pub ip: IpAddr,
pub port: Port,
/// A representation of environment variable name
/// It compares case-insensitive on Windows and case-sensitive everywhere else.
#[cfg(not(windows))]
-#[deriving(PartialEq, Eq, Hash, Clone, Show)]
+#[derive(PartialEq, Eq, Hash, Clone, Show)]
struct EnvKey(CString);
#[doc(hidden)]
#[cfg(windows)]
-#[deriving(Eq, Clone, Show)]
+#[derive(Eq, Clone, Show)]
struct EnvKey(CString);
#[cfg(windows)]
///
/// let output = process.stdout.as_mut().unwrap().read_to_end();
/// ```
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Command {
// The internal data for the builder. Documented by the builder
// methods below, and serialized into rt::rtio::ProcessConfig.
}
/// The output of a finished process.
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
pub struct ProcessOutput {
/// The status (exit code) of the process.
pub status: ProcessExit,
}
/// Describes what to do with a standard io stream for a child process.
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub enum StdioContainer {
/// This stream will be ignored. This is the equivalent of attaching the
/// stream to `/dev/null`
/// Describes the result of a process after it has terminated.
/// Note that Windows have no signals, so the result is usually ExitStatus.
-#[deriving(PartialEq, Eq, Clone, Copy)]
+#[derive(PartialEq, Eq, Clone, Copy)]
pub enum ProcessExit {
/// Normal termination with an exit status.
ExitStatus(int),
unsafe impl Sync for RaceBox {}
/// A synchronized wrapper around a buffered reader from stdin
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct StdinReader {
inner: Arc<Mutex<RaceBox>>,
}
}
/// A `Writer` which ignores bytes written to it, like /dev/null.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NullWriter;
impl Writer for NullWriter {
}
/// A `Reader` which returns an infinite stream of 0 bytes, like /dev/zero.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ZeroReader;
impl Reader for ZeroReader {
}
/// A `Reader` which is always at EOF, like /dev/null.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NullReader;
impl Reader for NullReader {
/// A `Reader` which chains input from multiple `Reader`s, reading each to
/// completion before moving onto the next.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct ChainedReader<I, R> {
readers: I,
cur_reader: Option<R>,
}
/// An adaptor converting an `Iterator<u8>` to a `Reader`.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct IterReader<T> {
iter: T,
}
test_checked_next_power_of_two! { test_checked_next_power_of_two_u64, u64 }
test_checked_next_power_of_two! { test_checked_next_power_of_two_uint, uint }
- #[deriving(PartialEq, Show)]
+ #[derive(PartialEq, Show)]
struct Value { x: int }
impl ToPrimitive for Value {
use vec::Vec;
/// A flag that specifies whether to use exponential (scientific) notation.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum ExponentFormat {
/// Do not use exponential notation.
ExpNone,
/// The number of digits used for emitting the fractional part of a number, if
/// any.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum SignificantDigits {
/// All calculable digits will be printed.
///
}
/// How to emit the sign of a number.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum SignFormat {
/// No sign will be printed. The exponent sign will also be emitted.
SignNone,
}
/// A low-level OS in-memory pipe.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Pipe {
/// A file descriptor representing the reading end of the pipe. Data written
/// on the `out` file descriptor can be read from this file descriptor.
impl Copy for MapOption {}
/// Possible errors when creating a map.
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum MapError {
/// # The following are POSIX-specific
///
Map<&'a [u8], Option<&'a str>, Components<'a>, fn(&[u8]) -> Option<&str>>;
/// Represents a POSIX file path
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Path {
repr: Vec<u8>, // assumed to never be empty or contain NULs
sepidx: Option<uint> // index of the final separator in repr
//
// The only error condition imposed here is valid utf-8. All other invalid paths are simply
// preserved by the data structure; let the Windows API error out on them.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Path {
repr: String, // assumed to never be empty
prefix: Option<PathPrefix>,
}
/// Prefix types for Path
-#[deriving(Copy, PartialEq, Clone, Show)]
+#[derive(Copy, PartialEq, Clone, Show)]
pub enum PathPrefix {
/// Prefix `\\?\`, uint is the length of the following component
VerbatimPrefix(uint),
/// The standard RNG. This is designed to be efficient on the current
/// platform.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct StdRng {
rng: IsaacWordRng,
}
#[cfg(any(not(target_arch = "arm"), target_os = "ios"))]
#[repr(C)]
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum _Unwind_Action {
_UA_SEARCH_PHASE = 1,
_UA_CLEANUP_PHASE = 2,
pub struct DISPATCHER_CONTEXT;
#[repr(C)]
- #[deriving(Copy)]
+ #[derive(Copy)]
pub enum EXCEPTION_DISPOSITION {
ExceptionContinueExecution,
ExceptionContinueSearch,
unsafe impl Send for Inner {}
unsafe impl Sync for Inner {}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct SignalToken {
inner: Arc<Inner>,
}
/// A `send` operation can only fail if the receiving end of a channel is
/// disconnected, implying that the data could never be received. The error
/// contains the data being sent as a payload so it can be recovered.
-#[deriving(PartialEq, Eq)]
+#[derive(PartialEq, Eq)]
#[stable]
pub struct SendError<T>(pub T);
///
/// The `recv` operation can only fail if the sending half of a channel is
/// disconnected, implying that no further messages will ever be received.
-#[deriving(PartialEq, Eq, Clone, Copy)]
+#[derive(PartialEq, Eq, Clone, Copy)]
#[stable]
pub struct RecvError;
/// This enumeration is the list of the possible reasons that try_recv could not
/// return data when called.
-#[deriving(PartialEq, Clone, Copy)]
+#[derive(PartialEq, Clone, Copy)]
#[stable]
pub enum TryRecvError {
/// This channel is currently empty, but the sender(s) have not yet
/// This enumeration is the list of the possible error outcomes for the
/// `SyncSender::try_send` method.
-#[deriving(PartialEq, Clone)]
+#[derive(PartialEq, Clone)]
#[stable]
pub enum TrySendError<T> {
/// The data could not be sent on the channel because it would require that
struct Packets { cur: *mut Handle<'static, ()> }
#[doc(hidden)]
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub enum StartResult {
Installed,
Abort,
size: uint,
}
-#[deriving(Show)]
+#[derive(Show)]
pub enum Failure {
Empty,
Disconnected,
// FIXME: move uses of Arc and deadline tracking to std::io
-#[deriving(Show)]
+#[derive(Show)]
pub enum SocketStatus {
Readable,
Writable,
unsafe impl Sync for Inner {}
-#[deriving(Clone)]
+#[derive(Clone)]
/// A handle to a thread.
pub struct Thread {
inner: Arc<Inner>,
/// Indicator of the state of a thread local storage key.
#[unstable = "state querying was recently added"]
-#[deriving(Eq, PartialEq, Copy)]
+#[derive(Eq, PartialEq, Copy)]
pub enum State {
/// All keys are in this state whenever a thread starts. Keys will
/// transition to the `Valid` state once the first call to `with` happens
/// ISO 8601 time duration with nanosecond precision.
/// This also allows for the negative duration; see individual methods for details.
-#[deriving(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub struct Duration {
secs: i64,
nanos: i32, // Always 0 <= nanos < NANOS_PER_SEC
use std::fmt;
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Os {
OsWindows,
OsMacos,
OsDragonfly,
}
-#[deriving(PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Clone, Copy)]
+#[derive(PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Clone, Copy)]
pub enum Abi {
// NB: This ordering MUST match the AbiDatas array below.
// (This is ensured by the test indices_are_correct().)
}
#[allow(non_camel_case_types)]
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum Architecture {
X86,
X86_64,
Mipsel
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct AbiData {
abi: Abi,
name: &'static str,
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum AbiArchitecture {
/// Not a real ABI (e.g., intrinsic)
RustArch,
/// table) and a SyntaxContext to track renaming and
/// macro expansion per Flatt et al., "Macros
/// That Work Together"
-#[deriving(Clone, Copy, Hash, PartialOrd, Eq, Ord)]
+#[derive(Clone, Copy, Hash, PartialOrd, Eq, Ord)]
pub struct Ident {
pub name: Name,
pub ctxt: SyntaxContext
/// A name is a part of an identifier, representing a string or gensym. It's
/// the result of interning.
-#[deriving(Eq, Ord, PartialEq, PartialOrd, Hash,
+#[derive(Eq, Ord, PartialEq, PartialOrd, Hash,
RustcEncodable, RustcDecodable, Clone, Copy)]
pub struct Name(pub u32);
/// Function name (not all functions have names)
pub type FnIdent = Option<Ident>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash,
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash,
Show, Copy)]
pub struct Lifetime {
pub id: NodeId,
pub name: Name
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct LifetimeDef {
pub lifetime: Lifetime,
pub bounds: Vec<Lifetime>
/// A "Path" is essentially Rust's notion of a name; for instance:
/// std::cmp::PartialEq . It's represented as a sequence of identifiers,
/// along with a bunch of supporting information.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Path {
pub span: Span,
/// A `::foo` path, is relative to the crate root rather than current
/// A segment of a path: an identifier, an optional lifetime, and a set of
/// types.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct PathSegment {
/// The identifier portion of this path segment.
pub identifier: Ident,
pub parameters: PathParameters,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum PathParameters {
AngleBracketedParameters(AngleBracketedParameterData),
ParenthesizedParameters(ParenthesizedParameterData),
}
/// A path like `Foo<'a, T>`
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct AngleBracketedParameterData {
/// The lifetime parameters for this path segment.
pub lifetimes: Vec<Lifetime>,
}
/// A path like `Foo(A,B) -> C`
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct ParenthesizedParameterData {
/// `(A,B)`
pub inputs: Vec<P<Ty>>,
pub type NodeId = u32;
-#[deriving(Clone, Eq, Ord, PartialOrd, PartialEq, RustcEncodable,
+#[derive(Clone, Eq, Ord, PartialOrd, PartialEq, RustcEncodable,
RustcDecodable, Hash, Show, Copy)]
pub struct DefId {
pub krate: CrateNum,
/// typeck::collect::compute_bounds matches these against
/// the "special" built-in traits (see middle::lang_items) and
/// detects Copy, Send and Sync.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum TyParamBound {
TraitTyParamBound(PolyTraitRef, TraitBoundModifier),
RegionTyParamBound(Lifetime)
/// A modifier on a bound, currently this is only used for `?Sized`, where the
/// modifier is `Maybe`. Negative bounds should also be handled here.
-#[deriving(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum TraitBoundModifier {
None,
Maybe,
pub type TyParamBounds = OwnedSlice<TyParamBound>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct TyParam {
pub ident: Ident,
pub id: NodeId,
/// Represents lifetimes and type parameters attached to a declaration
/// of a function, enum, trait, etc.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Generics {
pub lifetimes: Vec<LifetimeDef>,
pub ty_params: OwnedSlice<TyParam>,
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct WhereClause {
pub id: NodeId,
pub predicates: Vec<WherePredicate>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum WherePredicate {
BoundPredicate(WhereBoundPredicate),
RegionPredicate(WhereRegionPredicate),
EqPredicate(WhereEqPredicate)
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct WhereBoundPredicate {
pub span: Span,
pub bounded_ty: P<Ty>,
pub bounds: OwnedSlice<TyParamBound>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct WhereRegionPredicate {
pub span: Span,
pub lifetime: Lifetime,
pub bounds: Vec<Lifetime>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct WhereEqPredicate {
pub id: NodeId,
pub span: Span,
/// used to drive conditional compilation
pub type CrateConfig = Vec<P<MetaItem>> ;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Crate {
pub module: Mod,
pub attrs: Vec<Attribute>,
pub type MetaItem = Spanned<MetaItem_>;
-#[deriving(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum MetaItem_ {
MetaWord(InternedString),
MetaList(InternedString, Vec<P<MetaItem>>),
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Block {
pub view_items: Vec<ViewItem>,
pub stmts: Vec<P<Stmt>>,
pub span: Span,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Pat {
pub id: NodeId,
pub node: Pat_,
pub span: Span,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct FieldPat {
pub ident: Ident,
pub pat: P<Pat>,
pub is_shorthand: bool,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum BindingMode {
BindByRef(Mutability),
BindByValue(Mutability),
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum PatWildKind {
/// Represents the wildcard pattern `_`
PatWildSingle,
PatWildMulti,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Pat_ {
/// Represents a wildcard pattern (either `_` or `..`)
PatWild(PatWildKind),
PatMac(Mac),
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum Mutability {
MutMutable,
MutImmutable,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum BinOp {
BiAdd,
BiSub,
BiGt,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum UnOp {
UnUniq,
UnDeref,
pub type Stmt = Spanned<Stmt_>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Stmt_ {
/// Could be an item or a local (let) binding:
StmtDecl(P<Decl>, NodeId),
StmtMac(P<Mac>, MacStmtStyle),
}
-#[deriving(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum MacStmtStyle {
/// The macro statement had a trailing semicolon, e.g. `foo! { ... };`
/// `foo!(...);`, `foo![...];`
/// Where a local declaration came from: either a true `let ... =
/// ...;`, or one desugared from the pattern of a for loop.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum LocalSource {
LocalLet,
LocalFor,
// FIXME (pending discussion of #1697, #2178...): local should really be
// a refinement on pat.
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Local {
pub pat: P<Pat>,
pub ty: Option<P<Ty>>,
pub type Decl = Spanned<Decl_>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Decl_ {
/// A local (let) binding:
DeclLocal(P<Local>),
}
/// represents one arm of a 'match'
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Arm {
pub attrs: Vec<Attribute>,
pub pats: Vec<P<Pat>>,
pub body: P<Expr>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Field {
pub ident: SpannedIdent,
pub expr: P<Expr>,
pub type SpannedIdent = Spanned<Ident>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum BlockCheckMode {
DefaultBlock,
UnsafeBlock(UnsafeSource),
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum UnsafeSource {
CompilerGenerated,
UserProvided,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Expr {
pub id: NodeId,
pub node: Expr_,
pub span: Span,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Expr_ {
/// First expr is the place; second expr is the value.
ExprBox(Option<P<Expr>>, P<Expr>),
/// <Vec<T> as SomeTrait>::SomeAssociatedItem
/// ^~~~~ ^~~~~~~~~ ^~~~~~~~~~~~~~~~~~
/// self_type trait_name item_name
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct QPath {
pub self_type: P<Ty>,
pub trait_ref: P<TraitRef>,
pub item_name: Ident, // FIXME(#20301) -- should use Name
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum MatchSource {
Normal,
IfLetDesugar { contains_else_clause: bool },
WhileLetDesugar,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum CaptureClause {
CaptureByValue,
CaptureByRef,
}
/// A delimited sequence of token trees
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Delimited {
/// The type of delimiter
pub delim: token::DelimToken,
}
/// A sequence of token treesee
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct SequenceRepetition {
/// The sequence of token trees
pub tts: Vec<TokenTree>,
/// A Kleene-style [repetition operator](http://en.wikipedia.org/wiki/Kleene_star)
/// for token sequences.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum KleeneOp {
ZeroOrMore,
OneOrMore,
///
/// The RHS of an MBE macro is the only place `SubstNt`s are substituted.
/// Nothing special happens to misnamed or misplaced `SubstNt`s.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
#[doc="For macro invocations; parsing is delegated to the macro"]
pub enum TokenTree {
/// A single token
/// is being invoked, and the vector of token-trees contains the source
/// of the macro invocation.
/// There's only one flavor, now, so this could presumably be simplified.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Mac_ {
// NB: the additional ident for a macro_rules-style macro is actually
// stored in the enclosing item. Oog.
MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum StrStyle {
CookedStr,
RawStr(uint)
pub type Lit = Spanned<Lit_>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum Sign {
Minus,
Plus
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum LitIntType {
SignedIntLit(IntTy, Sign),
UnsignedIntLit(UintTy),
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Lit_ {
LitStr(InternedString, StrStyle),
LitBinary(Rc<Vec<u8> >),
// NB: If you change this, you'll probably want to change the corresponding
// type structure in middle/ty.rs as well.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct MutTy {
pub ty: P<Ty>,
pub mutbl: Mutability,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct TypeField {
pub ident: Ident,
pub mt: MutTy,
/// Represents a required method in a trait declaration,
/// one without a default implementation
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct TypeMethod {
pub ident: Ident,
pub attrs: Vec<Attribute>,
/// a default implementation A trait method is either required (meaning it
/// doesn't have an implementation, just a signature) or provided (meaning it
/// has a default implementation).
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum TraitItem {
RequiredMethod(TypeMethod),
ProvidedMethod(P<Method>),
TypeTraitItem(P<AssociatedType>),
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum ImplItem {
MethodImplItem(P<Method>),
TypeImplItem(P<Typedef>),
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct AssociatedType {
pub attrs: Vec<Attribute>,
pub ty_param: TyParam,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Typedef {
pub id: NodeId,
pub span: Span,
pub typ: P<Ty>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub enum IntTy {
TyI,
TyI8,
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub enum UintTy {
TyU,
TyU8,
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub enum FloatTy {
TyF32,
TyF64,
}
// Bind a type to an associated type: `A=Foo`.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct TypeBinding {
pub id: NodeId,
pub ident: Ident,
// NB PartialEq method appears below.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Ty {
pub id: NodeId,
pub node: Ty_,
}
/// Not represented directly in the AST, referred to by name through a ty_path.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum PrimTy {
TyInt(IntTy),
TyUint(UintTy),
TyChar
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub enum Onceness {
Once,
Many
}
/// Represents the type of a closure
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct ClosureTy {
pub lifetimes: Vec<LifetimeDef>,
pub unsafety: Unsafety,
pub bounds: TyParamBounds,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct BareFnTy {
pub unsafety: Unsafety,
pub abi: Abi,
pub decl: P<FnDecl>
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
/// The different kinds of types recognized by the compiler
pub enum Ty_ {
TyVec(P<Ty>),
TyInfer,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum AsmDialect {
AsmAtt,
AsmIntel
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct InlineAsm {
pub asm: InternedString,
pub asm_str_style: StrStyle,
}
/// represents an argument in a function header
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Arg {
pub ty: P<Ty>,
pub pat: P<Pat>,
}
/// represents the header (not the body) of a function declaration
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct FnDecl {
pub inputs: Vec<Arg>,
pub output: FunctionRetTy,
pub variadic: bool
}
-#[deriving(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
+#[derive(Copy, Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash)]
pub enum Unsafety {
Unsafe,
Normal,
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum FunctionRetTy {
/// Functions with return type ! that always
/// raise an error or exit (i.e. never return to the caller)
}
/// Represents the kind of 'self' associated with a method
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum ExplicitSelf_ {
/// No self
SelfStatic,
pub type ExplicitSelf = Spanned<ExplicitSelf_>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Method {
pub attrs: Vec<Attribute>,
pub id: NodeId,
pub node: Method_,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Method_ {
/// Represents a method declaration
MethDecl(Ident,
MethMac(Mac),
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Mod {
/// A span from the first token past `{` to the last token until `}`.
/// For `mod foo;`, the inner span ranges from the first token
pub items: Vec<P<Item>>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct ForeignMod {
pub abi: Abi,
pub view_items: Vec<ViewItem>,
pub items: Vec<P<ForeignItem>>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct VariantArg {
pub ty: P<Ty>,
pub id: NodeId,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum VariantKind {
TupleVariantKind(Vec<VariantArg>),
StructVariantKind(P<StructDef>),
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct EnumDef {
pub variants: Vec<P<Variant>>,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Variant_ {
pub name: Ident,
pub attrs: Vec<Attribute>,
pub type Variant = Spanned<Variant_>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum PathListItem_ {
PathListIdent { name: Ident, id: NodeId },
PathListMod { id: NodeId }
pub type ViewPath = Spanned<ViewPath_>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum ViewPath_ {
/// `foo::bar::baz as quux`
ViewPathList(Path, Vec<PathListItem> , NodeId)
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct ViewItem {
pub node: ViewItem_,
pub attrs: Vec<Attribute>,
pub span: Span,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum ViewItem_ {
/// Ident: name used to refer to this crate in the code
/// optional (InternedString,StrStyle): if present, this is a location
/// Distinguishes between Attributes that decorate items and Attributes that
/// are contained as statements within items. These two cases need to be
/// distinguished for pretty-printing.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum AttrStyle {
AttrOuter,
AttrInner,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub struct AttrId(pub uint);
/// Doc-comments are promoted to attributes that have is_sugared_doc = true
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Attribute_ {
pub id: AttrId,
pub style: AttrStyle,
/// that the ref_id is for. The impl_id maps to the "self type" of this impl.
/// If this impl is an ItemImpl, the impl_id is redundant (it could be the
/// same as the impl's node id).
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct TraitRef {
pub path: Path,
pub ref_id: NodeId,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct PolyTraitRef {
/// The `'a` in `<'a> Foo<&'a T>`
pub bound_lifetimes: Vec<LifetimeDef>,
pub trait_ref: TraitRef,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum Visibility {
Public,
Inherited,
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct StructField_ {
pub kind: StructFieldKind,
pub id: NodeId,
pub type StructField = Spanned<StructField_>;
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum StructFieldKind {
NamedField(Ident, Visibility),
/// Element of a tuple-like struct
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct StructDef {
/// Fields, not including ctor
pub fields: Vec<StructField>,
FIXME (#3300): Should allow items to be anonymous. Right now
we just use dummy names for anon items.
*/
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct Item {
pub ident: Ident,
pub attrs: Vec<Attribute>,
pub span: Span,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum Item_ {
ItemStatic(P<Ty>, Mutability, P<Expr>),
ItemConst(P<Ty>, P<Expr>),
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub struct ForeignItem {
pub ident: Ident,
pub attrs: Vec<Attribute>,
pub vis: Visibility,
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum ForeignItem_ {
ForeignItemFn(P<FnDecl>, Generics),
ForeignItemStatic(P<Ty>, /* is_mutbl */ bool),
}
}
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum UnboxedClosureKind {
FnUnboxedClosureKind,
FnMutUnboxedClosureKind,
/// The data we save and restore about an inlined item or method. This is not
/// part of the AST that we parse from a file, but it becomes part of the tree
/// that we trans.
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show)]
pub enum InlinedItem {
IIItem(P<Item>),
IITraitItem(DefId /* impl id */, TraitItem),
/// - The default implementation for a trait method.
///
/// To construct one, use the `Code::from_node` function.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct FnLikeNode<'a> { node: ast_map::Node<'a> }
/// MaybeFnLike wraps a method that indicates if an object
/// Carries either an FnLikeNode or a Block, as these are the two
/// constructs that correspond to "code" (as in, something from which
/// we can construct a control-flow graph).
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum Code<'a> {
FnLikeCode(FnLikeNode<'a>),
BlockCode(&'a Block),
pub mod blocks;
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum PathElem {
PathMod(Name),
PathName(Name)
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
struct LinkedPathNode<'a> {
node: PathElem,
next: LinkedPath<'a>,
}
// HACK(eddyb) move this into libstd (value wrapper for slice::Iter).
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Values<'a, T:'a>(pub slice::Iter<'a, T>);
impl<'a, T: Copy> Iterator for Values<'a, T> {
}).to_string()
}
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
pub enum Node<'ast> {
NodeItem(&'ast Item),
NodeForeignItem(&'ast ForeignItem),
/// Represents an entry and its parent Node ID
/// The odd layout is to bring down the total size.
-#[deriving(Copy, Show)]
+#[derive(Copy, Show)]
enum MapEntry<'ast> {
/// Placeholder for holes in the map.
NotPresent,
}
}
-#[deriving(Show)]
+#[derive(Show)]
struct InlinedParent {
path: Vec<PathElem>,
ii: InlinedItem
// ______________________________________________________________________
// Enumerating the IDs which appear in an AST
-#[deriving(RustcEncodable, RustcDecodable, Show, Copy)]
+#[derive(RustcEncodable, RustcDecodable, Show, Copy)]
pub struct IdRange {
pub min: NodeId,
pub max: NodeId,
first_attr_value_str_by_name(attrs, "crate_name")
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum InlineAttr {
InlineNone,
InlineHint,
}
/// Represents the #[deprecated="foo"] and friends attributes.
-#[deriving(RustcEncodable,RustcDecodable,Clone,Show)]
+#[derive(RustcEncodable,RustcDecodable,Clone,Show)]
pub struct Stability {
pub level: StabilityLevel,
pub text: Option<InternedString>
}
/// The available stability levels.
-#[deriving(RustcEncodable,RustcDecodable,PartialEq,PartialOrd,Clone,Show,Copy)]
+#[derive(RustcEncodable,RustcDecodable,PartialEq,PartialOrd,Clone,Show,Copy)]
pub enum StabilityLevel {
Deprecated,
Experimental,
}
}
-#[deriving(PartialEq, Show, RustcEncodable, RustcDecodable, Copy)]
+#[derive(PartialEq, Show, RustcEncodable, RustcDecodable, Copy)]
pub enum ReprAttr {
ReprAny,
ReprInt(Span, IntType),
}
}
-#[deriving(Eq, Hash, PartialEq, Show, RustcEncodable, RustcDecodable, Copy)]
+#[derive(Eq, Hash, PartialEq, Show, RustcEncodable, RustcDecodable, Copy)]
pub enum IntType {
SignedInt(ast::IntTy),
UnsignedInt(ast::UintTy)
/// A byte offset. Keep this small (currently 32-bits), as AST contains
/// a lot of them.
-#[deriving(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Show)]
pub struct BytePos(pub u32);
/// A character offset. Because of multibyte utf8 characters, a byte offset
/// is not equivalent to a character offset. The CodeMap will convert BytePos
/// values to CharPos values as necessary.
-#[deriving(Copy, PartialEq, Hash, PartialOrd, Show)]
+#[derive(Copy, PartialEq, Hash, PartialOrd, Show)]
pub struct CharPos(pub uint);
// FIXME: Lots of boilerplate in these impls, but so far my attempts to fix
/// are *absolute* positions from the beginning of the codemap, not positions
/// relative to FileMaps. Methods on the CodeMap can be used to relate spans back
/// to the original source.
-#[deriving(Clone, Copy, Show, Hash)]
+#[derive(Clone, Copy, Show, Hash)]
pub struct Span {
pub lo: BytePos,
pub hi: BytePos,
pub const DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: NO_EXPANSION };
-#[deriving(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub struct Spanned<T> {
pub node: T,
pub span: Span,
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
/// The syntax with which a macro was invoked.
-#[deriving(Clone, Copy, Hash, Show)]
+#[derive(Clone, Copy, Hash, Show)]
pub enum MacroFormat {
- /// e.g. #[deriving(...)] <item>
+ /// e.g. #[derive(...)] <item>
MacroAttribute,
/// e.g. `format!()`
MacroBang
}
-#[deriving(Clone, Hash, Show)]
+#[derive(Clone, Hash, Show)]
pub struct NameAndSpan {
/// The name of the macro that was invoked to create the thing
/// with this Span.
}
/// Extra information for tracking macro expansion of spans
-#[deriving(Hash, Show)]
+#[derive(Hash, Show)]
pub struct ExpnInfo {
/// The location of the actual macro invocation, e.g. `let x =
/// foo!();`
pub callee: NameAndSpan
}
-#[deriving(PartialEq, Eq, Clone, Show, Hash, RustcEncodable, RustcDecodable, Copy)]
+#[derive(PartialEq, Eq, Clone, Show, Hash, RustcEncodable, RustcDecodable, Copy)]
pub struct ExpnId(u32);
pub const NO_EXPANSION: ExpnId = ExpnId(-1);
}
/// Identifies an offset of a multi-byte character in a FileMap
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct MultiByteChar {
/// The absolute offset of the character in the CodeMap
pub pos: BytePos,
/// maximum number of lines we will print for each error; arbitrary.
static MAX_LINES: uint = 6u;
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub enum RenderSpan {
/// A FullSpan renders with both with an initial line for the
/// message, prefixed by file:linenum, followed by a summary of
}
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub enum ColorConfig {
Auto,
Always,
/// This structure is used to signify that a task has panicked with a fatal error
/// from the diagnostics. You can use this with the `Any` trait to figure out
/// how a rustc task died (if so desired).
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct FatalError;
/// Signifies that the compiler died with an explicit call to `.bug`
/// or `.span_bug` rather than a failed assertion, etc.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct ExplicitBug;
/// A span-handler is like a handler but also
}
}
-#[deriving(Copy, PartialEq, Clone)]
+#[derive(Copy, PartialEq, Clone)]
pub enum Level {
Bug,
Fatal,
/// Fill-in macro expansion result, to allow compilation to continue
/// after hitting errors.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct DummyResult {
expr_only: bool,
span: Span
/// A syntax extension that is attached to an item and creates new items
/// based upon it.
///
- /// `#[deriving(...)]` is an `ItemDecorator`.
+ /// `#[derive(...)]` is an `ItemDecorator`.
Decorator(Box<ItemDecorator + 'static>),
/// A syntax extension that is attached to an item and modifies it
trait_def.expand(cx, mitem, item, push)
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum OrderingOp {
PartialCmpOp, LtOp, LeOp, GtOp, GeOp,
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-//! The compiler code necessary for `#[deriving(Decodable)]`. See encodable.rs for more.
+//! The compiler code necessary for `#[derive(Decodable)]`. See encodable.rs for more.
use ast;
use ast::{MetaItem, Item, Expr, MutMutable};
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-//! The compiler code necessary to implement the `#[deriving(Encodable)]`
+//! The compiler code necessary to implement the `#[derive(Encodable)]`
//! (and `Decodable`, in decodable.rs) extension. The idea here is that
-//! type-defining items may be tagged with `#[deriving(Encodable, Decodable)]`.
+//! type-defining items may be tagged with `#[derive(Encodable, Decodable)]`.
//!
//! For example, a type like:
//!
//! ```ignore
-//! #[deriving(Encodable, Decodable)]
+//! #[derive(Encodable, Decodable)]
//! struct Node { id: uint }
//! ```
//!
//! references other non-built-in types. A type definition like:
//!
//! ```ignore
-//! #[deriving(Encodable, Decodable)]
+//! #[derive(Encodable, Decodable)]
//! struct Spanned<T> { node: T, span: Span }
//! ```
//!
}
}
-#[deriving(PartialEq)] // dogfooding!
+#[derive(PartialEq)] // dogfooding!
enum StructType {
Unknown, Record, Tuple
}
use ptr::P;
/// The types of pointers
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum PtrTy<'a> {
/// &'lifetime mut
Borrowed(Option<&'a str>, ast::Mutability),
/// A path, e.g. `::std::option::Option::<int>` (global). Has support
/// for type parameters and a lifetime.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Path<'a> {
pub path: Vec<&'a str> ,
pub lifetime: Option<&'a str>,
}
/// A type. Supports pointers, Self, and literals
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum Ty<'a> {
Self,
/// &/Box/ Ty
}
/// Lifetimes and bounds on type parameters
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct LifetimeBounds<'a> {
pub lifetimes: Vec<(&'a str, Vec<&'a str>)>,
pub bounds: Vec<(&'a str, Vec<Path<'a>>)>,
}
if stmts.len() == 0 {
- cx.span_bug(trait_span, "#[deriving(Hash)] needs at least one field");
+ cx.span_bug(trait_span, "#[derive(Hash)] needs at least one field");
}
cx.expr_block(cx.block(trait_span, stmts, None))
Struct(_) => substr.type_ident,
EnumMatching(_, v, _) => v.node.name,
EnumNonMatchingCollapsed(..) | StaticStruct(..) | StaticEnum(..) => {
- cx.span_bug(span, "nonsensical .fields in `#[deriving(Show)]`")
+ cx.span_bug(span, "nonsensical .fields in `#[derive(Show)]`")
}
};
/// A visitor that extracts the PatIdent (binding) paths
/// from a given thingy and puts them in a mutable
/// array
-#[deriving(Clone)]
+#[derive(Clone)]
struct PatIdentFinder {
ident_accumulator: Vec<ast::Ident>
}
// a visitor that extracts the paths
// from a given thingy and puts them in a mutable
// array (passed in to the traversal)
- #[deriving(Clone)]
+ #[derive(Clone)]
struct PathExprFinderContext {
path_accumulator: Vec<ast::Path> ,
}
use std::collections::HashMap;
use std::iter::repeat;
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
enum ArgumentType {
Known(String),
Unsigned
rename_memo: RefCell<HashMap<(SyntaxContext,Ident,Name),SyntaxContext>>,
}
-#[deriving(PartialEq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
+#[derive(PartialEq, RustcEncodable, RustcDecodable, Hash, Show, Copy)]
pub enum SyntaxContext_ {
EmptyCtxt,
Mark (Mrk,SyntaxContext),
// because of the SCTable, I now need a tidy way of
// creating syntax objects. Sigh.
- #[deriving(Clone, PartialEq, Show)]
+ #[derive(Clone, PartialEq, Show)]
enum TestSC {
M(Mrk),
R(Ident,Name)
// To avoid costly uniqueness checks, we require that `MatchSeq` always has
// a nonempty body.
-#[deriving(Clone)]
+#[derive(Clone)]
enum TokenTreeOrTokenTreeVec {
Tt(ast::TokenTree),
TtSeq(Rc<Vec<ast::TokenTree>>),
}
/// an unzipping of `TokenTree`s
-#[deriving(Clone)]
+#[derive(Clone)]
struct MatcherTtFrame {
elts: TokenTreeOrTokenTreeVec,
idx: uint,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct MatcherPos {
stack: Vec<MatcherTtFrame>,
top_elts: TokenTreeOrTokenTreeVec,
use std::collections::HashMap;
///an unzipping of `TokenTree`s
-#[deriving(Clone)]
+#[derive(Clone)]
struct TtFrame {
forest: TokenTree,
idx: uint,
sep: Option<Token>,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct TtReader<'a> {
pub sp_diag: &'a SpanHandler,
/// the unzipped tree:
matched_opt.map(|s| lookup_cur_matched_by_matched(r, s))
}
-#[deriving(Clone)]
+#[derive(Clone)]
enum LockstepIterSize {
LisUnconstrained,
LisConstraint(uint, Ident),
}
/// A set of features to be used by later passes.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Features {
pub default_type_params: bool,
pub unboxed_closures: bool,
/// A non-growable owned slice. This is a separate type to allow the
/// representation to change.
-#[deriving(Hash, PartialEq, Eq, PartialOrd, Ord)]
+#[derive(Hash, PartialEq, Eq, PartialOrd, Ord)]
pub struct OwnedSlice<T> {
data: Box<[T]>
}
use std::string::String;
use std::uint;
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum CommentStyle {
/// No code on either side of each line of the comment
Isolated,
BlankLine,
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Comment {
pub style: CommentStyle,
pub lines: Vec<String>,
debug!("<<< consume comment");
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Literal {
pub lit: String,
pub pos: BytePos,
}
}
-#[deriving(Clone, PartialEq, Eq, Show)]
+#[derive(Clone, PartialEq, Eq, Show)]
pub struct TokenAndSpan {
pub tok: token::Token,
pub sp: Span,
use ptr::P;
/// The specific types of unsupported syntax
-#[deriving(Copy, PartialEq, Eq, Hash)]
+#[derive(Copy, PartialEq, Eq, Hash)]
pub enum ObsoleteSyntax {
ObsoleteOwnedType,
ObsoleteOwnedExpr,
/// How to parse a path. There are four different kinds of paths, all of which
/// are parsed somewhat differently.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum PathParsingMode {
/// A path with no type parameters; e.g. `foo::bar::Baz`
NoTypesAllowed,
}
/// How to parse a bound, whether to allow bound modifiers such as `?`.
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum BoundParsingMode {
Bare,
Modified,
pub expected_tokens: Vec<TokenType>,
}
-#[deriving(PartialEq, Eq, Clone)]
+#[derive(PartialEq, Eq, Clone)]
pub enum TokenType {
Token(token::Token),
Operator,
use std::rc::Rc;
#[allow(non_camel_case_types)]
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
pub enum BinOpToken {
Plus,
Minus,
}
/// A delimeter token
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
pub enum DelimToken {
/// A round parenthesis: `(` or `)`
Paren,
Brace,
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
pub enum IdentStyle {
/// `::` follows the identifier with no whitespace in-between.
ModName,
Plain,
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show, Copy)]
pub enum Lit {
Byte(ast::Name),
Char(ast::Name),
}
#[allow(non_camel_case_types)]
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash, Show)]
pub enum Token {
/* Expression-operator symbols. */
Eq,
}
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Eq, Hash)]
/// For interpolation during macro expansion.
pub enum Nonterminal {
NtItem(P<ast::Item>),
pub use self::Keyword::*;
use ast;
- #[deriving(Copy)]
+ #[derive(Copy)]
pub enum Keyword {
$( $sk_variant, )*
$( $rk_variant, )*
/// destroyed. In particular, they must not access string contents. This can
/// be fixed in the future by just leaking all strings until task death
/// somehow.
-#[deriving(Clone, PartialEq, Hash, PartialOrd, Eq, Ord)]
+#[derive(Clone, PartialEq, Hash, PartialOrd, Eq, Ord)]
pub struct InternedString {
string: RcStr,
}
use std::string;
use std::iter::repeat;
-#[deriving(Clone, Copy, PartialEq)]
+#[derive(Clone, Copy, PartialEq)]
pub enum Breaks {
Consistent,
Inconsistent,
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct BreakToken {
offset: int,
blank_space: int
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
pub struct BeginToken {
offset: int,
breaks: Breaks
}
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum Token {
String(string::String, int),
Break(BreakToken),
s
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum PrintStackBreak {
Fits,
Broken(Breaks),
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct PrintStackElem {
offset: int,
pbreak: PrintStackBreak
fn post(&self, _state: &mut State, _node: AnnNode) -> IoResult<()> { Ok(()) }
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct NoAnn;
impl PpAnn for NoAnn {}
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct CurrentCommentAndLiteral {
cur_cmnt: uint,
cur_lit: uint,
})
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
enum HasTestSignature {
Yes,
No,
}
}
-#[deriving(Clone, PartialEq, Hash, PartialOrd)]
+#[derive(Clone, PartialEq, Hash, PartialOrd)]
pub struct RcStr {
string: Rc<String>,
}
use ptr::P;
use owned_slice::OwnedSlice;
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum FnKind<'a> {
/// fn foo() or extern "Abi" fn foo()
FkItemFn(Ident, &'a Generics, Unsafety, Abi),
/// Most attributes can only be turned on and must be turned off with term.reset().
/// The ones that can be turned off explicitly take a boolean value.
/// Color is also represented as an attribute for convenience.
- #[deriving(Copy)]
+ #[derive(Copy)]
pub enum Attr {
/// Bold (or possibly bright) mode
Bold,
/// A parsed terminfo database entry.
-#[deriving(Show)]
+#[derive(Show)]
pub struct TermInfo {
/// Names for the terminal
pub names: Vec<String> ,
use std::mem::replace;
use std::iter::repeat;
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum States {
Nothing,
Percent,
SeekIfEndPercent(int)
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
enum FormatState {
FormatStateFlags,
FormatStateWidth,
/// Types of parameters a capability can use
#[allow(missing_docs)]
-#[deriving(Clone)]
+#[derive(Clone)]
pub enum Param {
Words(String),
Number(int)
Ok(output)
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
struct Flags {
width: uint,
precision: uint,
}
}
-#[deriving(Copy)]
+#[derive(Copy)]
enum FormatOp {
FormatDigit,
FormatOctal,
// colons. This way if some test runner wants to arrange the tests
// hierarchically it may.
-#[deriving(Clone, PartialEq, Eq, Hash)]
+#[derive(Clone, PartialEq, Eq, Hash)]
pub enum TestName {
StaticTestName(&'static str),
DynTestName(String)
}
}
-#[deriving(Clone, Copy)]
+#[derive(Clone, Copy)]
enum NamePadding {
PadNone,
PadOnLeft,
/// This is feed into functions marked with `#[bench]` to allow for
/// set-up & tear-down before running a piece of code repeatedly via a
/// call to `iter`.
-#[deriving(Copy)]
+#[derive(Copy)]
pub struct Bencher {
iterations: u64,
dur: Duration,
pub bytes: u64,
}
-#[deriving(Copy, Clone, Show, PartialEq, Eq, Hash)]
+#[derive(Copy, Clone, Show, PartialEq, Eq, Hash)]
pub enum ShouldFail {
No,
Yes(Option<&'static str>)
// The definition of a single test. A test runner will run a list of
// these.
-#[deriving(Clone, Show, PartialEq, Eq, Hash)]
+#[derive(Clone, Show, PartialEq, Eq, Hash)]
pub struct TestDesc {
pub name: TestName,
pub ignore: bool,
pub should_fail: ShouldFail,
}
-#[deriving(Show)]
+#[derive(Show)]
pub struct TestDescAndFn {
pub desc: TestDesc,
pub testfn: TestFn,
}
-#[deriving(Clone, RustcEncodable, RustcDecodable, PartialEq, Show, Copy)]
+#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show, Copy)]
pub struct Metric {
value: f64,
noise: f64
}
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
pub struct MetricMap(BTreeMap<String,Metric>);
impl Clone for MetricMap {
}
/// Analysis of a single change in metric
-#[deriving(Copy, PartialEq, Show)]
+#[derive(Copy, PartialEq, Show)]
pub enum MetricChange {
LikelyNoise,
MetricAdded,
test_main(args, owned_tests)
}
-#[deriving(Copy)]
+#[derive(Copy)]
pub enum ColorConfig {
AutoColor,
AlwaysColor,
}
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
pub struct BenchSamples {
ns_iter_summ: stats::Summary<f64>,
mb_s: uint,
}
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
pub enum TestResult {
TrOk,
TrFailed,
}
}
-#[deriving(Clone)]
+#[derive(Clone)]
enum TestEvent {
TeFiltered(Vec<TestDesc> ),
TeWait(TestDesc, NamePadding),
}
/// Extracted collection of all the summary statistics of a sample set.
-#[deriving(Clone, PartialEq)]
+#[derive(Clone, PartialEq)]
#[allow(missing_docs)]
pub struct Summary<T> {
pub sum: T,
}
/// A record specifying a time value in seconds and nanoseconds.
-#[deriving(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable,
+#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, RustcEncodable,
RustcDecodable, Show, Copy)]
pub struct Timespec {
pub sec: i64,
/// also called a broken-down time value.
// FIXME: use c_int instead of i32?
#[repr(C)]
-#[deriving(Clone, Copy, PartialEq, Eq, Show)]
+#[derive(Clone, Copy, PartialEq, Eq, Show)]
pub struct Tm {
/// Seconds after the minute - [0, 60]
pub tm_sec: i32,
}
}
-#[deriving(Copy, PartialEq)]
+#[derive(Copy, PartialEq)]
pub enum ParseError {
InvalidSecond,
InvalidMinute,
pub use u_str::{utf16_items, Utf16Encoder};
}
-// this lets us use #[deriving(..)]
+// this lets us use #[derive(..)]
mod std {
pub use core::clone;
pub use core::cmp;
use core::result::Result::{Ok, Err};
#[allow(non_camel_case_types)]
- #[deriving(Clone)]
+ #[derive(Clone)]
pub enum GraphemeCat {
GC_LV,
GC_LVT,
}
/// External iterator for grapheme clusters and byte offsets.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct GraphemeIndices<'a> {
start_offset: uint,
iter: Graphemes<'a>,
/// External iterator for a string's
/// [grapheme clusters](http://www.unicode.org/reports/tr29/#Grapheme_Cluster_Boundaries).
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Graphemes<'a> {
string: &'a str,
extended: bool,
}
// state machine for cluster boundary rules
-#[deriving(PartialEq,Eq)]
+#[derive(PartialEq,Eq)]
enum GraphemeState {
Start,
FindExtend,
/// An iterator that decodes UTF-16 encoded codepoints from a vector
/// of `u16`s.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Utf16Items<'a> {
iter: slice::Iter<'a, u16>
}
/// The possibilities for values decoded from a `u16` stream.
-#[deriving(PartialEq, Eq, Clone, Show)]
+#[derive(PartialEq, Eq, Clone, Show)]
pub enum Utf16Item {
/// A valid codepoint.
ScalarValue(char),
}
/// Iterator adaptor for encoding `char`s to UTF-16.
-#[deriving(Clone)]
+#[derive(Clone)]
pub struct Utf16Encoder<I> {
chars: I,
extra: u16
fn boo(&self) -> <Self as Foo>::A;
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
struct Bar;
impl Foo for int {
fn boo(&self) -> <Self as Foo>::A;
}
-#[deriving(PartialEq)]
+#[derive(PartialEq)]
struct Bar;
impl Foo for int {