1
Fork 0

libsyntax: use #[deriving(Copy)]

This commit is contained in:
Jorge Aparicio 2014-12-14 23:32:24 -05:00
parent a77e8a63d5
commit 86f8c127dd
19 changed files with 77 additions and 216 deletions

View file

@ -15,7 +15,7 @@ pub use self::AbiArchitecture::*;
use std::fmt; use std::fmt;
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Os { pub enum Os {
OsWindows, OsWindows,
OsMacos, OsMacos,
@ -26,9 +26,7 @@ pub enum Os {
OsDragonfly, OsDragonfly,
} }
impl Copy for Os {} #[deriving(Copy, PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
#[deriving(PartialEq, Eq, Hash, Encodable, Decodable, Clone)]
pub enum Abi { pub enum Abi {
// NB: This ordering MUST match the AbiDatas array below. // NB: This ordering MUST match the AbiDatas array below.
// (This is ensured by the test indices_are_correct().) // (This is ensured by the test indices_are_correct().)
@ -48,10 +46,8 @@ pub enum Abi {
RustCall, RustCall,
} }
impl Copy for Abi {}
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum Architecture { pub enum Architecture {
X86, X86,
X86_64, X86_64,
@ -60,8 +56,7 @@ pub enum Architecture {
Mipsel Mipsel
} }
impl Copy for Architecture {} #[deriving(Copy)]
pub struct AbiData { pub struct AbiData {
abi: Abi, abi: Abi,
@ -69,8 +64,7 @@ pub struct AbiData {
name: &'static str, name: &'static str,
} }
impl Copy for AbiData {} #[deriving(Copy)]
pub enum AbiArchitecture { pub enum AbiArchitecture {
/// Not a real ABI (e.g., intrinsic) /// Not a real ABI (e.g., intrinsic)
RustArch, RustArch,
@ -80,9 +74,6 @@ pub enum AbiArchitecture {
Archs(u32) Archs(u32)
} }
#[allow(non_upper_case_globals)]
impl Copy for AbiArchitecture {}
#[allow(non_upper_case_globals)] #[allow(non_upper_case_globals)]
static AbiDatas: &'static [AbiData] = &[ static AbiDatas: &'static [AbiData] = &[
// Platform-specific ABIs // Platform-specific ABIs

View file

@ -80,14 +80,12 @@ use serialize::{Encodable, Decodable, Encoder, Decoder};
/// table) and a SyntaxContext to track renaming and /// table) and a SyntaxContext to track renaming and
/// macro expansion per Flatt et al., "Macros /// macro expansion per Flatt et al., "Macros
/// That Work Together" /// That Work Together"
#[deriving(Clone, Hash, PartialOrd, Eq, Ord)] #[deriving(Clone, Copy, Hash, PartialOrd, Eq, Ord)]
pub struct Ident { pub struct Ident {
pub name: Name, pub name: Name,
pub ctxt: SyntaxContext pub ctxt: SyntaxContext
} }
impl Copy for Ident {}
impl Ident { impl Ident {
/// Construct an identifier with the given name and an empty context: /// Construct an identifier with the given name and an empty context:
pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}} pub fn new(name: Name) -> Ident { Ident {name: name, ctxt: EMPTY_CTXT}}
@ -160,11 +158,9 @@ pub const ILLEGAL_CTXT : SyntaxContext = 1;
/// A name is a part of an identifier, representing a string or gensym. It's /// A name is a part of an identifier, representing a string or gensym. It's
/// the result of interning. /// the result of interning.
#[deriving(Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone)] #[deriving(Copy, Eq, Ord, PartialEq, PartialOrd, Hash, Encodable, Decodable, Clone)]
pub struct Name(pub u32); pub struct Name(pub u32);
impl Copy for Name {}
impl Name { impl Name {
pub fn as_str<'a>(&'a self) -> &'a str { pub fn as_str<'a>(&'a self) -> &'a str {
unsafe { unsafe {
@ -201,15 +197,13 @@ impl<D:Decoder<E>, E> Decodable<D, E> for Ident {
/// Function name (not all functions have names) /// Function name (not all functions have names)
pub type FnIdent = Option<Ident>; pub type FnIdent = Option<Ident>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct Lifetime { pub struct Lifetime {
pub id: NodeId, pub id: NodeId,
pub span: Span, pub span: Span,
pub name: Name pub name: Name
} }
impl Copy for Lifetime {}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct LifetimeDef { pub struct LifetimeDef {
pub lifetime: Lifetime, pub lifetime: Lifetime,
@ -353,14 +347,12 @@ pub type CrateNum = u32;
pub type NodeId = u32; pub type NodeId = u32;
#[deriving(Clone, Eq, Ord, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, Eq, Ord, PartialOrd, PartialEq, Encodable, Decodable, Hash, Show)]
pub struct DefId { pub struct DefId {
pub krate: CrateNum, pub krate: CrateNum,
pub node: NodeId, pub node: NodeId,
} }
impl Copy for DefId {}
/// Item definitions in the currently-compiled crate would have the CrateNum /// Item definitions in the currently-compiled crate would have the CrateNum
/// LOCAL_CRATE in their DefId. /// LOCAL_CRATE in their DefId.
pub const LOCAL_CRATE: CrateNum = 0; pub const LOCAL_CRATE: CrateNum = 0;
@ -513,15 +505,13 @@ pub struct FieldPat {
pub is_shorthand: bool, pub is_shorthand: bool,
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum BindingMode { pub enum BindingMode {
BindByRef(Mutability), BindByRef(Mutability),
BindByValue(Mutability), BindByValue(Mutability),
} }
impl Copy for BindingMode {} #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum PatWildKind { pub enum PatWildKind {
/// Represents the wildcard pattern `_` /// Represents the wildcard pattern `_`
PatWildSingle, PatWildSingle,
@ -530,8 +520,6 @@ pub enum PatWildKind {
PatWildMulti, PatWildMulti,
} }
impl Copy for PatWildKind {}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Pat_ { pub enum Pat_ {
/// Represents a wildcard pattern (either `_` or `..`) /// Represents a wildcard pattern (either `_` or `..`)
@ -561,15 +549,13 @@ pub enum Pat_ {
PatMac(Mac), PatMac(Mac),
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Mutability { pub enum Mutability {
MutMutable, MutMutable,
MutImmutable, MutImmutable,
} }
impl Copy for Mutability {} #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum BinOp { pub enum BinOp {
BiAdd, BiAdd,
BiSub, BiSub,
@ -591,9 +577,7 @@ pub enum BinOp {
BiGt, BiGt,
} }
impl Copy for BinOp {} #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum UnOp { pub enum UnOp {
UnUniq, UnUniq,
UnDeref, UnDeref,
@ -601,8 +585,6 @@ pub enum UnOp {
UnNeg UnNeg
} }
impl Copy for UnOp {}
pub type Stmt = Spanned<Stmt_>; pub type Stmt = Spanned<Stmt_>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
@ -634,14 +616,12 @@ pub enum MacStmtStyle {
/// Where a local declaration came from: either a true `let ... = /// Where a local declaration came from: either a true `let ... =
/// ...;`, or one desugared from the pattern of a for loop. /// ...;`, or one desugared from the pattern of a for loop.
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum LocalSource { pub enum LocalSource {
LocalLet, LocalLet,
LocalFor, LocalFor,
} }
impl Copy for LocalSource {}
// FIXME (pending discussion of #1697, #2178...): local should really be // FIXME (pending discussion of #1697, #2178...): local should really be
// a refinement on pat. // a refinement on pat.
/// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;` /// Local represents a `let` statement, e.g., `let <pat>:<ty> = <expr>;`
@ -683,22 +663,18 @@ pub struct Field {
pub type SpannedIdent = Spanned<Ident>; pub type SpannedIdent = Spanned<Ident>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum BlockCheckMode { pub enum BlockCheckMode {
DefaultBlock, DefaultBlock,
UnsafeBlock(UnsafeSource), UnsafeBlock(UnsafeSource),
} }
impl Copy for BlockCheckMode {} #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum UnsafeSource { pub enum UnsafeSource {
CompilerGenerated, CompilerGenerated,
UserProvided, UserProvided,
} }
impl Copy for UnsafeSource {}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct Expr { pub struct Expr {
pub id: NodeId, pub id: NodeId,
@ -775,23 +751,19 @@ pub struct QPath {
pub item_name: Ident, pub item_name: Ident,
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum MatchSource { pub enum MatchSource {
MatchNormal, MatchNormal,
MatchIfLetDesugar, MatchIfLetDesugar,
MatchWhileLetDesugar, MatchWhileLetDesugar,
} }
impl Copy for MatchSource {} #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum CaptureClause { pub enum CaptureClause {
CaptureByValue, CaptureByValue,
CaptureByRef, CaptureByRef,
} }
impl Copy for CaptureClause {}
/// A delimited sequence of token trees /// A delimited sequence of token trees
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct Delimited { pub struct Delimited {
@ -842,14 +814,12 @@ pub struct SequenceRepetition {
/// A Kleene-style [repetition operator](http://en.wikipedia.org/wiki/Kleene_star) /// A Kleene-style [repetition operator](http://en.wikipedia.org/wiki/Kleene_star)
/// for token sequences. /// for token sequences.
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum KleeneOp { pub enum KleeneOp {
ZeroOrMore, ZeroOrMore,
OneOrMore, OneOrMore,
} }
impl Copy for KleeneOp {}
/// When the main rust parser encounters a syntax-extension invocation, it /// When the main rust parser encounters a syntax-extension invocation, it
/// parses the arguments to the invocation as a token-tree. This is a very /// parses the arguments to the invocation as a token-tree. This is a very
/// loose structure, such that all sorts of different AST-fragments can /// loose structure, such that all sorts of different AST-fragments can
@ -959,24 +929,20 @@ pub enum Mac_ {
MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation MacInvocTT(Path, Vec<TokenTree> , SyntaxContext), // new macro-invocation
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum StrStyle { pub enum StrStyle {
CookedStr, CookedStr,
RawStr(uint) RawStr(uint)
} }
impl Copy for StrStyle {}
pub type Lit = Spanned<Lit_>; pub type Lit = Spanned<Lit_>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Sign { pub enum Sign {
Minus, Minus,
Plus Plus
} }
impl Copy for Sign {}
impl<T> Sign where T: Int { impl<T> Sign where T: Int {
pub fn new(n: T) -> Sign { pub fn new(n: T) -> Sign {
if n < Int::zero() { if n < Int::zero() {
@ -987,15 +953,13 @@ impl<T> Sign where T: Int {
} }
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum LitIntType { pub enum LitIntType {
SignedIntLit(IntTy, Sign), SignedIntLit(IntTy, Sign),
UnsignedIntLit(UintTy), UnsignedIntLit(UintTy),
UnsuffixedIntLit(Sign) UnsuffixedIntLit(Sign)
} }
impl Copy for LitIntType {}
impl LitIntType { impl LitIntType {
pub fn suffix_len(&self) -> uint { pub fn suffix_len(&self) -> uint {
match *self { match *self {
@ -1082,7 +1046,7 @@ pub struct Typedef {
pub typ: P<Ty>, pub typ: P<Ty>,
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum IntTy { pub enum IntTy {
TyI, TyI,
TyI8, TyI8,
@ -1091,8 +1055,6 @@ pub enum IntTy {
TyI64, TyI64,
} }
impl Copy for IntTy {}
impl fmt::Show for IntTy { impl fmt::Show for IntTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", ast_util::int_ty_to_string(*self, None)) write!(f, "{}", ast_util::int_ty_to_string(*self, None))
@ -1109,7 +1071,7 @@ impl IntTy {
} }
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum UintTy { pub enum UintTy {
TyU, TyU,
TyU8, TyU8,
@ -1118,8 +1080,6 @@ pub enum UintTy {
TyU64, TyU64,
} }
impl Copy for UintTy {}
impl UintTy { impl UintTy {
pub fn suffix_len(&self) -> uint { pub fn suffix_len(&self) -> uint {
match *self { match *self {
@ -1136,14 +1096,12 @@ impl fmt::Show for UintTy {
} }
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum FloatTy { pub enum FloatTy {
TyF32, TyF32,
TyF64, TyF64,
} }
impl Copy for FloatTy {}
impl fmt::Show for FloatTy { impl fmt::Show for FloatTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", ast_util::float_ty_to_string(*self)) write!(f, "{}", ast_util::float_ty_to_string(*self))
@ -1177,7 +1135,7 @@ pub struct Ty {
} }
/// Not represented directly in the AST, referred to by name through a ty_path. /// Not represented directly in the AST, referred to by name through a ty_path.
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum PrimTy { pub enum PrimTy {
TyInt(IntTy), TyInt(IntTy),
TyUint(UintTy), TyUint(UintTy),
@ -1187,16 +1145,12 @@ pub enum PrimTy {
TyChar TyChar
} }
impl Copy for PrimTy {} #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash)]
pub enum Onceness { pub enum Onceness {
Once, Once,
Many Many
} }
impl Copy for Onceness {}
impl fmt::Show for Onceness { impl fmt::Show for Onceness {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self { match *self {
@ -1259,14 +1213,12 @@ pub enum Ty_ {
TyInfer, TyInfer,
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum AsmDialect { pub enum AsmDialect {
AsmAtt, AsmAtt,
AsmIntel AsmIntel
} }
impl Copy for AsmDialect {}
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct InlineAsm { pub struct InlineAsm {
pub asm: InternedString, pub asm: InternedString,
@ -1433,14 +1385,12 @@ pub struct Variant_ {
pub type Variant = Spanned<Variant_>; pub type Variant = Spanned<Variant_>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum PathListItem_ { pub enum PathListItem_ {
PathListIdent { name: Ident, id: NodeId }, PathListIdent { name: Ident, id: NodeId },
PathListMod { id: NodeId } PathListMod { id: NodeId }
} }
impl Copy for PathListItem_ {}
impl PathListItem_ { impl PathListItem_ {
pub fn id(&self) -> NodeId { pub fn id(&self) -> NodeId {
match *self { match *self {
@ -1494,19 +1444,15 @@ pub type Attribute = Spanned<Attribute_>;
/// Distinguishes between Attributes that decorate items and Attributes that /// Distinguishes between Attributes that decorate items and Attributes that
/// are contained as statements within items. These two cases need to be /// are contained as statements within items. These two cases need to be
/// distinguished for pretty-printing. /// distinguished for pretty-printing.
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum AttrStyle { pub enum AttrStyle {
AttrOuter, AttrOuter,
AttrInner, AttrInner,
} }
impl Copy for AttrStyle {} #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct AttrId(pub uint); pub struct AttrId(pub uint);
impl Copy for AttrId {}
/// Doc-comments are promoted to attributes that have is_sugared_doc = true /// Doc-comments are promoted to attributes that have is_sugared_doc = true
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct Attribute_ { pub struct Attribute_ {
@ -1536,14 +1482,12 @@ pub struct PolyTraitRef {
pub trait_ref: TraitRef pub trait_ref: TraitRef
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum Visibility { pub enum Visibility {
Public, Public,
Inherited, Inherited,
} }
impl Copy for Visibility {}
impl Visibility { impl Visibility {
pub fn inherit_from(&self, parent_visibility: Visibility) -> Visibility { pub fn inherit_from(&self, parent_visibility: Visibility) -> Visibility {
match self { match self {
@ -1572,15 +1516,13 @@ impl StructField_ {
pub type StructField = Spanned<StructField_>; pub type StructField = Spanned<StructField_>;
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum StructFieldKind { pub enum StructFieldKind {
NamedField(Ident, Visibility), NamedField(Ident, Visibility),
/// Element of a tuple-like struct /// Element of a tuple-like struct
UnnamedField(Visibility), UnnamedField(Visibility),
} }
impl Copy for StructFieldKind {}
impl StructFieldKind { impl StructFieldKind {
pub fn is_unnamed(&self) -> bool { pub fn is_unnamed(&self) -> bool {
match *self { match *self {
@ -1682,15 +1624,13 @@ impl ForeignItem_ {
} }
} }
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub enum UnboxedClosureKind { pub enum UnboxedClosureKind {
FnUnboxedClosureKind, FnUnboxedClosureKind,
FnMutUnboxedClosureKind, FnMutUnboxedClosureKind,
FnOnceUnboxedClosureKind, FnOnceUnboxedClosureKind,
} }
impl Copy for UnboxedClosureKind {}
/// The data we save and restore about an inlined item or method. This is not /// 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 /// part of the AST that we parse from a file, but it becomes part of the tree
/// that we trans. /// that we trans.

View file

@ -41,10 +41,9 @@ use visit;
/// - The default implementation for a trait method. /// - The default implementation for a trait method.
/// ///
/// To construct one, use the `Code::from_node` function. /// To construct one, use the `Code::from_node` function.
#[deriving(Copy)]
pub struct FnLikeNode<'a> { node: ast_map::Node<'a> } pub struct FnLikeNode<'a> { node: ast_map::Node<'a> }
impl<'a> Copy for FnLikeNode<'a> {}
/// MaybeFnLike wraps a method that indicates if an object /// MaybeFnLike wraps a method that indicates if an object
/// corresponds to some FnLikeNode. /// corresponds to some FnLikeNode.
pub trait MaybeFnLike { fn is_fn_like(&self) -> bool; } pub trait MaybeFnLike { fn is_fn_like(&self) -> bool; }
@ -82,13 +81,12 @@ impl MaybeFnLike for ast::Expr {
/// Carries either an FnLikeNode or a Block, as these are the two /// Carries either an FnLikeNode or a Block, as these are the two
/// constructs that correspond to "code" (as in, something from which /// constructs that correspond to "code" (as in, something from which
/// we can construct a control-flow graph). /// we can construct a control-flow graph).
#[deriving(Copy)]
pub enum Code<'a> { pub enum Code<'a> {
FnLikeCode(FnLikeNode<'a>), FnLikeCode(FnLikeNode<'a>),
BlockCode(&'a Block), BlockCode(&'a Block),
} }
impl<'a> Copy for Code<'a> {}
impl<'a> Code<'a> { impl<'a> Code<'a> {
pub fn id(&self) -> ast::NodeId { pub fn id(&self) -> ast::NodeId {
match *self { match *self {

View file

@ -32,14 +32,12 @@ use std::slice;
pub mod blocks; pub mod blocks;
#[deriving(Clone, PartialEq)] #[deriving(Clone, Copy, PartialEq)]
pub enum PathElem { pub enum PathElem {
PathMod(Name), PathMod(Name),
PathName(Name) PathName(Name)
} }
impl Copy for PathElem {}
impl PathElem { impl PathElem {
pub fn name(&self) -> Name { pub fn name(&self) -> Name {
match *self { match *self {
@ -102,7 +100,7 @@ pub fn path_to_string<PI: Iterator<PathElem>>(path: PI) -> String {
}).to_string() }).to_string()
} }
#[deriving(Show)] #[deriving(Copy, Show)]
pub enum Node<'ast> { pub enum Node<'ast> {
NodeItem(&'ast Item), NodeItem(&'ast Item),
NodeForeignItem(&'ast ForeignItem), NodeForeignItem(&'ast ForeignItem),
@ -122,11 +120,9 @@ pub enum Node<'ast> {
NodeLifetime(&'ast Lifetime), NodeLifetime(&'ast Lifetime),
} }
impl<'ast> Copy for Node<'ast> {}
/// Represents an entry and its parent Node ID /// Represents an entry and its parent Node ID
/// The odd layout is to bring down the total size. /// The odd layout is to bring down the total size.
#[deriving(Show)] #[deriving(Copy, Show)]
enum MapEntry<'ast> { enum MapEntry<'ast> {
/// Placeholder for holes in the map. /// Placeholder for holes in the map.
NotPresent, NotPresent,
@ -151,8 +147,6 @@ enum MapEntry<'ast> {
RootInlinedParent(&'ast InlinedParent) RootInlinedParent(&'ast InlinedParent)
} }
impl<'ast> Copy for MapEntry<'ast> {}
impl<'ast> Clone for MapEntry<'ast> { impl<'ast> Clone for MapEntry<'ast> {
fn clone(&self) -> MapEntry<'ast> { fn clone(&self) -> MapEntry<'ast> {
*self *self

View file

@ -343,14 +343,12 @@ pub fn empty_generics() -> Generics {
// ______________________________________________________________________ // ______________________________________________________________________
// Enumerating the IDs which appear in an AST // Enumerating the IDs which appear in an AST
#[deriving(Encodable, Decodable, Show)] #[deriving(Copy, Encodable, Decodable, Show)]
pub struct IdRange { pub struct IdRange {
pub min: NodeId, pub min: NodeId,
pub max: NodeId, pub max: NodeId,
} }
impl Copy for IdRange {}
impl IdRange { impl IdRange {
pub fn max() -> IdRange { pub fn max() -> IdRange {
IdRange { IdRange {

View file

@ -277,7 +277,7 @@ pub fn find_crate_name(attrs: &[Attribute]) -> Option<InternedString> {
first_attr_value_str_by_name(attrs, "crate_name") first_attr_value_str_by_name(attrs, "crate_name")
} }
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum InlineAttr { pub enum InlineAttr {
InlineNone, InlineNone,
InlineHint, InlineHint,
@ -285,8 +285,6 @@ pub enum InlineAttr {
InlineNever, InlineNever,
} }
impl Copy for InlineAttr {}
/// Determine what `#[inline]` attribute is present in `attrs`, if any. /// Determine what `#[inline]` attribute is present in `attrs`, if any.
pub fn find_inline_attr(attrs: &[Attribute]) -> InlineAttr { pub fn find_inline_attr(attrs: &[Attribute]) -> InlineAttr {
// FIXME (#2809)---validate the usage of #[inline] and #[inline] // FIXME (#2809)---validate the usage of #[inline] and #[inline]
@ -349,7 +347,7 @@ pub struct Stability {
} }
/// The available stability levels. /// The available stability levels.
#[deriving(Encodable,Decodable,PartialEq,PartialOrd,Clone,Show)] #[deriving(Copy,Encodable,Decodable,PartialEq,PartialOrd,Clone,Show)]
pub enum StabilityLevel { pub enum StabilityLevel {
Deprecated, Deprecated,
Experimental, Experimental,
@ -359,8 +357,6 @@ pub enum StabilityLevel {
Locked Locked
} }
impl Copy for StabilityLevel {}
pub fn find_stability_generic<'a, pub fn find_stability_generic<'a,
AM: AttrMetaMethods, AM: AttrMetaMethods,
I: Iterator<&'a AM>> I: Iterator<&'a AM>>
@ -468,7 +464,7 @@ fn int_type_of_word(s: &str) -> Option<IntType> {
} }
} }
#[deriving(PartialEq, Show, Encodable, Decodable)] #[deriving(Copy, PartialEq, Show, Encodable, Decodable)]
pub enum ReprAttr { pub enum ReprAttr {
ReprAny, ReprAny,
ReprInt(Span, IntType), ReprInt(Span, IntType),
@ -476,8 +472,6 @@ pub enum ReprAttr {
ReprPacked, ReprPacked,
} }
impl Copy for ReprAttr {}
impl ReprAttr { impl ReprAttr {
pub fn is_ffi_safe(&self) -> bool { pub fn is_ffi_safe(&self) -> bool {
match *self { match *self {
@ -489,14 +483,12 @@ impl ReprAttr {
} }
} }
#[deriving(Eq, Hash, PartialEq, Show, Encodable, Decodable)] #[deriving(Copy, Eq, Hash, PartialEq, Show, Encodable, Decodable)]
pub enum IntType { pub enum IntType {
SignedInt(ast::IntTy), SignedInt(ast::IntTy),
UnsignedInt(ast::UintTy) UnsignedInt(ast::UintTy)
} }
impl Copy for IntType {}
impl IntType { impl IntType {
#[inline] #[inline]
pub fn is_signed(self) -> bool { pub fn is_signed(self) -> bool {

View file

@ -31,19 +31,15 @@ pub trait Pos {
/// A byte offset. Keep this small (currently 32-bits), as AST contains /// A byte offset. Keep this small (currently 32-bits), as AST contains
/// a lot of them. /// a lot of them.
#[deriving(Clone, PartialEq, Eq, Hash, PartialOrd, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Show)]
pub struct BytePos(pub u32); pub struct BytePos(pub u32);
impl Copy for BytePos {}
/// A character offset. Because of multibyte utf8 characters, a byte offset /// A character offset. Because of multibyte utf8 characters, a byte offset
/// is not equivalent to a character offset. The CodeMap will convert BytePos /// is not equivalent to a character offset. The CodeMap will convert BytePos
/// values to CharPos values as necessary. /// values to CharPos values as necessary.
#[deriving(PartialEq, Hash, PartialOrd, Show)] #[deriving(Copy, PartialEq, Hash, PartialOrd, Show)]
pub struct CharPos(pub uint); pub struct CharPos(pub uint);
impl Copy for CharPos {}
// FIXME: Lots of boilerplate in these impls, but so far my attempts to fix // FIXME: Lots of boilerplate in these impls, but so far my attempts to fix
// have been unsuccessful // have been unsuccessful
@ -121,7 +117,7 @@ impl Sub<CharPos, CharPos> for CharPos {
/// are *absolute* positions from the beginning of the codemap, not positions /// 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 /// relative to FileMaps. Methods on the CodeMap can be used to relate spans back
/// to the original source. /// to the original source.
#[deriving(Clone, Show, Hash)] #[deriving(Clone, Copy, Show, Hash)]
pub struct Span { pub struct Span {
pub lo: BytePos, pub lo: BytePos,
pub hi: BytePos, pub hi: BytePos,
@ -130,18 +126,14 @@ pub struct Span {
pub expn_id: ExpnId pub expn_id: ExpnId
} }
impl Copy for Span {}
pub const DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: NO_EXPANSION }; pub const DUMMY_SP: Span = Span { lo: BytePos(0), hi: BytePos(0), expn_id: NO_EXPANSION };
#[deriving(Clone, PartialEq, Eq, Encodable, Decodable, Hash, Show)] #[deriving(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Show)]
pub struct Spanned<T> { pub struct Spanned<T> {
pub node: T, pub node: T,
pub span: Span, pub span: Span,
} }
impl<T:Copy> Copy for Spanned<T> {}
impl PartialEq for Span { impl PartialEq for Span {
fn eq(&self, other: &Span) -> bool { fn eq(&self, other: &Span) -> bool {
return (*self).lo == (*other).lo && (*self).hi == (*other).hi; return (*self).lo == (*other).lo && (*self).hi == (*other).hi;
@ -219,7 +211,7 @@ pub struct FileMapAndLine { pub fm: Rc<FileMap>, pub line: uint }
pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos } pub struct FileMapAndBytePos { pub fm: Rc<FileMap>, pub pos: BytePos }
/// The syntax with which a macro was invoked. /// The syntax with which a macro was invoked.
#[deriving(Clone, Hash, Show)] #[deriving(Clone, Copy, Hash, Show)]
pub enum MacroFormat { pub enum MacroFormat {
/// e.g. #[deriving(...)] <item> /// e.g. #[deriving(...)] <item>
MacroAttribute, MacroAttribute,
@ -227,8 +219,6 @@ pub enum MacroFormat {
MacroBang MacroBang
} }
impl Copy for MacroFormat {}
#[deriving(Clone, Hash, Show)] #[deriving(Clone, Hash, Show)]
pub struct NameAndSpan { pub struct NameAndSpan {
/// The name of the macro that was invoked to create the thing /// The name of the macro that was invoked to create the thing
@ -264,11 +254,9 @@ pub struct ExpnInfo {
pub callee: NameAndSpan pub callee: NameAndSpan
} }
#[deriving(PartialEq, Eq, Clone, Show, Hash, Encodable, Decodable)] #[deriving(Copy, PartialEq, Eq, Clone, Show, Hash, Encodable, Decodable)]
pub struct ExpnId(u32); pub struct ExpnId(u32);
impl Copy for ExpnId {}
pub const NO_EXPANSION: ExpnId = ExpnId(-1); pub const NO_EXPANSION: ExpnId = ExpnId(-1);
impl ExpnId { impl ExpnId {
@ -290,6 +278,7 @@ pub struct FileLines {
} }
/// Identifies an offset of a multi-byte character in a FileMap /// Identifies an offset of a multi-byte character in a FileMap
#[deriving(Copy)]
pub struct MultiByteChar { pub struct MultiByteChar {
/// The absolute offset of the character in the CodeMap /// The absolute offset of the character in the CodeMap
pub pos: BytePos, pub pos: BytePos,
@ -297,8 +286,6 @@ pub struct MultiByteChar {
pub bytes: uint, pub bytes: uint,
} }
impl Copy for MultiByteChar {}
/// A single source in the CodeMap /// A single source in the CodeMap
pub struct FileMap { pub struct FileMap {
/// The name of the file that the source came from, source that doesn't /// The name of the file that the source came from, source that doesn't

View file

@ -28,7 +28,7 @@ use term;
/// maximum number of lines we will print for each error; arbitrary. /// maximum number of lines we will print for each error; arbitrary.
static MAX_LINES: uint = 6u; static MAX_LINES: uint = 6u;
#[deriving(Clone)] #[deriving(Clone, Copy)]
pub enum RenderSpan { pub enum RenderSpan {
/// A FullSpan renders with both with an initial line for the /// A FullSpan renders with both with an initial line for the
/// message, prefixed by file:linenum, followed by a summary of /// message, prefixed by file:linenum, followed by a summary of
@ -40,8 +40,6 @@ pub enum RenderSpan {
FileLine(Span), FileLine(Span),
} }
impl Copy for RenderSpan {}
impl RenderSpan { impl RenderSpan {
fn span(self) -> Span { fn span(self) -> Span {
match self { match self {
@ -56,15 +54,13 @@ impl RenderSpan {
} }
} }
#[deriving(Clone)] #[deriving(Clone, Copy)]
pub enum ColorConfig { pub enum ColorConfig {
Auto, Auto,
Always, Always,
Never Never
} }
impl Copy for ColorConfig {}
pub trait Emitter { pub trait Emitter {
fn emit(&mut self, cmsp: Option<(&codemap::CodeMap, Span)>, fn emit(&mut self, cmsp: Option<(&codemap::CodeMap, Span)>,
msg: &str, code: Option<&str>, lvl: Level); msg: &str, code: Option<&str>, lvl: Level);
@ -75,16 +71,14 @@ pub trait Emitter {
/// This structure is used to signify that a task has panicked with a fatal error /// 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 /// from the diagnostics. You can use this with the `Any` trait to figure out
/// how a rustc task died (if so desired). /// how a rustc task died (if so desired).
#[deriving(Copy)]
pub struct FatalError; pub struct FatalError;
impl Copy for FatalError {}
/// Signifies that the compiler died with an explicit call to `.bug` /// Signifies that the compiler died with an explicit call to `.bug`
/// or `.span_bug` rather than a failed assertion, etc. /// or `.span_bug` rather than a failed assertion, etc.
#[deriving(Copy)]
pub struct ExplicitBug; pub struct ExplicitBug;
impl Copy for ExplicitBug {}
/// A span-handler is like a handler but also /// A span-handler is like a handler but also
/// accepts span information for source-location /// accepts span information for source-location
/// reporting. /// reporting.
@ -228,7 +222,7 @@ pub fn mk_handler(e: Box<Emitter + Send>) -> Handler {
} }
} }
#[deriving(PartialEq, Clone)] #[deriving(Copy, PartialEq, Clone)]
pub enum Level { pub enum Level {
Bug, Bug,
Fatal, Fatal,
@ -238,8 +232,6 @@ pub enum Level {
Help, Help,
} }
impl Copy for Level {}
impl fmt::Show for Level { impl fmt::Show for Level {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use std::fmt::Show; use std::fmt::Show;

View file

@ -223,13 +223,12 @@ impl MacResult for MacItems {
/// Fill-in macro expansion result, to allow compilation to continue /// Fill-in macro expansion result, to allow compilation to continue
/// after hitting errors. /// after hitting errors.
#[deriving(Copy)]
pub struct DummyResult { pub struct DummyResult {
expr_only: bool, expr_only: bool,
span: Span span: Span
} }
impl Copy for DummyResult {}
impl DummyResult { impl DummyResult {
/// Create a default MacResult that can be anything. /// Create a default MacResult that can be anything.
/// ///

View file

@ -83,12 +83,11 @@ pub fn expand_deriving_ord<F>(cx: &mut ExtCtxt,
trait_def.expand(cx, mitem, item, push) trait_def.expand(cx, mitem, item, push)
} }
#[deriving(Copy)]
pub enum OrderingOp { pub enum OrderingOp {
PartialCmpOp, LtOp, LeOp, GtOp, GeOp, PartialCmpOp, LtOp, LeOp, GtOp, GeOp,
} }
impl Copy for OrderingOp {}
pub fn some_ordering_collapsed(cx: &mut ExtCtxt, pub fn some_ordering_collapsed(cx: &mut ExtCtxt,
span: Span, span: Span,
op: OrderingOp, op: OrderingOp,

View file

@ -39,7 +39,7 @@ pub struct SCTable {
rename_memo: RefCell<HashMap<(SyntaxContext,Ident,Name),SyntaxContext>>, rename_memo: RefCell<HashMap<(SyntaxContext,Ident,Name),SyntaxContext>>,
} }
#[deriving(PartialEq, Encodable, Decodable, Hash, Show)] #[deriving(Copy, PartialEq, Encodable, Decodable, Hash, Show)]
pub enum SyntaxContext_ { pub enum SyntaxContext_ {
EmptyCtxt, EmptyCtxt,
Mark (Mrk,SyntaxContext), Mark (Mrk,SyntaxContext),
@ -56,8 +56,6 @@ pub enum SyntaxContext_ {
IllegalCtxt IllegalCtxt
} }
impl Copy for SyntaxContext_ {}
/// A list of ident->name renamings /// A list of ident->name renamings
pub type RenameList = Vec<(Ident, Name)>; pub type RenameList = Vec<(Ident, Name)>;

View file

@ -97,6 +97,7 @@ enum Status {
} }
/// A set of features to be used by later passes. /// A set of features to be used by later passes.
#[deriving(Copy)]
pub struct Features { pub struct Features {
pub default_type_params: bool, pub default_type_params: bool,
pub unboxed_closures: bool, pub unboxed_closures: bool,
@ -107,8 +108,6 @@ pub struct Features {
pub opt_out_copy: bool, pub opt_out_copy: bool,
} }
impl Copy for Features {}
impl Features { impl Features {
pub fn new() -> Features { pub fn new() -> Features {
Features { Features {

View file

@ -24,7 +24,7 @@ use std::str;
use std::string::String; use std::string::String;
use std::uint; use std::uint;
#[deriving(Clone, PartialEq)] #[deriving(Clone, Copy, PartialEq)]
pub enum CommentStyle { pub enum CommentStyle {
/// No code on either side of each line of the comment /// No code on either side of each line of the comment
Isolated, Isolated,
@ -36,8 +36,6 @@ pub enum CommentStyle {
BlankLine, BlankLine,
} }
impl Copy for CommentStyle {}
#[deriving(Clone)] #[deriving(Clone)]
pub struct Comment { pub struct Comment {
pub style: CommentStyle, pub style: CommentStyle,

View file

@ -22,7 +22,7 @@ use parse::token;
use ptr::P; use ptr::P;
/// The specific types of unsupported syntax /// The specific types of unsupported syntax
#[deriving(PartialEq, Eq, Hash)] #[deriving(Copy, PartialEq, Eq, Hash)]
pub enum ObsoleteSyntax { pub enum ObsoleteSyntax {
ObsoleteOwnedType, ObsoleteOwnedType,
ObsoleteOwnedExpr, ObsoleteOwnedExpr,
@ -36,8 +36,6 @@ pub enum ObsoleteSyntax {
ObsoleteProcExpr, ObsoleteProcExpr,
} }
impl Copy for ObsoleteSyntax {}
pub trait ParserObsoleteMethods { pub trait ParserObsoleteMethods {
/// Reports an obsolete syntax non-fatal error. /// Reports an obsolete syntax non-fatal error.
fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax); fn obsolete(&mut self, sp: Span, kind: ObsoleteSyntax);

View file

@ -104,7 +104,7 @@ type ItemInfo = (Ident, Item_, Option<Vec<Attribute> >);
/// How to parse a path. There are four different kinds of paths, all of which /// How to parse a path. There are four different kinds of paths, all of which
/// are parsed somewhat differently. /// are parsed somewhat differently.
#[deriving(PartialEq)] #[deriving(Copy, PartialEq)]
pub enum PathParsingMode { pub enum PathParsingMode {
/// A path with no type parameters; e.g. `foo::bar::Baz` /// A path with no type parameters; e.g. `foo::bar::Baz`
NoTypesAllowed, NoTypesAllowed,
@ -116,8 +116,6 @@ pub enum PathParsingMode {
LifetimeAndTypesWithColons, LifetimeAndTypesWithColons,
} }
impl Copy for PathParsingMode {}
enum ItemOrViewItem { enum ItemOrViewItem {
/// Indicates a failure to parse any kind of item. The attributes are /// Indicates a failure to parse any kind of item. The attributes are
/// returned. /// returned.

View file

@ -28,7 +28,7 @@ use std::path::BytesContainer;
use std::rc::Rc; use std::rc::Rc;
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)] #[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
pub enum BinOpToken { pub enum BinOpToken {
Plus, Plus,
Minus, Minus,
@ -42,10 +42,8 @@ pub enum BinOpToken {
Shr, Shr,
} }
impl Copy for BinOpToken {}
/// A delimeter token /// A delimeter token
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)] #[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
pub enum DelimToken { pub enum DelimToken {
/// A round parenthesis: `(` or `)` /// A round parenthesis: `(` or `)`
Paren, Paren,
@ -55,16 +53,14 @@ pub enum DelimToken {
Brace, Brace,
} }
impl Copy for DelimToken {} #[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
pub enum IdentStyle { pub enum IdentStyle {
/// `::` follows the identifier with no whitespace in-between. /// `::` follows the identifier with no whitespace in-between.
ModName, ModName,
Plain, Plain,
} }
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)] #[deriving(Clone, Copy, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
pub enum Lit { pub enum Lit {
Byte(ast::Name), Byte(ast::Name),
Char(ast::Name), Char(ast::Name),
@ -89,10 +85,6 @@ impl Lit {
} }
} }
impl Copy for Lit {}
impl Copy for IdentStyle {}
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
#[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)] #[deriving(Clone, Encodable, Decodable, PartialEq, Eq, Hash, Show)]
pub enum Token { pub enum Token {
@ -438,13 +430,12 @@ macro_rules! declare_special_idents_and_keywords {(
pub use self::Keyword::*; pub use self::Keyword::*;
use ast; use ast;
#[deriving(Copy)]
pub enum Keyword { pub enum Keyword {
$( $sk_variant, )* $( $sk_variant, )*
$( $rk_variant, )* $( $rk_variant, )*
} }
impl Copy for Keyword {}
impl Keyword { impl Keyword {
pub fn to_name(&self) -> ast::Name { pub fn to_name(&self) -> ast::Name {
match *self { match *self {

View file

@ -66,30 +66,24 @@ pub use self::Token::*;
use std::io; use std::io;
use std::string; use std::string;
#[deriving(Clone, PartialEq)] #[deriving(Clone, Copy, PartialEq)]
pub enum Breaks { pub enum Breaks {
Consistent, Consistent,
Inconsistent, Inconsistent,
} }
impl Copy for Breaks {} #[deriving(Clone, Copy)]
#[deriving(Clone)]
pub struct BreakToken { pub struct BreakToken {
offset: int, offset: int,
blank_space: int blank_space: int
} }
impl Copy for BreakToken {} #[deriving(Clone, Copy)]
#[deriving(Clone)]
pub struct BeginToken { pub struct BeginToken {
offset: int, offset: int,
breaks: Breaks breaks: Breaks
} }
impl Copy for BeginToken {}
#[deriving(Clone)] #[deriving(Clone)]
pub enum Token { pub enum Token {
String(string::String, int), String(string::String, int),
@ -153,20 +147,18 @@ pub fn buf_str(toks: Vec<Token>,
return s.into_string(); return s.into_string();
} }
#[deriving(Copy)]
pub enum PrintStackBreak { pub enum PrintStackBreak {
Fits, Fits,
Broken(Breaks), Broken(Breaks),
} }
impl Copy for PrintStackBreak {} #[deriving(Copy)]
pub struct PrintStackElem { pub struct PrintStackElem {
offset: int, offset: int,
pbreak: PrintStackBreak pbreak: PrintStackBreak
} }
impl Copy for PrintStackElem {}
static SIZE_INFINITY: int = 0xffff; static SIZE_INFINITY: int = 0xffff;
pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: uint) -> Printer { pub fn mk_printer(out: Box<io::Writer+'static>, linewidth: uint) -> Printer {

View file

@ -45,19 +45,17 @@ pub trait PpAnn {
fn post(&self, _state: &mut State, _node: AnnNode) -> IoResult<()> { Ok(()) } fn post(&self, _state: &mut State, _node: AnnNode) -> IoResult<()> { Ok(()) }
} }
#[deriving(Copy)]
pub struct NoAnn; pub struct NoAnn;
impl Copy for NoAnn {}
impl PpAnn for NoAnn {} impl PpAnn for NoAnn {}
#[deriving(Copy)]
pub struct CurrentCommentAndLiteral { pub struct CurrentCommentAndLiteral {
cur_cmnt: uint, cur_cmnt: uint,
cur_lit: uint, cur_lit: uint,
} }
impl Copy for CurrentCommentAndLiteral {}
pub struct State<'a> { pub struct State<'a> {
pub s: pp::Printer, pub s: pp::Printer,
cm: Option<&'a CodeMap>, cm: Option<&'a CodeMap>,

View file

@ -32,6 +32,7 @@ use codemap::Span;
use ptr::P; use ptr::P;
use owned_slice::OwnedSlice; use owned_slice::OwnedSlice;
#[deriving(Copy)]
pub enum FnKind<'a> { pub enum FnKind<'a> {
/// fn foo() or extern "Abi" fn foo() /// fn foo() or extern "Abi" fn foo()
FkItemFn(Ident, &'a Generics, Unsafety, Abi), FkItemFn(Ident, &'a Generics, Unsafety, Abi),
@ -44,8 +45,6 @@ pub enum FnKind<'a> {
FkFnBlock, FkFnBlock,
} }
impl<'a> Copy for FnKind<'a> {}
/// Each method of the Visitor trait is a hook to be potentially /// Each method of the Visitor trait is a hook to be potentially
/// overridden. Each method's default implementation recursively visits /// overridden. Each method's default implementation recursively visits
/// the substructure of the input via the corresponding `walk` method; /// the substructure of the input via the corresponding `walk` method;