From b88f86782ecd9319e0e2c875bbf1efecd66ebf41 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Fri, 12 Sep 2014 10:45:39 -0400 Subject: [PATCH] Update error messages in compile-fail tests --- .../compile-fail/bad-method-typaram-kind.rs | 2 +- src/test/compile-fail/bad-sized.rs | 8 ++-- .../builtin-superkinds-double-superkind.rs | 4 +- .../builtin-superkinds-in-metadata.rs | 3 +- .../builtin-superkinds-self-type.rs | 6 +-- .../compile-fail/builtin-superkinds-simple.rs | 2 +- .../builtin-superkinds-typaram-not-send.rs | 2 +- src/test/compile-fail/comm-not-freeze.rs | 6 +-- .../conflicting-implementations-aux.rs | 5 +-- .../conflicting-implementations.rs | 5 +-- .../deriving-span-Default-struct.rs | 2 +- .../compile-fail/deriving-span-Zero-struct.rs | 6 +-- .../deriving-span-Zero-tuple-struct.rs | 6 +-- src/test/compile-fail/drop-on-non-struct.rs | 9 ++-- src/test/compile-fail/dst-bad-assign-2.rs | 4 +- src/test/compile-fail/dst-bad-assign.rs | 1 + src/test/compile-fail/dst-bad-coerce1.rs | 2 +- src/test/compile-fail/dst-bad-coerce2.rs | 4 +- src/test/compile-fail/dst-bad-coercions.rs | 7 ++- src/test/compile-fail/dst-bad-deep.rs | 3 +- .../compile-fail/dst-sized-trait-param.rs | 23 ++++++++++ .../error-should-say-copy-not-pod.rs | 2 +- src/test/compile-fail/ifmt-unimpl.rs | 2 +- src/test/compile-fail/impl-bounds-checking.rs | 2 +- src/test/compile-fail/issue-14915.rs | 4 +- src/test/compile-fail/issue-3907-2.rs | 2 +- src/test/compile-fail/issue-5035-2.rs | 2 +- src/test/compile-fail/issue-5883.rs | 7 ++- src/test/compile-fail/issue-6458-2.rs | 3 +- src/test/compile-fail/issue-7013.rs | 7 +-- src/test/compile-fail/kindck-copy.rs | 26 +++++------ .../compile-fail/kindck-impl-type-params-2.rs | 2 +- .../compile-fail/kindck-impl-type-params.rs | 18 ++++---- .../kindck-inherited-copy-bound.rs | 4 +- src/test/compile-fail/kindck-proc-bounds.rs | 4 +- src/test/compile-fail/kindck-send-object.rs | 9 ++-- src/test/compile-fail/kindck-send-object1.rs | 3 ++ src/test/compile-fail/kindck-send-object2.rs | 4 +- .../kindck-send-unsafe.rs~rust-lang_master | 22 +++++++++ src/test/compile-fail/map-types.rs | 3 +- src/test/compile-fail/marker-no-copy.rs | 2 +- src/test/compile-fail/marker-no-send.rs | 2 +- src/test/compile-fail/marker-no-share.rs | 2 +- src/test/compile-fail/mut-not-freeze.rs | 2 +- .../compile-fail/mutable-enum-indirect.rs | 2 +- src/test/compile-fail/no-send-res-ports.rs | 3 +- src/test/compile-fail/no_send-enum.rs | 3 +- src/test/compile-fail/no_send-rc.rs | 3 +- src/test/compile-fail/no_send-struct.rs | 3 +- src/test/compile-fail/no_share-enum.rs | 3 +- src/test/compile-fail/no_share-rc.rs | 3 +- src/test/compile-fail/no_share-struct.rs | 3 +- .../object-does-not-impl-trait.rs | 4 +- src/test/compile-fail/pinned-deep-copy.rs | 3 +- .../regions-bound-missing-bound-in-impl.rs | 2 - .../compile-fail/regions-bounded-by-send.rs | 3 ++ .../regions-bounded-method-type-parameters.rs | 2 - .../regions-escape-via-trait-or-not.rs | 2 - .../regions-lifetime-bounds-on-fns.rs | 2 - .../compile-fail/repeat-to-run-dtor-twice.rs | 3 +- .../compile-fail/task-rng-isnt-sendable.rs | 2 +- .../trait-bounds-not-on-bare-trait.rs | 2 +- ...rait-bounds-on-structs-and-enums-locals.rs | 7 ++- ...rait-bounds-on-structs-and-enums-static.rs | 3 +- .../trait-bounds-on-structs-and-enums-xc.rs | 15 +------ .../trait-bounds-on-structs-and-enums-xc1.rs | 26 +++++++++++ .../trait-bounds-on-structs-and-enums.rs | 31 +++++-------- .../trait-coercion-generic-bad.rs | 3 +- .../type-params-in-different-spaces-2.rs | 4 +- .../typeck-unsafe-always-share.rs | 2 +- .../unboxed-closures-vtable-mismatch.rs | 3 +- .../unboxed-closures-wrong-trait.rs | 2 +- src/test/compile-fail/unique-pinned-nocopy.rs | 3 +- src/test/compile-fail/unique-unique-kind.rs | 2 +- src/test/compile-fail/unique-vec-res.rs | 6 +-- src/test/compile-fail/unsendable-class.rs | 4 +- src/test/compile-fail/unsized-bare-typaram.rs | 3 +- src/test/compile-fail/unsized-enum.rs | 11 ++++- src/test/compile-fail/unsized-struct.rs | 7 ++- src/test/compile-fail/unsized3.rs | 45 ++++++------------- src/test/compile-fail/unsized6.rs | 32 ++++++------- src/test/compile-fail/unsized7.rs | 43 ++++++++++++++++++ src/test/compile-fail/vec-res-add.rs | 4 +- .../compile-fail/vtable-res-trait-param.rs | 3 +- .../compile-fail/where-clauses-unsatisfied.rs | 5 +-- src/test/run-pass/drop-struct-as-object.rs | 42 +++++++++++++++++ .../run-pass/object-one-type-two-traits.rs | 39 ++++++++++++++++ 87 files changed, 381 insertions(+), 256 deletions(-) create mode 100644 src/test/compile-fail/dst-sized-trait-param.rs create mode 100644 src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master create mode 100644 src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs create mode 100644 src/test/compile-fail/unsized7.rs create mode 100644 src/test/run-pass/drop-struct-as-object.rs create mode 100644 src/test/run-pass/object-one-type-two-traits.rs diff --git a/src/test/compile-fail/bad-method-typaram-kind.rs b/src/test/compile-fail/bad-method-typaram-kind.rs index b63ecc6b66f..cf07dc02b96 100644 --- a/src/test/compile-fail/bad-method-typaram-kind.rs +++ b/src/test/compile-fail/bad-method-typaram-kind.rs @@ -9,7 +9,7 @@ // except according to those terms. fn foo() { - 1u.bar::(); //~ ERROR: does not fulfill `Send` + 1u.bar::(); //~ ERROR `core::kinds::Send` is not implemented } trait bar { diff --git a/src/test/compile-fail/bad-sized.rs b/src/test/compile-fail/bad-sized.rs index fb9a060cb60..4e0ad8088be 100644 --- a/src/test/compile-fail/bad-sized.rs +++ b/src/test/compile-fail/bad-sized.rs @@ -16,10 +16,8 @@ trait Trait {} pub fn main() { let x: Vec = Vec::new(); - //~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized` - //~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized` - //~^^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized` + //~^ ERROR the trait `core::kinds::Sized` is not implemented + //~^^ ERROR the trait `core::kinds::Sized` is not implemented let x: Vec>> = Vec::new(); - //~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized` - //~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized` + //~^ ERROR the trait `core::kinds::Sized` is not implemented } diff --git a/src/test/compile-fail/builtin-superkinds-double-superkind.rs b/src/test/compile-fail/builtin-superkinds-double-superkind.rs index d5a648e3e20..f3b9c395e45 100644 --- a/src/test/compile-fail/builtin-superkinds-double-superkind.rs +++ b/src/test/compile-fail/builtin-superkinds-double-superkind.rs @@ -13,9 +13,9 @@ trait Foo : Send+Sync { } -impl Foo for (T,) { } //~ ERROR cannot implement this trait +impl Foo for (T,) { } //~ ERROR the trait `core::kinds::Send` is not implemented -impl Foo for (T,T) { } //~ ERROR cannot implement this trait +impl Foo for (T,T) { } //~ ERROR the trait `core::kinds::Sync` is not implemented impl Foo for (T,T,T) { } // (ok) diff --git a/src/test/compile-fail/builtin-superkinds-in-metadata.rs b/src/test/compile-fail/builtin-superkinds-in-metadata.rs index 889d82383e7..76835c9955f 100644 --- a/src/test/compile-fail/builtin-superkinds-in-metadata.rs +++ b/src/test/compile-fail/builtin-superkinds-in-metadata.rs @@ -21,6 +21,7 @@ struct X(T); impl RequiresShare for X { } -impl RequiresRequiresShareAndSend for X { } //~ ERROR cannot implement this trait +impl RequiresRequiresShareAndSend for X { } +//~^ ERROR the trait `core::kinds::Send` is not implemented fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-self-type.rs b/src/test/compile-fail/builtin-superkinds-self-type.rs index 726413981a5..86d3d7e9cbc 100644 --- a/src/test/compile-fail/builtin-superkinds-self-type.rs +++ b/src/test/compile-fail/builtin-superkinds-self-type.rs @@ -12,12 +12,12 @@ // to use capabilities granted by builtin kinds as supertraits. trait Foo : Sync+'static { - fn foo(self, mut chan: Sender) { - chan.send(self); //~ ERROR does not fulfill `Send` - } + fn foo(self, mut chan: Sender) { } } impl Foo for T { } +//~^ ERROR the parameter type `T` may not live long enough +//~^^ ERROR the parameter type `T` may not live long enough fn main() { let (tx, rx) = channel(); diff --git a/src/test/compile-fail/builtin-superkinds-simple.rs b/src/test/compile-fail/builtin-superkinds-simple.rs index caf96861292..fda83c03a7d 100644 --- a/src/test/compile-fail/builtin-superkinds-simple.rs +++ b/src/test/compile-fail/builtin-superkinds-simple.rs @@ -14,6 +14,6 @@ trait Foo : Send { } impl <'a> Foo for &'a mut () { } -//~^ ERROR which does not fulfill `Send`, cannot implement this trait +//~^ ERROR does not fulfill the required lifetime fn main() { } diff --git a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs index 166ca10ee18..e77177f7f6d 100644 --- a/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs +++ b/src/test/compile-fail/builtin-superkinds-typaram-not-send.rs @@ -12,6 +12,6 @@ trait Foo : Send { } -impl Foo for T { } //~ ERROR cannot implement this trait +impl Foo for T { } //~ ERROR the trait `core::kinds::Send` is not implemented fn main() { } diff --git a/src/test/compile-fail/comm-not-freeze.rs b/src/test/compile-fail/comm-not-freeze.rs index 5820818167c..b6277a3e2bd 100644 --- a/src/test/compile-fail/comm-not-freeze.rs +++ b/src/test/compile-fail/comm-not-freeze.rs @@ -11,7 +11,7 @@ fn test() {} fn main() { - test::>(); //~ ERROR: does not fulfill `Sync` - test::>(); //~ ERROR: does not fulfill `Sync` - test::>(); //~ ERROR: does not fulfill `Sync` + test::>(); //~ ERROR: `core::kinds::Sync` is not implemented + test::>(); //~ ERROR: `core::kinds::Sync` is not implemented + test::>(); //~ ERROR: `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/conflicting-implementations-aux.rs b/src/test/compile-fail/conflicting-implementations-aux.rs index 6c7722bbd25..c1aa6ccd9bd 100644 --- a/src/test/compile-fail/conflicting-implementations-aux.rs +++ b/src/test/compile-fail/conflicting-implementations-aux.rs @@ -15,10 +15,7 @@ extern crate trait_impl_conflict; use trait_impl_conflict::Foo; -impl Foo for A { -//~^ ERROR conflicting implementations for trait `trait_impl_conflict::Foo` -//~^^ ERROR cannot provide an extension implementation where both trait and type -// are not defined in this crate +impl Foo for A { //~ ERROR E0117 } fn main() { diff --git a/src/test/compile-fail/conflicting-implementations.rs b/src/test/compile-fail/conflicting-implementations.rs index 598da145b92..b5a04491111 100644 --- a/src/test/compile-fail/conflicting-implementations.rs +++ b/src/test/compile-fail/conflicting-implementations.rs @@ -8,15 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: conflicting implementations for trait `Foo` trait Foo { } -impl Foo for int { +impl Foo for int { //~ ERROR conflicting implementations } -impl Foo for A { +impl Foo for A { //~ NOTE conflicting implementation here } diff --git a/src/test/compile-fail/deriving-span-Default-struct.rs b/src/test/compile-fail/deriving-span-Default-struct.rs index 90d567bfd5d..1da88f2e257 100644 --- a/src/test/compile-fail/deriving-span-Default-struct.rs +++ b/src/test/compile-fail/deriving-span-Default-struct.rs @@ -18,7 +18,7 @@ struct Error; #[deriving(Default)] struct Struct { - x: Error //~ ERROR + x: Error //~ ERROR `core::default::Default` is not implemented } fn main() {} diff --git a/src/test/compile-fail/deriving-span-Zero-struct.rs b/src/test/compile-fail/deriving-span-Zero-struct.rs index fec1b3ed492..fb7759c6032 100644 --- a/src/test/compile-fail/deriving-span-Zero-struct.rs +++ b/src/test/compile-fail/deriving-span-Zero-struct.rs @@ -16,11 +16,9 @@ extern crate rand; struct Error; -#[deriving(Zero)] //~ ERROR failed to find an implementation +#[deriving(Zero)] //~ ERROR not implemented struct Struct { - x: Error //~ ERROR failed to find an implementation - //~^ ERROR failed to find an implementation - //~^^ ERROR type `Error` does not implement any method in scope + x: Error } fn main() {} diff --git a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs index 0661e5ee8b2..193e4b5c6b2 100644 --- a/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs +++ b/src/test/compile-fail/deriving-span-Zero-tuple-struct.rs @@ -16,11 +16,9 @@ extern crate rand; struct Error; -#[deriving(Zero)] //~ ERROR failed to find an implementation +#[deriving(Zero)] //~ ERROR not implemented struct Struct( - Error //~ ERROR - //~^ ERROR failed to find an implementation - //~^^ ERROR type `Error` does not implement any method in scope + Error ); fn main() {} diff --git a/src/test/compile-fail/drop-on-non-struct.rs b/src/test/compile-fail/drop-on-non-struct.rs index af4c12c754b..8304afa1141 100644 --- a/src/test/compile-fail/drop-on-non-struct.rs +++ b/src/test/compile-fail/drop-on-non-struct.rs @@ -8,12 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - - -type Foo = Vec; - -impl Drop for Foo { -//~^ ERROR cannot provide an extension implementation +impl Drop for int { + //~^ ERROR the Drop trait may only be implemented on structures + //~^^ ERROR cannot provide an extension implementation fn drop(&mut self) { println!("kaboom"); } diff --git a/src/test/compile-fail/dst-bad-assign-2.rs b/src/test/compile-fail/dst-bad-assign-2.rs index 76becdc855d..112a424427a 100644 --- a/src/test/compile-fail/dst-bad-assign-2.rs +++ b/src/test/compile-fail/dst-bad-assign-2.rs @@ -42,6 +42,6 @@ pub fn main() { // Assignment. let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; let z: Box = box Bar1 {f: 36}; - f5.ptr = *z; //~ ERROR dynamically sized type on lhs of assignment - //~^ ERROR E0161 + f5.ptr = *z; + //~^ ERROR the trait `core::kinds::Sized` is not implemented } diff --git a/src/test/compile-fail/dst-bad-assign.rs b/src/test/compile-fail/dst-bad-assign.rs index 17149941a7e..f18f4a36640 100644 --- a/src/test/compile-fail/dst-bad-assign.rs +++ b/src/test/compile-fail/dst-bad-assign.rs @@ -43,4 +43,5 @@ pub fn main() { let f5: &mut Fat = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; let z: Box = box Bar1 {f: 36}; f5.ptr = Bar1 {f: 36}; //~ ERROR mismatched types: expected `ToBar`, found `Bar1` + //~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `ToBar` } diff --git a/src/test/compile-fail/dst-bad-coerce1.rs b/src/test/compile-fail/dst-bad-coerce1.rs index a609740eaeb..4247f91a4fc 100644 --- a/src/test/compile-fail/dst-bad-coerce1.rs +++ b/src/test/compile-fail/dst-bad-coerce1.rs @@ -28,5 +28,5 @@ pub fn main() { let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; let f3: &Fat = f2; - //~^ ERROR failed to find an implementation of trait Bar for Foo + //~^ ERROR the trait `Bar` is not implemented for the type `Foo` } diff --git a/src/test/compile-fail/dst-bad-coerce2.rs b/src/test/compile-fail/dst-bad-coerce2.rs index 118e4ce7e08..e1a754b6332 100644 --- a/src/test/compile-fail/dst-bad-coerce2.rs +++ b/src/test/compile-fail/dst-bad-coerce2.rs @@ -22,10 +22,10 @@ pub fn main() { // With a vec of ints. let f1 = Fat { ptr: [1, 2, 3] }; let f2: &Fat<[int, ..3]> = &f1; - let f3: &mut Fat<[int]> = f2; //~ ERROR cannot borrow immutable dereference + let f3: &mut Fat<[int]> = f2; //~ ERROR mismatched types // With a trait. let f1 = Fat { ptr: Foo }; let f2: &Fat = &f1; - let f3: &mut Fat = f2; //~ ERROR cannot borrow immutable dereference + let f3: &mut Fat = f2; //~ ERROR mismatched types } diff --git a/src/test/compile-fail/dst-bad-coercions.rs b/src/test/compile-fail/dst-bad-coercions.rs index cc5d3b520f9..c3a814e3f44 100644 --- a/src/test/compile-fail/dst-bad-coercions.rs +++ b/src/test/compile-fail/dst-bad-coercions.rs @@ -30,10 +30,9 @@ pub fn main() { let y: &T = x; //~ ERROR mismatched types // Test that we cannot convert an immutable ptr to a mutable one using *-ptrs - let x: &mut T = &S; //~ ERROR types differ in mutability - let x: *mut T = &S; //~ ERROR types differ in mutability - let x: *mut S = &S; - //~^ ERROR mismatched types + let x: &mut T = &S; //~ ERROR mismatched types + let x: *mut T = &S; //~ ERROR mismatched types + let x: *mut S = &S; //~ ERROR mismatched types // The below four sets of tests test that we cannot implicitly deref a *-ptr // during a coercion. diff --git a/src/test/compile-fail/dst-bad-deep.rs b/src/test/compile-fail/dst-bad-deep.rs index e2e387e1a48..506322d41f5 100644 --- a/src/test/compile-fail/dst-bad-deep.rs +++ b/src/test/compile-fail/dst-bad-deep.rs @@ -21,6 +21,5 @@ pub fn main() { let f: Fat<[int, ..3]> = Fat { ptr: [5i, 6, 7] }; let g: &Fat<[int]> = &f; let h: &Fat> = &Fat { ptr: *g }; - //~^ ERROR trying to initialise a dynamically sized struct - //~^^ ERROR E0161 + //~^ ERROR the trait `core::kinds::Sized` is not implemented } diff --git a/src/test/compile-fail/dst-sized-trait-param.rs b/src/test/compile-fail/dst-sized-trait-param.rs new file mode 100644 index 00000000000..750b475adb2 --- /dev/null +++ b/src/test/compile-fail/dst-sized-trait-param.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Check that when you implement a trait that has a sized type +// parameter, the corresponding value must be sized. Also that the +// self type must be sized if appropriate. + +trait Foo { fn take(self, x: &T) { } } // Note: T is sized + +impl Foo<[int]> for uint { } +//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[int]` + +impl Foo for [uint] { } +//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[uint]` + +pub fn main() { } diff --git a/src/test/compile-fail/error-should-say-copy-not-pod.rs b/src/test/compile-fail/error-should-say-copy-not-pod.rs index 9186dada780..3d25c7ee772 100644 --- a/src/test/compile-fail/error-should-say-copy-not-pod.rs +++ b/src/test/compile-fail/error-should-say-copy-not-pod.rs @@ -13,5 +13,5 @@ fn check_bound(_: T) {} fn main() { - check_bound("nocopy".to_string()); //~ ERROR does not fulfill `Copy` + check_bound("nocopy".to_string()); //~ ERROR the trait `core::kinds::Copy` is not implemented } diff --git a/src/test/compile-fail/ifmt-unimpl.rs b/src/test/compile-fail/ifmt-unimpl.rs index 897717971bc..194047ce848 100644 --- a/src/test/compile-fail/ifmt-unimpl.rs +++ b/src/test/compile-fail/ifmt-unimpl.rs @@ -10,5 +10,5 @@ fn main() { format!("{:d}", "3"); - //~^ ERROR: failed to find an implementation of trait core::fmt::Signed + //~^ ERROR: the trait `core::fmt::Signed` is not implemented } diff --git a/src/test/compile-fail/impl-bounds-checking.rs b/src/test/compile-fail/impl-bounds-checking.rs index 00c415a860d..69a35bcbd7b 100644 --- a/src/test/compile-fail/impl-bounds-checking.rs +++ b/src/test/compile-fail/impl-bounds-checking.rs @@ -17,7 +17,7 @@ trait Getter { fn get(&self) -> T; } -impl Getter for int { //~ ERROR failed to find an implementation of trait Clone2 for int +impl Getter for int { //~ ERROR the trait `Clone2` is not implemented fn get(&self) -> int { *self } } diff --git a/src/test/compile-fail/issue-14915.rs b/src/test/compile-fail/issue-14915.rs index 3754d669be6..75b9626a659 100644 --- a/src/test/compile-fail/issue-14915.rs +++ b/src/test/compile-fail/issue-14915.rs @@ -15,8 +15,8 @@ fn main() { let y: Gc = box (GC) 0; println!("{}", x + 1); //~ ERROR binary operation `+` cannot be applied to type `Box` - //~^ ERROR cannot determine a type for this bounded type parameter: unconstrained type + //~^ ERROR unable to infer enough type information println!("{}", y + 1); //~^ ERROR binary operation `+` cannot be applied to type `Gc` - //~^^ ERROR cannot determine a type for this bounded type parameter: unconstrained type + //~^^ ERROR unable to infer enough type information } diff --git a/src/test/compile-fail/issue-3907-2.rs b/src/test/compile-fail/issue-3907-2.rs index 71f91050256..981abf6cc23 100644 --- a/src/test/compile-fail/issue-3907-2.rs +++ b/src/test/compile-fail/issue-3907-2.rs @@ -17,6 +17,6 @@ struct S { name: int } -fn bar(_x: Foo) {} //~ ERROR variable `_x` has dynamically sized type +fn bar(_x: Foo) {} //~ ERROR the trait `core::kinds::Sized` is not implemented fn main() {} diff --git a/src/test/compile-fail/issue-5035-2.rs b/src/test/compile-fail/issue-5035-2.rs index 0251a06c5bd..d0830ff8e4d 100644 --- a/src/test/compile-fail/issue-5035-2.rs +++ b/src/test/compile-fail/issue-5035-2.rs @@ -11,6 +11,6 @@ trait I {} type K = I+'static; -fn foo(_x: K) {} //~ ERROR: variable `_x` has dynamically sized type +fn foo(_x: K) {} //~ ERROR: the trait `core::kinds::Sized` is not implemented fn main() {} diff --git a/src/test/compile-fail/issue-5883.rs b/src/test/compile-fail/issue-5883.rs index 7ea282c599f..71b1bcd69da 100644 --- a/src/test/compile-fail/issue-5883.rs +++ b/src/test/compile-fail/issue-5883.rs @@ -15,10 +15,9 @@ struct Struct { } fn new_struct(r: A+'static) -> Struct { - //~^ ERROR variable `r` has dynamically sized type - Struct { r: r } //~ ERROR trying to initialise a dynamically sized struct - //~^ ERROR E0161 - //~^^ ERROR E0161 + //~^ ERROR the trait `core::kinds::Sized` is not implemented + Struct { r: r } + //~^ ERROR the trait `core::kinds::Sized` is not implemented } trait Curve {} diff --git a/src/test/compile-fail/issue-6458-2.rs b/src/test/compile-fail/issue-6458-2.rs index f302472d070..701bee85fd7 100644 --- a/src/test/compile-fail/issue-6458-2.rs +++ b/src/test/compile-fail/issue-6458-2.rs @@ -11,5 +11,6 @@ extern crate debug; fn main() { - format!("{:?}", None); //~ ERROR: cannot determine a type for this bounded + // Unconstrained type: + format!("{:?}", None); //~ ERROR: E0101 } diff --git a/src/test/compile-fail/issue-7013.rs b/src/test/compile-fail/issue-7013.rs index ef585998aa5..3d16ff0a3fa 100644 --- a/src/test/compile-fail/issue-7013.rs +++ b/src/test/compile-fail/issue-7013.rs @@ -32,10 +32,5 @@ struct A { fn main() { let a = A {v: box B{v: None} as Box}; - //~^ ERROR cannot pack type `Box`, which does not fulfill `Send`, as a trait bounded by Send - let v = Rc::new(RefCell::new(a)); - let w = v.clone(); - let b = &*v; - let mut b = b.borrow_mut(); - b.v.set(w.clone()); + //~^ ERROR the trait `core::kinds::Send` is not implemented for the type `B` } diff --git a/src/test/compile-fail/kindck-copy.rs b/src/test/compile-fail/kindck-copy.rs index 2ca171ed998..3524d11d184 100644 --- a/src/test/compile-fail/kindck-copy.rs +++ b/src/test/compile-fail/kindck-copy.rs @@ -34,14 +34,14 @@ fn test<'a,T,U:Copy>(_: &'a int) { assert_copy::<&'a [int]>(); // ...unless they are mutable - assert_copy::<&'static mut int>(); //~ ERROR does not fulfill - assert_copy::<&'a mut int>(); //~ ERROR does not fulfill + assert_copy::<&'static mut int>(); //~ ERROR `core::kinds::Copy` is not implemented + assert_copy::<&'a mut int>(); //~ ERROR `core::kinds::Copy` is not implemented // ~ pointers are not ok - assert_copy::>(); //~ ERROR does not fulfill - assert_copy::(); //~ ERROR does not fulfill - assert_copy:: >(); //~ ERROR does not fulfill - assert_copy::>(); //~ ERROR does not fulfill + assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented + assert_copy::(); //~ ERROR `core::kinds::Copy` is not implemented + assert_copy:: >(); //~ ERROR `core::kinds::Copy` is not implemented + assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented // borrowed object types are generally ok assert_copy::<&'a Dummy>(); @@ -49,14 +49,14 @@ fn test<'a,T,U:Copy>(_: &'a int) { assert_copy::<&'static Dummy+Copy>(); // owned object types are not ok - assert_copy::>(); //~ ERROR does not fulfill - assert_copy::>(); //~ ERROR does not fulfill + assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented + assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented // mutable object types are not ok - assert_copy::<&'a mut Dummy+Copy>(); //~ ERROR does not fulfill + assert_copy::<&'a mut Dummy+Copy>(); //~ ERROR `core::kinds::Copy` is not implemented // closures are like an `&mut` object - assert_copy::<||>(); //~ ERROR does not fulfill + assert_copy::<||>(); //~ ERROR `core::kinds::Copy` is not implemented // unsafe ptrs are ok assert_copy::<*const int>(); @@ -74,11 +74,11 @@ fn test<'a,T,U:Copy>(_: &'a int) { assert_copy::(); // structs containing non-POD are not ok - assert_copy::(); //~ ERROR does not fulfill + assert_copy::(); //~ ERROR `core::kinds::Copy` is not implemented // managed or ref counted types are not ok - assert_copy::>(); //~ ERROR does not fulfill - assert_copy::>(); //~ ERROR does not fulfill + assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented + assert_copy::>(); //~ ERROR `core::kinds::Copy` is not implemented } pub fn main() { diff --git a/src/test/compile-fail/kindck-impl-type-params-2.rs b/src/test/compile-fail/kindck-impl-type-params-2.rs index a034e252d31..6b25289567b 100644 --- a/src/test/compile-fail/kindck-impl-type-params-2.rs +++ b/src/test/compile-fail/kindck-impl-type-params-2.rs @@ -19,5 +19,5 @@ fn take_param(foo: &T) { } fn main() { let x = box 3i; take_param(&x); - //~^ ERROR instantiating a type parameter with an incompatible type + //~^ ERROR the trait `core::kinds::Copy` is not implemented } diff --git a/src/test/compile-fail/kindck-impl-type-params.rs b/src/test/compile-fail/kindck-impl-type-params.rs index 4cc03ee3dcd..c92887965c0 100644 --- a/src/test/compile-fail/kindck-impl-type-params.rs +++ b/src/test/compile-fail/kindck-impl-type-params.rs @@ -20,20 +20,22 @@ impl Gettable for S {} fn f(val: T) { let t: S = S; let a = &t as &Gettable; - //~^ ERROR instantiating a type parameter with an incompatible type `T` + //~^ ERROR the trait `core::kinds::Send` is not implemented + //~^^ ERROR the trait `core::kinds::Copy` is not implemented let a: &Gettable = &t; - //~^ ERROR instantiating a type parameter with an incompatible type `T` + //~^ ERROR the trait `core::kinds::Send` is not implemented + //~^^ ERROR the trait `core::kinds::Copy` is not implemented } -fn main() { - let t: S<&int> = S; - let a = &t as &Gettable<&int>; - //~^ ERROR instantiating a type parameter with an incompatible type +fn foo<'a>() { + let t: S<&'a int> = S; + let a = &t as &Gettable<&'a int>; let t: Box> = box S; let a = t as Box>; - //~^ ERROR instantiating a type parameter with an incompatible type + //~^ ERROR the trait `core::kinds::Copy` is not implemented let t: Box> = box S; let a: Box> = t; - //~^ ERROR instantiating a type parameter with an incompatible type + //~^ ERROR the trait `core::kinds::Copy` is not implemented } +fn main() { } diff --git a/src/test/compile-fail/kindck-inherited-copy-bound.rs b/src/test/compile-fail/kindck-inherited-copy-bound.rs index 2520ed215d5..51ee38d5cfe 100644 --- a/src/test/compile-fail/kindck-inherited-copy-bound.rs +++ b/src/test/compile-fail/kindck-inherited-copy-bound.rs @@ -23,8 +23,8 @@ fn take_param(foo: &T) { } fn main() { let x = box 3i; - take_param(&x); //~ ERROR does not fulfill `Copy` + take_param(&x); //~ ERROR `core::kinds::Copy` is not implemented let y = &x; - let z = &x as &Foo; //~ ERROR does not fulfill `Copy` + let z = &x as &Foo; //~ ERROR `core::kinds::Copy` is not implemented } diff --git a/src/test/compile-fail/kindck-proc-bounds.rs b/src/test/compile-fail/kindck-proc-bounds.rs index 57c8cc3da8a..d87d1a33ca1 100644 --- a/src/test/compile-fail/kindck-proc-bounds.rs +++ b/src/test/compile-fail/kindck-proc-bounds.rs @@ -13,10 +13,10 @@ fn is_freeze() {} fn foo<'a>() { is_send::(); - //~^ ERROR: instantiating a type parameter with an incompatible type + //~^ ERROR: the trait `core::kinds::Send` is not implemented is_freeze::(); - //~^ ERROR: instantiating a type parameter with an incompatible type + //~^ ERROR: the trait `core::kinds::Sync` is not implemented } fn main() { } diff --git a/src/test/compile-fail/kindck-send-object.rs b/src/test/compile-fail/kindck-send-object.rs index 99519263923..9217d05002d 100644 --- a/src/test/compile-fail/kindck-send-object.rs +++ b/src/test/compile-fail/kindck-send-object.rs @@ -19,19 +19,20 @@ trait Message : Send { } // careful with object types, who knows what they close over... fn object_ref_with_static_bound_not_ok() { - assert_send::<&'static Dummy+'static>(); //~ ERROR does not fulfill + assert_send::<&'static Dummy+'static>(); + //~^ ERROR the trait `core::kinds::Send` is not implemented } fn box_object_with_no_bound_not_ok<'a>() { - assert_send::>(); //~ ERROR does not fulfill + assert_send::>(); //~ ERROR the trait `core::kinds::Send` is not implemented } fn proc_with_no_bound_not_ok<'a>() { - assert_send::(); //~ ERROR does not fulfill + assert_send::(); //~ ERROR the trait `core::kinds::Send` is not implemented } fn closure_with_no_bound_not_ok<'a>() { - assert_send::<||:'static>(); //~ ERROR does not fulfill + assert_send::<||:'static>(); //~ ERROR the trait `core::kinds::Send` is not implemented } fn object_with_send_bound_ok() { diff --git a/src/test/compile-fail/kindck-send-object1.rs b/src/test/compile-fail/kindck-send-object1.rs index 6a90fd55356..9b0991e9ac6 100644 --- a/src/test/compile-fail/kindck-send-object1.rs +++ b/src/test/compile-fail/kindck-send-object1.rs @@ -18,6 +18,7 @@ trait Dummy { } // careful with object types, who knows what they close over... fn test51<'a>() { assert_send::<&'a Dummy>(); //~ ERROR does not fulfill the required lifetime + //~^ ERROR the trait `core::kinds::Send` is not implemented } fn test52<'a>() { assert_send::<&'a Dummy+Send>(); //~ ERROR does not fulfill the required lifetime @@ -35,10 +36,12 @@ fn test61() { // them not ok fn test_70<'a>() { assert_send::(); //~ ERROR does not fulfill the required lifetime + //~^ ERROR the trait `core::kinds::Send` is not implemented } fn test_71<'a>() { assert_send::>(); //~ ERROR does not fulfill the required lifetime + //~^ ERROR the trait `core::kinds::Send` is not implemented } fn main() { } diff --git a/src/test/compile-fail/kindck-send-object2.rs b/src/test/compile-fail/kindck-send-object2.rs index 75006477837..d46c6e68c05 100644 --- a/src/test/compile-fail/kindck-send-object2.rs +++ b/src/test/compile-fail/kindck-send-object2.rs @@ -14,11 +14,11 @@ fn assert_send() { } trait Dummy { } fn test50() { - assert_send::<&'static Dummy>(); //~ ERROR does not fulfill `Send` + assert_send::<&'static Dummy>(); //~ ERROR the trait `core::kinds::Send` is not implemented } fn test53() { - assert_send::>(); //~ ERROR does not fulfill `Send` + assert_send::>(); //~ ERROR the trait `core::kinds::Send` is not implemented } // ...unless they are properly bounded diff --git a/src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master b/src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master new file mode 100644 index 00000000000..a9bbfcfa262 --- /dev/null +++ b/src/test/compile-fail/kindck-send-unsafe.rs~rust-lang_master @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn assert_send() { } + +// unsafe ptrs are ok unless they point at unsendable things +fn test70() { + assert_send::<*mut int>(); +} +fn test71<'a>() { + assert_send::<*mut &'a int>(); //~ ERROR does not fulfill the required lifetime +} + +fn main() { +} diff --git a/src/test/compile-fail/map-types.rs b/src/test/compile-fail/map-types.rs index 9a974e595d3..cbe39132479 100644 --- a/src/test/compile-fail/map-types.rs +++ b/src/test/compile-fail/map-types.rs @@ -18,6 +18,5 @@ fn main() { let x: Box> = box HashMap::new(); let x: Box> = x; let y: Box> = box x; - //~^ ERROR failed to find an implementation of trait collections::Map - //~^^ ERROR failed to find an implementation of trait core::collections::Collection + //~^ ERROR the trait `collections::Map` is not implemented } diff --git a/src/test/compile-fail/marker-no-copy.rs b/src/test/compile-fail/marker-no-copy.rs index 5a7cddc250a..d620c13cc25 100644 --- a/src/test/compile-fail/marker-no-copy.rs +++ b/src/test/compile-fail/marker-no-copy.rs @@ -14,5 +14,5 @@ fn foo(p: P) { } fn main() { - foo(marker::NoCopy); //~ ERROR does not fulfill + foo(marker::NoCopy); //~ ERROR the trait `core::kinds::Copy` is not implemented } diff --git a/src/test/compile-fail/marker-no-send.rs b/src/test/compile-fail/marker-no-send.rs index 101959035eb..813e2548398 100644 --- a/src/test/compile-fail/marker-no-send.rs +++ b/src/test/compile-fail/marker-no-send.rs @@ -14,5 +14,5 @@ fn foo(p: P) { } fn main() { - foo(marker::NoSend); //~ ERROR does not fulfill `Send` + foo(marker::NoSend); //~ ERROR the trait `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/marker-no-share.rs b/src/test/compile-fail/marker-no-share.rs index 25fe95b80c4..735e61fa139 100644 --- a/src/test/compile-fail/marker-no-share.rs +++ b/src/test/compile-fail/marker-no-share.rs @@ -14,5 +14,5 @@ fn foo(p: P) { } fn main() { - foo(marker::NoSync); //~ ERROR does not fulfill `Sync` + foo(marker::NoSync); //~ ERROR the trait `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/mut-not-freeze.rs b/src/test/compile-fail/mut-not-freeze.rs index a5b6acc447f..60921c04135 100644 --- a/src/test/compile-fail/mut-not-freeze.rs +++ b/src/test/compile-fail/mut-not-freeze.rs @@ -14,5 +14,5 @@ fn f(_: T) {} fn main() { let x = RefCell::new(0i); - f(x); //~ ERROR: which does not fulfill `Sync` + f(x); //~ ERROR `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/mutable-enum-indirect.rs b/src/test/compile-fail/mutable-enum-indirect.rs index 9d4c35baea3..96937524ad5 100644 --- a/src/test/compile-fail/mutable-enum-indirect.rs +++ b/src/test/compile-fail/mutable-enum-indirect.rs @@ -19,5 +19,5 @@ fn bar(_: T) {} fn main() { let x = A(marker::NoSync); - bar(&x); //~ ERROR type parameter with an incompatible type + bar(&x); //~ ERROR the trait `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/no-send-res-ports.rs b/src/test/compile-fail/no-send-res-ports.rs index 5b688c6156a..f58350cf093 100644 --- a/src/test/compile-fail/no-send-res-ports.rs +++ b/src/test/compile-fail/no-send-res-ports.rs @@ -36,7 +36,8 @@ fn main() { let x = foo(Port(box(GC) ())); task::spawn(proc() { - let y = x; //~ ERROR does not fulfill `Send` + let y = x; + //~^ ERROR does not fulfill `Send` println!("{:?}", y); }); } diff --git a/src/test/compile-fail/no_send-enum.rs b/src/test/compile-fail/no_send-enum.rs index 4395151cbc1..2235a265bba 100644 --- a/src/test/compile-fail/no_send-enum.rs +++ b/src/test/compile-fail/no_send-enum.rs @@ -19,6 +19,5 @@ fn bar(_: T) {} fn main() { let x = A(marker::NoSend); bar(x); - //~^ ERROR instantiating a type parameter with an incompatible type `Foo`, - // which does not fulfill `Send` + //~^ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/no_send-rc.rs b/src/test/compile-fail/no_send-rc.rs index 291340e55b8..c05b17afe1d 100644 --- a/src/test/compile-fail/no_send-rc.rs +++ b/src/test/compile-fail/no_send-rc.rs @@ -15,6 +15,5 @@ fn bar(_: T) {} fn main() { let x = Rc::new(5i); bar(x); - //~^ ERROR instantiating a type parameter with an incompatible type `alloc::rc::Rc`, - // which does not fulfill `Send` + //~^ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/no_send-struct.rs b/src/test/compile-fail/no_send-struct.rs index 5b083374c51..6e84578e92e 100644 --- a/src/test/compile-fail/no_send-struct.rs +++ b/src/test/compile-fail/no_send-struct.rs @@ -20,6 +20,5 @@ fn bar(_: T) {} fn main() { let x = Foo { a: 5, ns: marker::NoSend }; bar(x); - //~^ ERROR instantiating a type parameter with an incompatible type `Foo`, - // which does not fulfill `Send` + //~^ ERROR the trait `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/no_share-enum.rs b/src/test/compile-fail/no_share-enum.rs index f96d751af7e..1a692dab6d4 100644 --- a/src/test/compile-fail/no_share-enum.rs +++ b/src/test/compile-fail/no_share-enum.rs @@ -17,6 +17,5 @@ fn bar(_: T) {} fn main() { let x = A(marker::NoSync); bar(x); - //~^ ERROR instantiating a type parameter with an incompatible type `Foo`, - // which does not fulfill `Sync` + //~^ ERROR the trait `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/no_share-rc.rs b/src/test/compile-fail/no_share-rc.rs index 7a840674be6..5572f72d8fe 100644 --- a/src/test/compile-fail/no_share-rc.rs +++ b/src/test/compile-fail/no_share-rc.rs @@ -16,6 +16,5 @@ fn bar(_: T) {} fn main() { let x = Rc::new(RefCell::new(5i)); bar(x); - //~^ ERROR instantiating a type parameter with an incompatible type - // `std::rc::Rc>`, which does not fulfill `Sync` + //~^ ERROR the trait `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/no_share-struct.rs b/src/test/compile-fail/no_share-struct.rs index 6b87a5fa09c..1379a9f7382 100644 --- a/src/test/compile-fail/no_share-struct.rs +++ b/src/test/compile-fail/no_share-struct.rs @@ -17,6 +17,5 @@ fn bar(_: T) {} fn main() { let x = Foo { a: 5, m: marker::NoSync }; bar(x); - //~^ ERROR instantiating a type parameter with an incompatible type `Foo`, - // which does not fulfill `Sync` + //~^ ERROR the trait `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/object-does-not-impl-trait.rs b/src/test/compile-fail/object-does-not-impl-trait.rs index 0cbdb87d56c..cfaf149a49c 100644 --- a/src/test/compile-fail/object-does-not-impl-trait.rs +++ b/src/test/compile-fail/object-does-not-impl-trait.rs @@ -14,6 +14,6 @@ trait Foo {} fn take_foo(f: F) {} -fn take_object(f: Box) { take_foo(f); } //~ ERROR failed to find an implementation of trait -//~^ ERROR failed to find an implementation +fn take_object(f: Box) { take_foo(f); } +//~^ ERROR the trait `Foo` is not implemented fn main() {} diff --git a/src/test/compile-fail/pinned-deep-copy.rs b/src/test/compile-fail/pinned-deep-copy.rs index e62f5fe1a4d..0e8bb40e0ff 100644 --- a/src/test/compile-fail/pinned-deep-copy.rs +++ b/src/test/compile-fail/pinned-deep-copy.rs @@ -43,8 +43,7 @@ fn main() { { // Can't do this copy let x = box box box A {y: r(i)}; - let _z = x.clone(); //~ ERROR failed to find an implementation - //~^ ERROR failed to find an implementation + let _z = x.clone(); //~ ERROR not implemented println!("{:?}", x); } println!("{:?}", *i); diff --git a/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs b/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs index 0c9f5004f57..c6a9f67cfc6 100644 --- a/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs +++ b/src/test/compile-fail/regions-bound-missing-bound-in-impl.rs @@ -12,8 +12,6 @@ // nominal types (but not on other types) and that they are type // checked. -#![no_std] - struct Inv<'a> { // invariant w/r/t 'a x: &'a mut &'a int } diff --git a/src/test/compile-fail/regions-bounded-by-send.rs b/src/test/compile-fail/regions-bounded-by-send.rs index 3c7ffbc8d1f..50190411bf0 100644 --- a/src/test/compile-fail/regions-bounded-by-send.rs +++ b/src/test/compile-fail/regions-bounded-by-send.rs @@ -58,6 +58,7 @@ fn box_with_region_not_ok<'a>() { fn object_with_random_bound_not_ok<'a>() { assert_send::<&'a Dummy+'a>(); //~ ERROR does not fulfill + //~^ ERROR not implemented } fn object_with_send_bound_not_ok<'a>() { @@ -66,10 +67,12 @@ fn object_with_send_bound_not_ok<'a>() { fn proc_with_lifetime_not_ok<'a>() { assert_send::(); //~ ERROR does not fulfill + //~^ ERROR not implemented } fn closure_with_lifetime_not_ok<'a>() { assert_send::<||:'a>(); //~ ERROR does not fulfill + //~^ ERROR not implemented } // unsafe pointers are ok unless they point at unsendable things diff --git a/src/test/compile-fail/regions-bounded-method-type-parameters.rs b/src/test/compile-fail/regions-bounded-method-type-parameters.rs index ba1993686d5..279139d8de9 100644 --- a/src/test/compile-fail/regions-bounded-method-type-parameters.rs +++ b/src/test/compile-fail/regions-bounded-method-type-parameters.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![no_std] - // Check that explicit region bounds are allowed on the various // nominal types (but not on other types) and that they are type // checked. diff --git a/src/test/compile-fail/regions-escape-via-trait-or-not.rs b/src/test/compile-fail/regions-escape-via-trait-or-not.rs index b73b5e0649f..adc960b069d 100644 --- a/src/test/compile-fail/regions-escape-via-trait-or-not.rs +++ b/src/test/compile-fail/regions-escape-via-trait-or-not.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![no_std] - #![allow(dead_code)] trait Deref { diff --git a/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs b/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs index a52d2f9f9a0..773d6e2c703 100644 --- a/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs +++ b/src/test/compile-fail/regions-lifetime-bounds-on-fns.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![no_std] - fn a<'a, 'b:'a>(x: &mut &'a int, y: &mut &'b int) { // Note: this is legal because of the `'b:'a` declaration. *x = *y; diff --git a/src/test/compile-fail/repeat-to-run-dtor-twice.rs b/src/test/compile-fail/repeat-to-run-dtor-twice.rs index 77146b65ae6..8fdf586b3d1 100644 --- a/src/test/compile-fail/repeat-to-run-dtor-twice.rs +++ b/src/test/compile-fail/repeat-to-run-dtor-twice.rs @@ -24,5 +24,6 @@ impl Drop for Foo { fn main() { let a = Foo { x: 3 }; - let _ = [ a, ..5 ]; //~ ERROR copying a value of non-copyable type + let _ = [ a, ..5 ]; + //~^ ERROR the trait `core::kinds::Copy` is not implemented for the type `Foo` } diff --git a/src/test/compile-fail/task-rng-isnt-sendable.rs b/src/test/compile-fail/task-rng-isnt-sendable.rs index 366e1fd4dca..e9997083bab 100644 --- a/src/test/compile-fail/task-rng-isnt-sendable.rs +++ b/src/test/compile-fail/task-rng-isnt-sendable.rs @@ -16,5 +16,5 @@ fn test_send() {} pub fn main() { test_send::(); - //~^ ERROR: incompatible type `std::rand::TaskRng`, which does not fulfill `Send` + //~^ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs index 78b4ab817bf..85a2761172d 100644 --- a/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs +++ b/src/test/compile-fail/trait-bounds-not-on-bare-trait.rs @@ -14,7 +14,7 @@ trait Foo { // This should emit the less confusing error, not the more confusing one. fn foo(_x: Foo + Send) { - //~^ERROR variable `_x` has dynamically sized type `Foo+Send` + //~^ERROR the trait `core::kinds::Sized` is not implemented } fn main() { } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs index 226556dc78f..4233fa843eb 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-locals.rs @@ -16,12 +16,11 @@ struct Foo { fn main() { let foo = Foo { - //~^ ERROR failed to find an implementation - //~^^ ERROR instantiating a type parameter with an incompatible type + //~^ ERROR not implemented x: 3i }; + let baz: Foo = fail!(); - //~^ ERROR failed to find an implementation - //~^^ ERROR instantiating a type parameter with an incompatible type + //~^ ERROR not implemented } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs index 142ead75bcf..c26cccc8b14 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-static.rs @@ -15,8 +15,7 @@ struct Foo { } static X: Foo = Foo { -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented x: 1, }; diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs index 9be519960b8..d01f9d59fb4 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc.rs @@ -15,22 +15,11 @@ extern crate trait_bounds_on_structs_and_enums_xc; use trait_bounds_on_structs_and_enums_xc::{Bar, Foo, Trait}; fn explode(x: Foo) {} -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented fn kaboom(y: Bar) {} -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented fn main() { - let foo = Foo { - //~^ ERROR failed to find an implementation - //~^^ ERROR instantiating a type parameter with an incompatible type - x: 3i - }; - let bar: Bar = return; - //~^ ERROR failed to find an implementation - //~^^ ERROR instantiating a type parameter with an incompatible type - let _ = bar; } diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs new file mode 100644 index 00000000000..d3689067aef --- /dev/null +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums-xc1.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:trait_bounds_on_structs_and_enums_xc.rs + +extern crate trait_bounds_on_structs_and_enums_xc; + +use trait_bounds_on_structs_and_enums_xc::{Bar, Foo, Trait}; + +fn main() { + let foo = Foo { + //~^ ERROR not implemented + x: 3i + }; + let bar: Bar = return; + //~^ ERROR not implemented + let _ = bar; +} + diff --git a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs index ba035dd2c6f..5fe8e435e68 100644 --- a/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs +++ b/src/test/compile-fail/trait-bounds-on-structs-and-enums.rs @@ -20,40 +20,34 @@ enum Bar { CBar(uint), } -fn explode(x: Foo) {} -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +fn explode(x: Foo) {} +//~^ ERROR not implemented fn kaboom(y: Bar) {} -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented -impl Foo { //~ ERROR failed to find an implementation -//~^ ERROR instantiating a type parameter with an incompatible type +impl Foo { +//~^ ERROR the trait `Trait` is not implemented fn uhoh() {} } struct Baz { -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented a: Foo, } enum Boo { -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented Quux(Bar), } struct Badness { -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented b: Foo, } enum MoreBadness { -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented EvenMoreBadness(Bar), } @@ -64,15 +58,10 @@ trait PolyTrait { struct Struct; impl PolyTrait> for Struct { -//~^ ERROR failed to find an implementation -//~^^ ERROR instantiating a type parameter with an incompatible type +//~^ ERROR not implemented fn whatever() {} } fn main() { - let bar: Bar = return; - //~^ ERROR failed to find an implementation - //~^^ ERROR instantiating a type parameter with an incompatible type - let _ = bar; } diff --git a/src/test/compile-fail/trait-coercion-generic-bad.rs b/src/test/compile-fail/trait-coercion-generic-bad.rs index 55e5a02cfae..74982946d7d 100644 --- a/src/test/compile-fail/trait-coercion-generic-bad.rs +++ b/src/test/compile-fail/trait-coercion-generic-bad.rs @@ -25,7 +25,6 @@ impl Trait<&'static str> for Struct { fn main() { let s: Box> = box Struct { person: "Fred" }; - //~^ ERROR expected Trait, found Trait<&'static str> - //~^^ ERROR expected Trait, found Trait<&'static str> + //~^ ERROR type mismatch s.f(1); } diff --git a/src/test/compile-fail/type-params-in-different-spaces-2.rs b/src/test/compile-fail/type-params-in-different-spaces-2.rs index 4143d9d9b84..580aea65185 100644 --- a/src/test/compile-fail/type-params-in-different-spaces-2.rs +++ b/src/test/compile-fail/type-params-in-different-spaces-2.rs @@ -15,12 +15,12 @@ trait Tr { // these compile as if Self: Tr, even tho only Self: Tr trait A: Tr { fn test(u: U) -> Self { - Tr::op(u) //~ ERROR expected Tr, found Tr + Tr::op(u) //~ ERROR type mismatch } } trait B: Tr { fn test(u: U) -> Self { - Tr::op(u) //~ ERROR expected Tr, found Tr + Tr::op(u) //~ ERROR type mismatch } } diff --git a/src/test/compile-fail/typeck-unsafe-always-share.rs b/src/test/compile-fail/typeck-unsafe-always-share.rs index 369bd0a15c4..7c74cdc890d 100644 --- a/src/test/compile-fail/typeck-unsafe-always-share.rs +++ b/src/test/compile-fail/typeck-unsafe-always-share.rs @@ -39,5 +39,5 @@ fn main() { let ns = NoSync{m: marker::NoSync}; test(ns); - //~^ ERROR instantiating a type parameter with an incompatible type `NoSync`, which does not fulfill `Sync` + //~^ ERROR `core::kinds::Sync` is not implemented } diff --git a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs index 2ee632b9093..a96bde7cca4 100644 --- a/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs +++ b/src/test/compile-fail/unboxed-closures-vtable-mismatch.rs @@ -18,8 +18,7 @@ fn call_it>(y: int, mut f: F) -> int { pub fn main() { let f = |&mut: x: uint, y: int| -> int { (x as int) + y }; - let z = call_it(3, f); //~ ERROR expected core::ops::FnMut - //~^ ERROR expected core::ops::FnMut + let z = call_it(3, f); //~ ERROR type mismatch println!("{}", z); } diff --git a/src/test/compile-fail/unboxed-closures-wrong-trait.rs b/src/test/compile-fail/unboxed-closures-wrong-trait.rs index 50d90c6200e..27f1da75c3a 100644 --- a/src/test/compile-fail/unboxed-closures-wrong-trait.rs +++ b/src/test/compile-fail/unboxed-closures-wrong-trait.rs @@ -17,6 +17,6 @@ fn c int>(f: F) -> int { fn main() { let z: int = 7; assert_eq!(c(|&: x: int, y| x + y + z), 10); - //~^ ERROR failed to find an implementation + //~^ ERROR not implemented } diff --git a/src/test/compile-fail/unique-pinned-nocopy.rs b/src/test/compile-fail/unique-pinned-nocopy.rs index e5b7bf08715..940ca765828 100644 --- a/src/test/compile-fail/unique-pinned-nocopy.rs +++ b/src/test/compile-fail/unique-pinned-nocopy.rs @@ -20,7 +20,6 @@ impl Drop for r { fn main() { let i = box r { b: true }; - let _j = i.clone(); //~ ERROR failed to find an implementation - //~^ ERROR failed to find an implementation + let _j = i.clone(); //~ ERROR not implemented println!("{:?}", i); } diff --git a/src/test/compile-fail/unique-unique-kind.rs b/src/test/compile-fail/unique-unique-kind.rs index dd0c7953434..7d6cdaef85b 100644 --- a/src/test/compile-fail/unique-unique-kind.rs +++ b/src/test/compile-fail/unique-unique-kind.rs @@ -16,5 +16,5 @@ fn f(_i: T) { fn main() { let i = box box(GC) 100i; - f(i); //~ ERROR does not fulfill `Send` + f(i); //~ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/unique-vec-res.rs b/src/test/compile-fail/unique-vec-res.rs index dfb04323005..54b1fdea719 100644 --- a/src/test/compile-fail/unique-vec-res.rs +++ b/src/test/compile-fail/unique-vec-res.rs @@ -36,10 +36,8 @@ fn main() { let r1 = vec!(box r { i: i1 }); let r2 = vec!(box r { i: i2 }); f(r1.clone(), r2.clone()); - //~^ ERROR failed to find an implementation of - //~^^ ERROR failed to find an implementation of - //~^^^ ERROR failed to find an implementation of - //~^^^^ ERROR failed to find an implementation of + //~^ ERROR the trait `core::clone::Clone` is not implemented + //~^^ ERROR the trait `core::clone::Clone` is not implemented println!("{:?}", (r2, i1.get())); println!("{:?}", (r1, i2.get())); } diff --git a/src/test/compile-fail/unsendable-class.rs b/src/test/compile-fail/unsendable-class.rs index 2991a60835d..c3fea8e86d4 100644 --- a/src/test/compile-fail/unsendable-class.rs +++ b/src/test/compile-fail/unsendable-class.rs @@ -28,6 +28,6 @@ fn foo(i:int, j: Gc) -> foo { fn main() { let cat = "kitty".to_string(); - let (tx, _) = channel(); //~ ERROR does not fulfill `Send` - tx.send(foo(42, box(GC) (cat))); //~ ERROR does not fulfill `Send` + let (tx, _) = channel(); //~ ERROR `core::kinds::Send` is not implemented + tx.send(foo(42, box(GC) (cat))); //~ ERROR `core::kinds::Send` is not implemented } diff --git a/src/test/compile-fail/unsized-bare-typaram.rs b/src/test/compile-fail/unsized-bare-typaram.rs index 6fd749b1298..7b5d4295411 100644 --- a/src/test/compile-fail/unsized-bare-typaram.rs +++ b/src/test/compile-fail/unsized-bare-typaram.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: instantiating a type parameter with an incompatible type fn bar() { } -fn foo() { bar::() } +fn foo() { bar::() } //~ ERROR the trait `core::kinds::Sized` is not implemented fn main() { } diff --git a/src/test/compile-fail/unsized-enum.rs b/src/test/compile-fail/unsized-enum.rs index 651eb26cadc..edef3ae6492 100644 --- a/src/test/compile-fail/unsized-enum.rs +++ b/src/test/compile-fail/unsized-enum.rs @@ -8,7 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: instantiating a type parameter with an incompatible type +enum Foo { FooSome(T), FooNone } + fn bar() { } -fn foo() { bar::>() } +fn foo() { bar::>() } +//~^ ERROR the trait `core::kinds::Sized` is not implemented +//~^^ ERROR the trait `core::kinds::Sized` is not implemented +// +// One error is for T being provided to Foo, the other is +// for Foo being provided to bar. + fn main() { } diff --git a/src/test/compile-fail/unsized-struct.rs b/src/test/compile-fail/unsized-struct.rs index ec6aafb43f4..58aba1a2646 100644 --- a/src/test/compile-fail/unsized-struct.rs +++ b/src/test/compile-fail/unsized-struct.rs @@ -8,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: instantiating a type parameter with an incompatible type - struct Foo { data: T } fn bar() { } fn foo() { bar::>() } +//~^ ERROR the trait `core::kinds::Sized` is not implemented +//~^^ ERROR the trait `core::kinds::Sized` is not implemented +// One error is for the T in Foo, the other is for Foo as a value +// for bar's type parameter. + fn main() { } diff --git a/src/test/compile-fail/unsized3.rs b/src/test/compile-fail/unsized3.rs index f71afeb1b30..fba1237340f 100644 --- a/src/test/compile-fail/unsized3.rs +++ b/src/test/compile-fail/unsized3.rs @@ -8,12 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// Test sized-ness checking in substitution. +// Test sized-ness checking in substitution within fn bodies.. // Unbounded. fn f1(x: &X) { - f2::(x); //~ ERROR instantiating a type parameter with an incompatible type `X`, which does n + f2::(x); + //~^ ERROR the trait `core::kinds::Sized` is not implemented } fn f2(x: &X) { } @@ -21,7 +22,8 @@ fn f2(x: &X) { // Bounded. trait T for Sized? {} fn f3(x: &X) { - f4::(x); //~ ERROR instantiating a type parameter with an incompatible type `X`, which does n + f4::(x); + //~^ ERROR the trait `core::kinds::Sized` is not implemented } fn f4(x: &X) { } @@ -34,7 +36,8 @@ enum E { fn f5(x: &Y) {} fn f6(x: &X) {} fn f7(x1: &E, x2: &E) { - f5(x1); //~ERROR instantiating a type parameter with an incompatible type `E`, which does not + f5(x1); + //~^ ERROR the trait `core::kinds::Sized` is not implemented f6(x2); // ok } @@ -45,40 +48,18 @@ struct S { } fn f8(x1: &S, x2: &S) { - f5(x1); //~ERROR instantiating a type parameter with an incompatible type `S`, which does not + f5(x1); + //~^ ERROR the trait `core::kinds::Sized` is not implemented f6(x2); // ok } // Test some tuples. fn f9(x1: Box>, x2: Box>) { - f5(&(*x1, 34i)); //~ERROR E0161 - //~^ ERROR instantiating a type parameter with an incompatible type - f5(&(32i, *x2)); //~ERROR E0161 - //~^ ERROR instantiating a type parameter with an incompatible type + f5(&(*x1, 34i)); + //~^ ERROR the trait `core::kinds::Sized` is not implemented + f5(&(32i, *x2)); + //~^ ERROR the trait `core::kinds::Sized` is not implemented } -// impl - bounded -trait T1 { -} -struct S3; -impl T1 for S3 { //~ ERROR instantiating a type parameter with an incompatible -} - -// impl - unbounded -trait T2 { -} -impl T2 for S3 { //~ ERROR instantiating a type parameter with an incompatible type -} - -// impl - struct -trait T3 { -} -struct S4; -impl T3 for S4 { //~ ERROR instantiating a type parameter with an incompatible type -} -impl S4 { //~ ERROR instantiating a type parameter with an incompatible type -} - - pub fn main() { } diff --git a/src/test/compile-fail/unsized6.rs b/src/test/compile-fail/unsized6.rs index 6618cce0214..0efd178f75b 100644 --- a/src/test/compile-fail/unsized6.rs +++ b/src/test/compile-fail/unsized6.rs @@ -14,33 +14,29 @@ trait T for Sized? {} fn f1(x: &X) { - let _: X; //~ERROR variable `_` has dynamically sized type `X` - let _: (int, (X, int)); //~ERROR variable `_` has dynamically sized type `(int,(X,int))` - let y: X; //~ERROR variable `y` has dynamically sized type `X` - let y: (int, (X, int)); //~ERROR variable `y` has dynamically sized type `(int,(X,int))` + let _: X; // <-- this is OK, no bindings created, no initializer. + let _: (int, (X, int)); // same + let y: X; //~ERROR the trait `core::kinds::Sized` is not implemented + let y: (int, (X, int)); //~ERROR the trait `core::kinds::Sized` is not implemented } fn f2(x: &X) { - let _: X; //~ERROR variable `_` has dynamically sized type `X` - let _: (int, (X, int)); //~ERROR variable `_` has dynamically sized type `(int,(X,int))` - let y: X; //~ERROR variable `y` has dynamically sized type `X` - let y: (int, (X, int)); //~ERROR variable `y` has dynamically sized type `(int,(X,int))` + let y: X; //~ERROR the trait `core::kinds::Sized` is not implemented + let y: (int, (X, int)); //~ERROR the trait `core::kinds::Sized` is not implemented } fn f3(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR variable `y` has dynamically sized type `X` - let y = *x2; //~ERROR variable `y` has dynamically sized type `X` - let (y, z) = (*x3, 4i); //~ERROR variable `y` has dynamically sized type `X` - //~^ ERROR E0161 + let y: X = *x1; //~ERROR the trait `core::kinds::Sized` is not implemented + let y = *x2; //~ERROR the trait `core::kinds::Sized` is not implemented + let (y, z) = (*x3, 4i); //~ERROR the trait `core::kinds::Sized` is not implemented } fn f4(x1: Box, x2: Box, x3: Box) { - let y: X = *x1; //~ERROR variable `y` has dynamically sized type `X` - let y = *x2; //~ERROR variable `y` has dynamically sized type `X` - let (y, z) = (*x3, 4i); //~ERROR variable `y` has dynamically sized type `X` - //~^ ERROR E0161 + let y: X = *x1; //~ERROR the trait `core::kinds::Sized` is not implemented + let y = *x2; //~ERROR the trait `core::kinds::Sized` is not implemented + let (y, z) = (*x3, 4i); //~ERROR the trait `core::kinds::Sized` is not implemented } -fn g1(x: X) {} //~ERROR variable `x` has dynamically sized type `X` -fn g2(x: X) {} //~ERROR variable `x` has dynamically sized type `X` +fn g1(x: X) {} //~ERROR the trait `core::kinds::Sized` is not implemented +fn g2(x: X) {} //~ERROR the trait `core::kinds::Sized` is not implemented pub fn main() { } diff --git a/src/test/compile-fail/unsized7.rs b/src/test/compile-fail/unsized7.rs new file mode 100644 index 00000000000..fd9dffe00d2 --- /dev/null +++ b/src/test/compile-fail/unsized7.rs @@ -0,0 +1,43 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test sized-ness checking in substitution in impls. + +trait T for Sized? {} + +// I would like these to fail eventually. +// impl - bounded +trait T1 { +} +struct S3; +impl T1 for S3 { + //~^ ERROR `core::kinds::Sized` is not implemented for the type `X` +} + +// impl - unbounded +trait T2 { +} +struct S4; +impl T2 for S4 { + //~^ ERROR `core::kinds::Sized` is not implemented for the type `X` +} + +// impl - struct +trait T3 { +} +struct S5; +impl T3 for S5 { //~ ERROR not implemented +} + +impl S5 { //~ ERROR not implemented +} + + +fn main() { } diff --git a/src/test/compile-fail/vec-res-add.rs b/src/test/compile-fail/vec-res-add.rs index 8da9511b493..bfd52d69cb2 100644 --- a/src/test/compile-fail/vec-res-add.rs +++ b/src/test/compile-fail/vec-res-add.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern: failed to find an implementation - struct r { i:int } @@ -25,5 +23,7 @@ fn main() { let i = vec!(r(0)); let j = vec!(r(1)); let k = i + j; + //~^ ERROR not implemented println!("{}", j); + //~^ ERROR not implemented } diff --git a/src/test/compile-fail/vtable-res-trait-param.rs b/src/test/compile-fail/vtable-res-trait-param.rs index 2baa89d52f2..12cfe9c20fa 100644 --- a/src/test/compile-fail/vtable-res-trait-param.rs +++ b/src/test/compile-fail/vtable-res-trait-param.rs @@ -24,8 +24,7 @@ impl TraitB for int { fn call_it(b: B) -> int { let y = 4u; - b.gimme_an_a(y) //~ ERROR failed to find an implementation of trait TraitA - //~^ ERROR failed to find an implementation of trait TraitA + b.gimme_an_a(y) //~ ERROR the trait `TraitA` is not implemented } fn main() { diff --git a/src/test/compile-fail/where-clauses-unsatisfied.rs b/src/test/compile-fail/where-clauses-unsatisfied.rs index 2324da6b8f4..4a4a5f3193d 100644 --- a/src/test/compile-fail/where-clauses-unsatisfied.rs +++ b/src/test/compile-fail/where-clauses-unsatisfied.rs @@ -15,9 +15,6 @@ struct Struct; fn main() { drop(equal(&Struct, &Struct)) - //~^ ERROR failed to find an implementation of trait core::cmp::Eq - //~^^ ERROR failed to find an implementation of trait core::cmp::PartialEq - //~^^^ ERROR failed to find an implementation of trait core::cmp::Eq - //~^^^^ ERROR failed to find an implementation of trait core::cmp::PartialEq + //~^ ERROR the trait `core::cmp::Eq` is not implemented } diff --git a/src/test/run-pass/drop-struct-as-object.rs b/src/test/run-pass/drop-struct-as-object.rs new file mode 100644 index 00000000000..6d7715ed9a5 --- /dev/null +++ b/src/test/run-pass/drop-struct-as-object.rs @@ -0,0 +1,42 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test that destructor on a struct runs successfully after the struct +// is boxed and converted to an object. + +static mut value: uint = 0; + +struct Cat { + name : uint, +} + +trait Dummy { + fn get(&self) -> uint; +} + +impl Dummy for Cat { + fn get(&self) -> uint { self.name } +} + +impl Drop for Cat { + fn drop(&mut self) { + unsafe { value = self.name; } + } +} + +pub fn main() { + { + let x = box Cat {name: 22}; + let nyan: Box = x as Box; + } + unsafe { + assert_eq!(value, 22); + } +} diff --git a/src/test/run-pass/object-one-type-two-traits.rs b/src/test/run-pass/object-one-type-two-traits.rs new file mode 100644 index 00000000000..f8bc0929bfa --- /dev/null +++ b/src/test/run-pass/object-one-type-two-traits.rs @@ -0,0 +1,39 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Testing creating two vtables with the same self type, but different +// traits. + +use std::any::Any; +use std::any::AnyRefExt; + +trait Wrap { + fn get(&self) -> int; + fn wrap(self: Box) -> Box; +} + +impl Wrap for int { + fn get(&self) -> int { + *self + } + fn wrap(self: Box) -> Box { + self as Box + } +} + +fn is(x: &Any) -> bool { + x.is::() +} + +fn main() { + let x = box 22i as Box; + println!("x={}", x.get()); + let y = x.wrap(); +}