mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
auto merge of #20365 : nick29581/rust/mod, r=huonw
Part of #20361 and #20362
This commit is contained in:
commit
4b40bc85cb
@ -551,7 +551,7 @@ impl LintPass for BoxPointers {
|
|||||||
declare_lint! {
|
declare_lint! {
|
||||||
RAW_POINTER_DERIVING,
|
RAW_POINTER_DERIVING,
|
||||||
Warn,
|
Warn,
|
||||||
"uses of #[deriving] with raw pointers are rarely correct"
|
"uses of #[derive] with raw pointers are rarely correct"
|
||||||
}
|
}
|
||||||
|
|
||||||
struct RawPtrDerivingVisitor<'a, 'tcx: 'a> {
|
struct RawPtrDerivingVisitor<'a, 'tcx: 'a> {
|
||||||
@ -560,7 +560,7 @@ struct RawPtrDerivingVisitor<'a, 'tcx: 'a> {
|
|||||||
|
|
||||||
impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDerivingVisitor<'a, 'tcx> {
|
impl<'a, 'tcx, 'v> Visitor<'v> for RawPtrDerivingVisitor<'a, 'tcx> {
|
||||||
fn visit_ty(&mut self, ty: &ast::Ty) {
|
fn visit_ty(&mut self, ty: &ast::Ty) {
|
||||||
static MSG: &'static str = "use of `#[deriving]` with a raw pointer";
|
static MSG: &'static str = "use of `#[derive]` with a raw pointer";
|
||||||
if let ast::TyPtr(..) = ty.node {
|
if let ast::TyPtr(..) = ty.node {
|
||||||
self.cx.span_lint(RAW_POINTER_DERIVING, ty.span, MSG);
|
self.cx.span_lint(RAW_POINTER_DERIVING, ty.span, MSG);
|
||||||
}
|
}
|
||||||
|
@ -681,9 +681,10 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
|||||||
ViewPathSimple(binding, ref full_path, id) => {
|
ViewPathSimple(binding, ref full_path, id) => {
|
||||||
let source_name =
|
let source_name =
|
||||||
full_path.segments.last().unwrap().identifier.name;
|
full_path.segments.last().unwrap().identifier.name;
|
||||||
if token::get_name(source_name).get() == "mod" {
|
if token::get_name(source_name).get() == "mod" ||
|
||||||
|
token::get_name(source_name).get() == "self" {
|
||||||
self.resolve_error(view_path.span,
|
self.resolve_error(view_path.span,
|
||||||
"`mod` imports are only allowed within a { } list");
|
"`self` imports are only allowed within a { } list");
|
||||||
}
|
}
|
||||||
|
|
||||||
let subclass = SingleImport(binding.name,
|
let subclass = SingleImport(binding.name,
|
||||||
@ -704,10 +705,10 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
|||||||
}).collect::<Vec<Span>>();
|
}).collect::<Vec<Span>>();
|
||||||
if mod_spans.len() > 1 {
|
if mod_spans.len() > 1 {
|
||||||
self.resolve_error(mod_spans[0],
|
self.resolve_error(mod_spans[0],
|
||||||
"`mod` import can only appear once in the list");
|
"`self` import can only appear once in the list");
|
||||||
for other_span in mod_spans.iter().skip(1) {
|
for other_span in mod_spans.iter().skip(1) {
|
||||||
self.session.span_note(*other_span,
|
self.session.span_note(*other_span,
|
||||||
"another `mod` import appears here");
|
"another `self` import appears here");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +721,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
|||||||
Some(name) => *name,
|
Some(name) => *name,
|
||||||
None => {
|
None => {
|
||||||
self.resolve_error(source_item.span,
|
self.resolve_error(source_item.span,
|
||||||
"`mod` import can only appear in an import list \
|
"`self` import can only appear in an import list \
|
||||||
with a non-empty prefix");
|
with a non-empty prefix");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -971,6 +971,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Import resolution
|
// Import resolution
|
||||||
//
|
//
|
||||||
// This is a fixed-point algorithm. We resolve imports until our efforts
|
// This is a fixed-point algorithm. We resolve imports until our efforts
|
||||||
|
@ -390,6 +390,8 @@ fn initial_syntax_expander_table(ecfg: &expand::ExpansionConfig) -> SyntaxEnv {
|
|||||||
syntax_expanders.insert(intern("log_syntax"),
|
syntax_expanders.insert(intern("log_syntax"),
|
||||||
builtin_normal_expander(
|
builtin_normal_expander(
|
||||||
ext::log_syntax::expand_syntax_ext));
|
ext::log_syntax::expand_syntax_ext));
|
||||||
|
syntax_expanders.insert(intern("derive"),
|
||||||
|
Decorator(box ext::deriving::expand_meta_derive));
|
||||||
syntax_expanders.insert(intern("deriving"),
|
syntax_expanders.insert(intern("deriving"),
|
||||||
Decorator(box ext::deriving::expand_meta_deriving));
|
Decorator(box ext::deriving::expand_meta_deriving));
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//! Some code that abstracts away much of the boilerplate of writing
|
//! Some code that abstracts away much of the boilerplate of writing
|
||||||
//! `deriving` instances for traits. Among other things it manages getting
|
//! `derive` instances for traits. Among other things it manages getting
|
||||||
//! access to the fields of the 4 different sorts of structs and enum
|
//! access to the fields of the 4 different sorts of structs and enum
|
||||||
//! variants, as well as creating the method and impl ast instances.
|
//! variants, as well as creating the method and impl ast instances.
|
||||||
//!
|
//!
|
||||||
@ -26,7 +26,7 @@
|
|||||||
//! moment. (`TraitDef.additional_bounds`)
|
//! moment. (`TraitDef.additional_bounds`)
|
||||||
//!
|
//!
|
||||||
//! Unsupported: FIXME #6257: calling methods on reference fields,
|
//! Unsupported: FIXME #6257: calling methods on reference fields,
|
||||||
//! e.g. deriving Eq/Ord/Clone don't work on `struct A(&int)`,
|
//! e.g. derive Eq/Ord/Clone don't work on `struct A(&int)`,
|
||||||
//! because of how the auto-dereferencing happens.
|
//! because of how the auto-dereferencing happens.
|
||||||
//!
|
//!
|
||||||
//! The most important thing for implementers is the `Substructure` and
|
//! The most important thing for implementers is the `Substructure` and
|
||||||
@ -209,7 +209,7 @@ use self::ty::{LifetimeBounds, Path, Ptr, PtrTy, Self, Ty};
|
|||||||
pub mod ty;
|
pub mod ty;
|
||||||
|
|
||||||
pub struct TraitDef<'a> {
|
pub struct TraitDef<'a> {
|
||||||
/// The span for the current #[deriving(Foo)] header.
|
/// The span for the current #[derive(Foo)] header.
|
||||||
pub span: Span,
|
pub span: Span,
|
||||||
|
|
||||||
pub attributes: Vec<ast::Attribute>,
|
pub attributes: Vec<ast::Attribute>,
|
||||||
@ -354,7 +354,7 @@ impl<'a> TraitDef<'a> {
|
|||||||
generics)
|
generics)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
cx.span_err(mitem.span, "`deriving` may only be applied to structs and enums");
|
cx.span_err(mitem.span, "`derive` may only be applied to structs and enums");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -718,7 +718,7 @@ impl<'a> MethodDef<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ```
|
/// ```
|
||||||
/// #[deriving(PartialEq)]
|
/// #[derive(PartialEq)]
|
||||||
/// struct A { x: int, y: int }
|
/// struct A { x: int, y: int }
|
||||||
///
|
///
|
||||||
/// // equivalent to:
|
/// // equivalent to:
|
||||||
@ -782,7 +782,7 @@ impl<'a> MethodDef<'a> {
|
|||||||
} else {
|
} else {
|
||||||
cx.span_bug(trait_.span,
|
cx.span_bug(trait_.span,
|
||||||
"no self arguments to non-static method in generic \
|
"no self arguments to non-static method in generic \
|
||||||
`deriving`")
|
`derive`")
|
||||||
};
|
};
|
||||||
|
|
||||||
// body of the inner most destructuring match
|
// body of the inner most destructuring match
|
||||||
@ -822,7 +822,7 @@ impl<'a> MethodDef<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// ```
|
/// ```
|
||||||
/// #[deriving(PartialEq)]
|
/// #[derive(PartialEq)]
|
||||||
/// enum A {
|
/// enum A {
|
||||||
/// A1,
|
/// A1,
|
||||||
/// A2(int)
|
/// A2(int)
|
||||||
@ -1185,7 +1185,7 @@ impl<'a> TraitDef<'a> {
|
|||||||
cx: &mut ExtCtxt,
|
cx: &mut ExtCtxt,
|
||||||
mut to_set: Span) -> Span {
|
mut to_set: Span) -> Span {
|
||||||
let trait_name = match self.path.path.last() {
|
let trait_name = match self.path.path.last() {
|
||||||
None => cx.span_bug(self.span, "trait with empty path in generic `deriving`"),
|
None => cx.span_bug(self.span, "trait with empty path in generic `derive`"),
|
||||||
Some(name) => *name
|
Some(name) => *name
|
||||||
};
|
};
|
||||||
to_set.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo {
|
to_set.expn_id = cx.codemap().record_expansion(codemap::ExpnInfo {
|
||||||
@ -1215,7 +1215,7 @@ impl<'a> TraitDef<'a> {
|
|||||||
match (just_spans.is_empty(), named_idents.is_empty()) {
|
match (just_spans.is_empty(), named_idents.is_empty()) {
|
||||||
(false, false) => cx.span_bug(self.span,
|
(false, false) => cx.span_bug(self.span,
|
||||||
"a struct with named and unnamed \
|
"a struct with named and unnamed \
|
||||||
fields in generic `deriving`"),
|
fields in generic `derive`"),
|
||||||
// named fields
|
// named fields
|
||||||
(_, false) => Named(named_idents),
|
(_, false) => Named(named_idents),
|
||||||
// tuple structs (includes empty structs)
|
// tuple structs (includes empty structs)
|
||||||
@ -1263,7 +1263,7 @@ impl<'a> TraitDef<'a> {
|
|||||||
None
|
None
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
cx.span_bug(sp, "a struct with named and unnamed fields in `deriving`");
|
cx.span_bug(sp, "a struct with named and unnamed fields in `derive`");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
let ident = cx.ident_of(format!("{}_{}", prefix, i)[]);
|
let ident = cx.ident_of(format!("{}_{}", prefix, i)[]);
|
||||||
@ -1371,7 +1371,7 @@ pub fn cs_fold<F>(use_foldl: bool,
|
|||||||
enum_nonmatch_f(cx, trait_span, (all_args[], tuple),
|
enum_nonmatch_f(cx, trait_span, (all_args[], tuple),
|
||||||
substructure.nonself_args),
|
substructure.nonself_args),
|
||||||
StaticEnum(..) | StaticStruct(..) => {
|
StaticEnum(..) | StaticStruct(..) => {
|
||||||
cx.span_bug(trait_span, "static function in `deriving`")
|
cx.span_bug(trait_span, "static function in `derive`")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1411,7 +1411,7 @@ pub fn cs_same_method<F>(f: F,
|
|||||||
enum_nonmatch_f(cx, trait_span, (all_self_args[], tuple),
|
enum_nonmatch_f(cx, trait_span, (all_self_args[], tuple),
|
||||||
substructure.nonself_args),
|
substructure.nonself_args),
|
||||||
StaticEnum(..) | StaticStruct(..) => {
|
StaticEnum(..) | StaticStruct(..) => {
|
||||||
cx.span_bug(trait_span, "static function in `deriving`")
|
cx.span_bug(trait_span, "static function in `derive`")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
//! The compiler code necessary to implement the `#[deriving]` extensions.
|
//! The compiler code necessary to implement the `#[derive]` extensions.
|
||||||
//!
|
//!
|
||||||
//! FIXME (#2810): hygiene. Search for "__" strings (in other files too). We also assume "extra" is
|
//! FIXME (#2810): hygiene. Search for "__" strings (in other files too). We also assume "extra" is
|
||||||
//! the standard library, and "std" is the core library.
|
//! the standard library, and "std" is the core library.
|
||||||
@ -45,16 +45,26 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,
|
|||||||
_span: Span,
|
_span: Span,
|
||||||
mitem: &MetaItem,
|
mitem: &MetaItem,
|
||||||
item: &Item,
|
item: &Item,
|
||||||
mut push: Box<FnMut(P<Item>)>) {
|
push: Box<FnMut(P<Item>)>) {
|
||||||
|
cx.span_warn(mitem.span, "`deriving` is deprecated; use `derive`");
|
||||||
|
|
||||||
|
expand_meta_derive(cx, _span, mitem, item, push)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn expand_meta_derive(cx: &mut ExtCtxt,
|
||||||
|
_span: Span,
|
||||||
|
mitem: &MetaItem,
|
||||||
|
item: &Item,
|
||||||
|
mut push: Box<FnMut(P<Item>)>) {
|
||||||
match mitem.node {
|
match mitem.node {
|
||||||
MetaNameValue(_, ref l) => {
|
MetaNameValue(_, ref l) => {
|
||||||
cx.span_err(l.span, "unexpected value in `deriving`");
|
cx.span_err(l.span, "unexpected value in `derive`");
|
||||||
}
|
}
|
||||||
MetaWord(_) => {
|
MetaWord(_) => {
|
||||||
cx.span_warn(mitem.span, "empty trait list in `deriving`");
|
cx.span_warn(mitem.span, "empty trait list in `derive`");
|
||||||
}
|
}
|
||||||
MetaList(_, ref titems) if titems.len() == 0 => {
|
MetaList(_, ref titems) if titems.len() == 0 => {
|
||||||
cx.span_warn(mitem.span, "empty trait list in `deriving`");
|
cx.span_warn(mitem.span, "empty trait list in `derive`");
|
||||||
}
|
}
|
||||||
MetaList(_, ref titems) => {
|
MetaList(_, ref titems) => {
|
||||||
for titem in titems.iter().rev() {
|
for titem in titems.iter().rev() {
|
||||||
@ -78,15 +88,15 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,
|
|||||||
}
|
}
|
||||||
"Encodable" => {
|
"Encodable" => {
|
||||||
cx.span_warn(titem.span,
|
cx.span_warn(titem.span,
|
||||||
"deriving(Encodable) is deprecated \
|
"derive(Encodable) is deprecated \
|
||||||
in favor of deriving(RustcEncodable)");
|
in favor of derive(RustcEncodable)");
|
||||||
|
|
||||||
expand!(encodable::expand_deriving_encodable)
|
expand!(encodable::expand_deriving_encodable)
|
||||||
}
|
}
|
||||||
"Decodable" => {
|
"Decodable" => {
|
||||||
cx.span_warn(titem.span,
|
cx.span_warn(titem.span,
|
||||||
"deriving(Decodable) is deprecated \
|
"derive(Decodable) is deprecated \
|
||||||
in favor of deriving(RustcDecodable)");
|
in favor of derive(RustcDecodable)");
|
||||||
|
|
||||||
expand!(decodable::expand_deriving_decodable)
|
expand!(decodable::expand_deriving_decodable)
|
||||||
}
|
}
|
||||||
@ -111,7 +121,7 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,
|
|||||||
|
|
||||||
ref tname => {
|
ref tname => {
|
||||||
cx.span_err(titem.span,
|
cx.span_err(titem.span,
|
||||||
format!("unknown `deriving` \
|
format!("unknown `derive` \
|
||||||
trait: `{}`",
|
trait: `{}`",
|
||||||
*tname)[]);
|
*tname)[]);
|
||||||
}
|
}
|
||||||
|
@ -546,6 +546,10 @@ impl<'a> Parser<'a> {
|
|||||||
pub fn parse_path_list_item(&mut self) -> ast::PathListItem {
|
pub fn parse_path_list_item(&mut self) -> ast::PathListItem {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let node = if self.eat_keyword(keywords::Mod) {
|
let node = if self.eat_keyword(keywords::Mod) {
|
||||||
|
let span = self.last_span;
|
||||||
|
self.span_warn(span, "deprecated syntax; use the `self` keyword now");
|
||||||
|
ast::PathListMod { id: ast::DUMMY_NODE_ID }
|
||||||
|
} else if self.eat_keyword(keywords::Self) {
|
||||||
ast::PathListMod { id: ast::DUMMY_NODE_ID }
|
ast::PathListMod { id: ast::DUMMY_NODE_ID }
|
||||||
} else {
|
} else {
|
||||||
let ident = self.parse_ident();
|
let ident = self.parse_ident();
|
||||||
|
@ -2540,7 +2540,7 @@ impl<'a> State<'a> {
|
|||||||
s.print_ident(name)
|
s.print_ident(name)
|
||||||
},
|
},
|
||||||
ast::PathListMod { .. } => {
|
ast::PathListMod { .. } => {
|
||||||
word(&mut s.s, "mod")
|
word(&mut s.s, "self")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
@ -13,7 +13,7 @@ use std::cmp::PartialEq;
|
|||||||
pub trait MyNum : Add<Self,Self> + Sub<Self,Self> + Mul<Self,Self> + PartialEq + Clone {
|
pub trait MyNum : Add<Self,Self> + Sub<Self,Self> + Mul<Self,Self> + PartialEq + Clone {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
#[derive(Clone, Show)]
|
||||||
pub struct MyInt {
|
pub struct MyInt {
|
||||||
pub val: int
|
pub val: int
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ static OCCURRENCES: [&'static str;5] = [
|
|||||||
|
|
||||||
// Code implementation
|
// Code implementation
|
||||||
|
|
||||||
#[deriving(PartialEq, PartialOrd, Ord, Eq)]
|
#[derive(PartialEq, PartialOrd, Ord, Eq)]
|
||||||
struct Code(u64);
|
struct Code(u64);
|
||||||
|
|
||||||
impl Copy for Code {}
|
impl Copy for Code {}
|
||||||
|
@ -14,7 +14,7 @@ use std::os;
|
|||||||
use std::task;
|
use std::task;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
enum List<T> {
|
enum List<T> {
|
||||||
Nil, Cons(T, Box<List<T>>)
|
Nil, Cons(T, Box<List<T>>)
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#![feature(associated_types)]
|
#![feature(associated_types)]
|
||||||
#![no_implicit_prelude]
|
#![no_implicit_prelude]
|
||||||
|
|
||||||
use std::option::Option::{None, Some, mod};
|
use std::option::Option::{self, None, Some};
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
trait Iterator {
|
trait Iterator {
|
||||||
|
@ -8,4 +8,4 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Show)] //~ERROR expected item after attributes
|
#[derive(Show)] //~ERROR expected item after attributes
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct point {
|
struct point {
|
||||||
x: int,
|
x: int,
|
||||||
y: int,
|
y: int,
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct foo(Box<uint>);
|
struct foo(Box<uint>);
|
||||||
|
|
||||||
impl Add<foo, foo> for foo {
|
impl Add<foo, foo> for foo {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Copy)]
|
#[derive(Copy)]
|
||||||
struct Point {
|
struct Point {
|
||||||
x: int,
|
x: int,
|
||||||
y: int,
|
y: int,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// Test that we do not permit moves from &[] matched by a vec pattern.
|
// Test that we do not permit moves from &[] matched by a vec pattern.
|
||||||
|
|
||||||
#[deriving(Clone, Show)]
|
#[derive(Clone, Show)]
|
||||||
struct Foo {
|
struct Foo {
|
||||||
string: String
|
string: String
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ impl<T> MyTrait<T> for T { //~ ERROR E0119
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct MyType {
|
struct MyType {
|
||||||
dummy: uint
|
dummy: uint
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct foo {
|
struct foo {
|
||||||
i: int,
|
i: int,
|
||||||
}
|
}
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Copy(Bad))]
|
#[derive(Copy(Bad))]
|
||||||
//~^ ERROR unexpected value in deriving, expected a trait
|
//~^ ERROR unexpected value in deriving, expected a trait
|
||||||
struct Test;
|
struct Test;
|
||||||
|
|
||||||
#[deriving(Sync)]
|
#[derive(Sync)]
|
||||||
//~^ ERROR Sync is an unsafe trait and it should be implemented explicitly
|
//~^ ERROR Sync is an unsafe trait and it should be implemented explicitly
|
||||||
struct Test1;
|
struct Test1;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Eqr)] //~ ERROR unknown `deriving` trait: `Eqr`
|
#[derive(Eqr)] //~ ERROR unknown `derive` trait: `Eqr`
|
||||||
struct Foo;
|
struct Foo;
|
||||||
|
|
||||||
pub fn main() {}
|
pub fn main() {}
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
|
|
||||||
struct NoCloneOrEq;
|
struct NoCloneOrEq;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct E {
|
struct E {
|
||||||
x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq`
|
x: NoCloneOrEq //~ ERROR binary operation `==` cannot be applied to type `NoCloneOrEq`
|
||||||
//~^ ERROR binary operation `!=` cannot be applied to type `NoCloneOrEq`
|
//~^ ERROR binary operation `!=` cannot be applied to type `NoCloneOrEq`
|
||||||
}
|
}
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct C {
|
struct C {
|
||||||
x: NoCloneOrEq
|
x: NoCloneOrEq
|
||||||
//~^ ERROR the trait `core::clone::Clone` is not implemented for the type `NoCloneOrEq`
|
//~^ ERROR the trait `core::clone::Clone` is not implemented for the type `NoCloneOrEq`
|
||||||
|
@ -12,29 +12,29 @@
|
|||||||
|
|
||||||
struct S;
|
struct S;
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
trait T { }
|
trait T { }
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
impl S { }
|
impl S { }
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
impl T for S { }
|
impl T for S { }
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
static s: uint = 0u;
|
static s: uint = 0u;
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
const c: uint = 0u;
|
const c: uint = 0u;
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
mod m { }
|
mod m { }
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
extern "C" { }
|
extern "C" { }
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
type A = uint;
|
type A = uint;
|
||||||
|
|
||||||
#[deriving(PartialEq)] //~ ERROR: `deriving` may only be applied to structs and enums
|
#[derive(PartialEq)] //~ ERROR: `derive` may only be applied to structs and enums
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
@ -11,22 +11,22 @@
|
|||||||
use std::num::FromPrimitive;
|
use std::num::FromPrimitive;
|
||||||
use std::int;
|
use std::int;
|
||||||
|
|
||||||
#[deriving(FromPrimitive)]
|
#[derive(FromPrimitive)]
|
||||||
struct A { x: int }
|
struct A { x: int }
|
||||||
//~^^ ERROR `FromPrimitive` cannot be derived for structs
|
//~^^ ERROR `FromPrimitive` cannot be derived for structs
|
||||||
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
|
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
|
||||||
|
|
||||||
#[deriving(FromPrimitive)]
|
#[derive(FromPrimitive)]
|
||||||
struct B(int);
|
struct B(int);
|
||||||
//~^^ ERROR `FromPrimitive` cannot be derived for structs
|
//~^^ ERROR `FromPrimitive` cannot be derived for structs
|
||||||
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
|
//~^^^ ERROR `FromPrimitive` cannot be derived for structs
|
||||||
|
|
||||||
#[deriving(FromPrimitive)]
|
#[derive(FromPrimitive)]
|
||||||
enum C { Foo(int), Bar(uint) }
|
enum C { Foo(int), Bar(uint) }
|
||||||
//~^^ ERROR `FromPrimitive` cannot be derived for enum variants with arguments
|
//~^^ ERROR `FromPrimitive` cannot be derived for enum variants with arguments
|
||||||
//~^^^ ERROR `FromPrimitive` cannot be derived for enum variants with arguments
|
//~^^^ ERROR `FromPrimitive` cannot be derived for enum variants with arguments
|
||||||
|
|
||||||
#[deriving(FromPrimitive)]
|
#[derive(FromPrimitive)]
|
||||||
enum D { Baz { x: int } }
|
enum D { Baz { x: int } }
|
||||||
//~^^ ERROR `FromPrimitive` cannot be derived for enums with struct variants
|
//~^^ ERROR `FromPrimitive` cannot be derived for enums with struct variants
|
||||||
//~^^^ ERROR `FromPrimitive` cannot be derived for enums with struct variants
|
//~^^^ ERROR `FromPrimitive` cannot be derived for enums with struct variants
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Default)]
|
#[derive(Default)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR `core::default::Default` is not implemented
|
x: Error //~ ERROR `core::default::Default` is not implemented
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Default)]
|
#[derive(Default)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Hash)]
|
#[derive(Hash)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Hash)]
|
#[derive(Hash)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Hash)]
|
#[derive(Hash)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Hash)]
|
#[derive(Hash)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
//~^ ERROR
|
//~^ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
//~^ ERROR
|
//~^ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialOrd,PartialEq)]
|
#[derive(PartialOrd,PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialOrd,PartialEq)]
|
#[derive(PartialOrd,PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialOrd,PartialEq)]
|
#[derive(PartialOrd,PartialEq)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
//~^ ERROR
|
//~^ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(PartialOrd,PartialEq)]
|
#[derive(PartialOrd,PartialEq)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
//~^ ERROR
|
//~^ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Rand)]
|
#[derive(Rand)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Rand)]
|
#[derive(Rand)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Rand)]
|
#[derive(Rand)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Rand)]
|
#[derive(Rand)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
);
|
);
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Eq,PartialEq)]
|
#[derive(Eq,PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Eq,PartialEq)]
|
#[derive(Eq,PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Eq,PartialEq)]
|
#[derive(Eq,PartialEq)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Eq,PartialEq)]
|
#[derive(Eq,PartialEq)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
);
|
);
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(Eq,PartialOrd,PartialEq)]
|
#[derive(Eq,PartialOrd,PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Ord,Eq,PartialOrd,PartialEq)]
|
#[derive(Ord,Eq,PartialOrd,PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A {
|
A {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(Eq,PartialOrd,PartialEq)]
|
#[derive(Eq,PartialOrd,PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Ord,Eq,PartialOrd,PartialEq)]
|
#[derive(Ord,Eq,PartialOrd,PartialEq)]
|
||||||
enum Enum {
|
enum Enum {
|
||||||
A(
|
A(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(Eq,PartialOrd,PartialEq)]
|
#[derive(Eq,PartialOrd,PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Ord,Eq,PartialOrd,PartialEq)]
|
#[derive(Ord,Eq,PartialOrd,PartialEq)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error //~ ERROR
|
x: Error //~ ERROR
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,10 @@
|
|||||||
|
|
||||||
extern crate rand;
|
extern crate rand;
|
||||||
|
|
||||||
#[deriving(Eq,PartialOrd,PartialEq)]
|
#[derive(Eq,PartialOrd,PartialEq)]
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Ord,Eq,PartialOrd,PartialEq)]
|
#[derive(Ord,Eq,PartialOrd,PartialEq)]
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error //~ ERROR
|
Error //~ ERROR
|
||||||
);
|
);
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Zero)] //~ ERROR not implemented
|
#[derive(Zero)] //~ ERROR not implemented
|
||||||
struct Struct {
|
struct Struct {
|
||||||
x: Error
|
x: Error
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ extern crate rand;
|
|||||||
|
|
||||||
struct Error;
|
struct Error;
|
||||||
|
|
||||||
#[deriving(Zero)] //~ ERROR not implemented
|
#[derive(Zero)] //~ ERROR not implemented
|
||||||
struct Struct(
|
struct Struct(
|
||||||
Error
|
Error
|
||||||
);
|
);
|
||||||
|
@ -9,4 +9,4 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
/// hi
|
/// hi
|
||||||
#[deriving(Show)] //~ERROR expected item after attributes
|
#[derive(Show)] //~ERROR expected item after attributes
|
||||||
|
@ -16,10 +16,10 @@ struct Fat<Sized? T> {
|
|||||||
ptr: T
|
ptr: T
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq,Eq)]
|
#[derive(PartialEq,Eq)]
|
||||||
struct Bar;
|
struct Bar;
|
||||||
|
|
||||||
#[deriving(PartialEq,Eq)]
|
#[derive(PartialEq,Eq)]
|
||||||
struct Bar1 {
|
struct Bar1 {
|
||||||
f: int
|
f: int
|
||||||
}
|
}
|
||||||
|
@ -16,10 +16,10 @@ struct Fat<Sized? T> {
|
|||||||
ptr: T
|
ptr: T
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq,Eq)]
|
#[derive(PartialEq,Eq)]
|
||||||
struct Bar;
|
struct Bar;
|
||||||
|
|
||||||
#[deriving(PartialEq,Eq)]
|
#[derive(PartialEq,Eq)]
|
||||||
struct Bar1 {
|
struct Bar1 {
|
||||||
f: int
|
f: int
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ trait TraversesWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#[deriving(Show, Eq, PartialEq, Hash)]
|
#[derive(Show, Eq, PartialEq, Hash)]
|
||||||
enum RoomDirection {
|
enum RoomDirection {
|
||||||
West,
|
West,
|
||||||
East,
|
East,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct Pair<T, V> (T, V);
|
struct Pair<T, V> (T, V);
|
||||||
|
|
||||||
impl Pair<
|
impl Pair<
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct thing(uint);
|
struct thing(uint);
|
||||||
impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp`
|
impl PartialOrd for thing { //~ ERROR not all trait items implemented, missing: `partial_cmp`
|
||||||
fn le(&self, other: &thing) -> bool { true }
|
fn le(&self, other: &thing) -> bool { true }
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
let foo = 100;
|
let foo = 100;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
enum Stuff {
|
enum Stuff {
|
||||||
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
|
Bar = foo //~ ERROR attempt to use a non-constant value in a constant
|
||||||
}
|
}
|
||||||
|
@ -11,24 +11,24 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![deny(raw_pointer_deriving)]
|
#![deny(raw_pointer_deriving)]
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct Foo {
|
struct Foo {
|
||||||
x: *const int //~ ERROR use of `#[deriving]` with a raw pointer
|
x: *const int //~ ERROR use of `#[derive]` with a raw pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct Bar(*mut int); //~ ERROR use of `#[deriving]` with a raw pointer
|
struct Bar(*mut int); //~ ERROR use of `#[derive]` with a raw pointer
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
enum Baz {
|
enum Baz {
|
||||||
A(*const int), //~ ERROR use of `#[deriving]` with a raw pointer
|
A(*const int), //~ ERROR use of `#[derive]` with a raw pointer
|
||||||
B { x: *mut int } //~ ERROR use of `#[deriving]` with a raw pointer
|
B { x: *mut int } //~ ERROR use of `#[derive]` with a raw pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct Buzz {
|
struct Buzz {
|
||||||
x: (*const int, //~ ERROR use of `#[deriving]` with a raw pointer
|
x: (*const int, //~ ERROR use of `#[derive]` with a raw pointer
|
||||||
*const uint) //~ ERROR use of `#[deriving]` with a raw pointer
|
*const uint) //~ ERROR use of `#[derive]` with a raw pointer
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#![deny(unused_parens)]
|
#![deny(unused_parens)]
|
||||||
|
|
||||||
#[deriving(Eq, PartialEq)]
|
#[derive(Eq, PartialEq)]
|
||||||
struct X { y: bool }
|
struct X { y: bool }
|
||||||
impl X {
|
impl X {
|
||||||
fn foo(&self) -> bool { self.y }
|
fn foo(&self) -> bool { self.y }
|
||||||
|
@ -14,7 +14,7 @@ fn send<T:Send + std::fmt::Show>(ch: _chan<T>, data: T) {
|
|||||||
panic!();
|
panic!();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct _chan<T>(int);
|
struct _chan<T>(int);
|
||||||
|
|
||||||
// Tests that "log(debug, message);" is flagged as using
|
// Tests that "log(debug, message);" is flagged as using
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#![feature(asm)]
|
#![feature(asm)]
|
||||||
#![feature(trace_macros, concat_idents)]
|
#![feature(trace_macros, concat_idents)]
|
||||||
|
|
||||||
#[deriving(Default, //~ ERROR
|
#[derive(Default, //~ ERROR
|
||||||
Rand, //~ ERROR
|
Rand, //~ ERROR
|
||||||
Zero)] //~ ERROR
|
Zero)] //~ ERROR
|
||||||
enum CantDeriveThose {}
|
enum CantDeriveThose {}
|
||||||
|
@ -13,11 +13,11 @@
|
|||||||
use std::task;
|
use std::task;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct Port<T>(Rc<T>);
|
struct Port<T>(Rc<T>);
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct foo {
|
struct foo {
|
||||||
_x: Port<()>,
|
_x: Port<()>,
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
// Test that a class with a non-copyable field can't be
|
// Test that a class with a non-copyable field can't be
|
||||||
// copied
|
// copied
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct bar {
|
struct bar {
|
||||||
x: int,
|
x: int,
|
||||||
}
|
}
|
||||||
@ -26,7 +26,7 @@ fn bar(x:int) -> bar {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct foo {
|
struct foo {
|
||||||
i: int,
|
i: int,
|
||||||
j: bar,
|
j: bar,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
// error-pattern:non-scalar cast
|
// error-pattern:non-scalar cast
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct foo {
|
struct foo {
|
||||||
x: int
|
x: int
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ struct Foo {
|
|||||||
baz: uint
|
baz: uint
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct Oof {
|
struct Oof {
|
||||||
rab: u8,
|
rab: u8,
|
||||||
zab: uint
|
zab: uint
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct r {
|
struct r {
|
||||||
b: bool,
|
b: bool,
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct r<'a> {
|
struct r<'a> {
|
||||||
i: &'a Cell<int>,
|
i: &'a Cell<int>,
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,10 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
use self::{mod};
|
use self::{self};
|
||||||
//~^ ERROR unresolved import `self`. There is no `self` in `???`
|
//~^ ERROR unresolved import `self`. There is no `self` in `???`
|
||||||
|
|
||||||
use super::{mod};
|
use super::{self};
|
||||||
//~^ ERROR unresolved import `super`. There is no `super` in `???`
|
//~^ ERROR unresolved import `super`. There is no `super` in `???`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use foo::bar::{
|
use foo::bar::{
|
||||||
mod //~ ERROR module `bar` is private
|
self //~ ERROR module `bar` is private
|
||||||
};
|
};
|
||||||
use foo::bar::{
|
use foo::bar::{
|
||||||
Bar //~ ERROR type `Bar` is inaccessible
|
Bar //~ ERROR type `Bar` is inaccessible
|
||||||
|
@ -9,18 +9,18 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
use foo::bar::{
|
use foo::bar::{
|
||||||
mod,
|
self,
|
||||||
//~^ ERROR `mod` import can only appear once in the list
|
//~^ ERROR `self` import can only appear once in the list
|
||||||
Bar,
|
Bar,
|
||||||
mod
|
self
|
||||||
//~^ NOTE another `mod` import appears here
|
//~^ NOTE another `self` import appears here
|
||||||
};
|
};
|
||||||
|
|
||||||
use {mod};
|
use {self};
|
||||||
//~^ ERROR `mod` import can only appear in an import list with a non-empty prefix
|
//~^ ERROR `self` import can only appear in an import list with a non-empty prefix
|
||||||
|
|
||||||
use foo::mod;
|
use foo::self;
|
||||||
//~^ ERROR `mod` imports are only allowed within a { } list
|
//~^ ERROR `self` imports are only allowed within a { } list
|
||||||
|
|
||||||
mod foo {
|
mod foo {
|
||||||
pub mod bar {
|
pub mod bar {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct r {
|
struct r {
|
||||||
i:int
|
i:int
|
||||||
}
|
}
|
||||||
|
@ -73,13 +73,13 @@
|
|||||||
|
|
||||||
#![omit_gdb_pretty_printer_section]
|
#![omit_gdb_pretty_printer_section]
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
a: int,
|
a: int,
|
||||||
b: f64
|
b: f64
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct StructStruct {
|
struct StructStruct {
|
||||||
a: Struct,
|
a: Struct,
|
||||||
b: Struct
|
b: Struct
|
||||||
|
@ -105,21 +105,21 @@ use self::AutoDiscriminant::{One, Two, Three};
|
|||||||
use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};
|
use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};
|
||||||
use self::SingleVariant::TheOnlyVariant;
|
use self::SingleVariant::TheOnlyVariant;
|
||||||
|
|
||||||
#[deriving(Copy)]
|
#[derive(Copy)]
|
||||||
enum AutoDiscriminant {
|
enum AutoDiscriminant {
|
||||||
One,
|
One,
|
||||||
Two,
|
Two,
|
||||||
Three
|
Three
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Copy)]
|
#[derive(Copy)]
|
||||||
enum ManualDiscriminant {
|
enum ManualDiscriminant {
|
||||||
OneHundred = 100,
|
OneHundred = 100,
|
||||||
OneThousand = 1000,
|
OneThousand = 1000,
|
||||||
OneMillion = 1000000
|
OneMillion = 1000000
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Copy)]
|
#[derive(Copy)]
|
||||||
enum SingleVariant {
|
enum SingleVariant {
|
||||||
TheOnlyVariant
|
TheOnlyVariant
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
#![omit_gdb_pretty_printer_section]
|
#![omit_gdb_pretty_printer_section]
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct Struct {
|
struct Struct {
|
||||||
a: int,
|
a: int,
|
||||||
b: f64
|
b: f64
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[repr(packed)]
|
#[repr(packed)]
|
||||||
#[deriving(PartialEq, Show)]
|
#[derive(PartialEq, Show)]
|
||||||
struct Foo {
|
struct Foo {
|
||||||
a: i8,
|
a: i8,
|
||||||
b: i16,
|
b: i16,
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
|
|
||||||
extern crate serialize;
|
extern crate serialize;
|
||||||
|
|
||||||
#[deriving(Encodable)] pub struct A;
|
#[derive(Encodable)] pub struct A;
|
||||||
#[deriving(Encodable)] pub struct B(int);
|
#[derive(Encodable)] pub struct B(int);
|
||||||
#[deriving(Encodable)] pub struct C { x: int }
|
#[derive(Encodable)] pub struct C { x: int }
|
||||||
#[deriving(Encodable)] pub enum D {}
|
#[derive(Encodable)] pub enum D {}
|
||||||
#[deriving(Encodable)] pub enum E { y }
|
#[derive(Encodable)] pub enum E { y }
|
||||||
#[deriving(Encodable)] pub enum F { z(int) }
|
#[derive(Encodable)] pub enum F { z(int) }
|
||||||
|
@ -10,16 +10,16 @@
|
|||||||
|
|
||||||
#![crate_name="foo"]
|
#![crate_name="foo"]
|
||||||
|
|
||||||
/// The '# ' lines should be removed from the output, but the #[deriving] should be
|
/// The '# ' lines should be removed from the output, but the #[derive] should be
|
||||||
/// retained.
|
/// retained.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// mod to_make_deriving_work { // FIXME #4913
|
/// mod to_make_deriving_work { // FIXME #4913
|
||||||
///
|
///
|
||||||
/// # #[deriving(PartialEq)] // invisible
|
/// # #[derive(PartialEq)] // invisible
|
||||||
/// # struct Foo; // invisible
|
/// # struct Foo; // invisible
|
||||||
///
|
///
|
||||||
/// #[deriving(PartialEq)] // Bar
|
/// #[derive(PartialEq)] // Bar
|
||||||
/// struct Bar(Foo);
|
/// struct Bar(Foo);
|
||||||
///
|
///
|
||||||
/// fn test() {
|
/// fn test() {
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
file="$1/doc/foo/fn.foo.html"
|
file="$1/doc/foo/fn.foo.html"
|
||||||
|
|
||||||
grep -v 'invisible' $file &&
|
grep -v 'invisible' $file &&
|
||||||
grep '#.*\[.*deriving.*(.*Eq.*).*\].*//.*Bar' $file
|
grep '#.*\[.*derive.*(.*Eq.*).*\].*//.*Bar' $file
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
extern crate macro_crate_test;
|
extern crate macro_crate_test;
|
||||||
|
|
||||||
#[into_foo]
|
#[into_foo]
|
||||||
#[deriving(PartialEq, Clone, Show)]
|
#[derive(PartialEq, Clone, Show)]
|
||||||
fn foo() -> AFakeTypeThatHadBetterGoAway {}
|
fn foo() -> AFakeTypeThatHadBetterGoAway {}
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
@ -33,7 +33,7 @@ fn syntax_extension(cx: &ExtCtxt) {
|
|||||||
let _g: P<syntax::ast::Expr> = quote_expr!(cx, true);
|
let _g: P<syntax::ast::Expr> = quote_expr!(cx, true);
|
||||||
let _h: P<syntax::ast::Expr> = quote_expr!(cx, 'a');
|
let _h: P<syntax::ast::Expr> = quote_expr!(cx, 'a');
|
||||||
|
|
||||||
let i: Option<P<syntax::ast::Item>> = quote_item!(cx, #[deriving(Eq)] struct Foo; );
|
let i: Option<P<syntax::ast::Item>> = quote_item!(cx, #[derive(Eq)] struct Foo; );
|
||||||
assert!(i.is_some());
|
assert!(i.is_some());
|
||||||
|
|
||||||
let _j: P<syntax::ast::Method> = quote_method!(cx, fn foo(&self) {});
|
let _j: P<syntax::ast::Method> = quote_method!(cx, fn foo(&self) {});
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
#[derive(PartialEq, Show)]
|
||||||
struct Point { x : int }
|
struct Point { x : int }
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
@ -41,7 +41,7 @@ fn test_rbml<'a, 'b, A:
|
|||||||
assert!(*a1 == a2);
|
assert!(*a1 == a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Decodable, Encodable)]
|
#[derive(Decodable, Encodable)]
|
||||||
enum Expr {
|
enum Expr {
|
||||||
Val(uint),
|
Val(uint),
|
||||||
Plus(@Expr, @Expr),
|
Plus(@Expr, @Expr),
|
||||||
@ -108,26 +108,26 @@ impl cmp::Eq for CLike {
|
|||||||
fn ne(&self, other: &CLike) -> bool { !self.eq(other) }
|
fn ne(&self, other: &CLike) -> bool { !self.eq(other) }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Decodable, Encodable, Eq)]
|
#[derive(Decodable, Encodable, Eq)]
|
||||||
struct Spanned<T> {
|
struct Spanned<T> {
|
||||||
lo: uint,
|
lo: uint,
|
||||||
hi: uint,
|
hi: uint,
|
||||||
node: T,
|
node: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Decodable, Encodable)]
|
#[derive(Decodable, Encodable)]
|
||||||
struct SomeStruct { v: Vec<uint> }
|
struct SomeStruct { v: Vec<uint> }
|
||||||
|
|
||||||
#[deriving(Decodable, Encodable)]
|
#[derive(Decodable, Encodable)]
|
||||||
struct Point {x: uint, y: uint}
|
struct Point {x: uint, y: uint}
|
||||||
|
|
||||||
#[deriving(Decodable, Encodable)]
|
#[derive(Decodable, Encodable)]
|
||||||
enum Quark<T> {
|
enum Quark<T> {
|
||||||
Top(T),
|
Top(T),
|
||||||
Bottom(T)
|
Bottom(T)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Decodable, Encodable)]
|
#[derive(Decodable, Encodable)]
|
||||||
enum CLike { A, B, C }
|
enum CLike { A, B, C }
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct Pair<T, U> { a: T, b: U }
|
struct Pair<T, U> { a: T, b: U }
|
||||||
struct Triple { x: int, y: int, z: int }
|
struct Triple { x: int, y: int, z: int }
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ fn test_ptr() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
#[derive(PartialEq, Show)]
|
||||||
struct p {
|
struct p {
|
||||||
x: int,
|
x: int,
|
||||||
y: int,
|
y: int,
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
use std::mem::swap;
|
use std::mem::swap;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
struct Ints {sum: Box<int>, values: Vec<int> }
|
struct Ints {sum: Box<int>, values: Vec<int> }
|
||||||
|
|
||||||
fn add_int(x: &mut Ints, v: int) {
|
fn add_int(x: &mut Ints, v: int) {
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
extern crate trait_superkinds_in_metadata;
|
extern crate trait_superkinds_in_metadata;
|
||||||
use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare};
|
use trait_superkinds_in_metadata::{RequiresRequiresShareAndSend, RequiresShare};
|
||||||
|
|
||||||
#[deriving(PartialEq)]
|
#[derive(PartialEq)]
|
||||||
struct X<T>(T);
|
struct X<T>(T);
|
||||||
|
|
||||||
impl <T: Sync> RequiresShare for X<T> { }
|
impl <T: Sync> RequiresShare for X<T> { }
|
||||||
|
@ -47,7 +47,7 @@ fn dog() -> dog {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct cat {
|
struct cat {
|
||||||
meows: uint,
|
meows: uint,
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
#[deriving(Show)]
|
#[derive(Show)]
|
||||||
enum cat_type { tuxedo, tabby, tortoiseshell }
|
enum cat_type { tuxedo, tabby, tortoiseshell }
|
||||||
|
|
||||||
impl Copy for cat_type {}
|
impl Copy for cat_type {}
|
||||||
|
@ -13,7 +13,7 @@ trait noisy {
|
|||||||
fn speak(&mut self);
|
fn speak(&mut self);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Clone)]
|
#[derive(Clone)]
|
||||||
struct cat {
|
struct cat {
|
||||||
meows : uint,
|
meows : uint,
|
||||||
|
|
||||||
|
@ -14,10 +14,10 @@ fn id<T>(x: T) -> T {
|
|||||||
x
|
x
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
#[derive(PartialEq, Show)]
|
||||||
struct Foo<T>(T);
|
struct Foo<T>(T);
|
||||||
|
|
||||||
#[deriving(PartialEq, Show)]
|
#[derive(PartialEq, Show)]
|
||||||
enum Bar<T> {
|
enum Bar<T> {
|
||||||
Baz(T)
|
Baz(T)
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user