Skip to content

Commit b88f867

Browse files
committed
Update error messages in compile-fail tests
1 parent a8d478d commit b88f867

File tree

87 files changed

+381
-256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+381
-256
lines changed

src/test/compile-fail/bad-method-typaram-kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
fn foo<T:'static>() {
12-
1u.bar::<T>(); //~ ERROR: does not fulfill `Send`
12+
1u.bar::<T>(); //~ ERROR `core::kinds::Send` is not implemented
1313
}
1414

1515
trait bar {

src/test/compile-fail/bad-sized.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ trait Trait {}
1616

1717
pub fn main() {
1818
let x: Vec<Trait + Sized> = Vec::new();
19-
//~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
20-
//~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
21-
//~^^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
19+
//~^ ERROR the trait `core::kinds::Sized` is not implemented
20+
//~^^ ERROR the trait `core::kinds::Sized` is not implemented
2221
let x: Vec<Box<RefCell<Trait + Sized>>> = Vec::new();
23-
//~^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
24-
//~^^ ERROR instantiating a type parameter with an incompatible type `Trait+Sized`, which does not fulfill `Sized`
22+
//~^ ERROR the trait `core::kinds::Sized` is not implemented
2523
}

src/test/compile-fail/builtin-superkinds-double-superkind.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
trait Foo : Send+Sync { }
1515

16-
impl <T: Sync> Foo for (T,) { } //~ ERROR cannot implement this trait
16+
impl <T: Sync+'static> Foo for (T,) { } //~ ERROR the trait `core::kinds::Send` is not implemented
1717

18-
impl <T: Send> Foo for (T,T) { } //~ ERROR cannot implement this trait
18+
impl <T: Send> Foo for (T,T) { } //~ ERROR the trait `core::kinds::Sync` is not implemented
1919

2020
impl <T: Send+Sync> Foo for (T,T,T) { } // (ok)
2121

src/test/compile-fail/builtin-superkinds-in-metadata.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct X<T>(T);
2121

2222
impl <T:Sync> RequiresShare for X<T> { }
2323

24-
impl <T:Sync> RequiresRequiresShareAndSend for X<T> { } //~ ERROR cannot implement this trait
24+
impl <T:Sync+'static> RequiresRequiresShareAndSend for X<T> { }
25+
//~^ ERROR the trait `core::kinds::Send` is not implemented
2526

2627
fn main() { }

src/test/compile-fail/builtin-superkinds-self-type.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
// to use capabilities granted by builtin kinds as supertraits.
1313

1414
trait Foo : Sync+'static {
15-
fn foo(self, mut chan: Sender<Self>) {
16-
chan.send(self); //~ ERROR does not fulfill `Send`
17-
}
15+
fn foo(self, mut chan: Sender<Self>) { }
1816
}
1917

2018
impl <T: Sync> Foo for T { }
19+
//~^ ERROR the parameter type `T` may not live long enough
20+
//~^^ ERROR the parameter type `T` may not live long enough
2121

2222
fn main() {
2323
let (tx, rx) = channel();

src/test/compile-fail/builtin-superkinds-simple.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414
trait Foo : Send { }
1515

1616
impl <'a> Foo for &'a mut () { }
17-
//~^ ERROR which does not fulfill `Send`, cannot implement this trait
17+
//~^ ERROR does not fulfill the required lifetime
1818

1919
fn main() { }

src/test/compile-fail/builtin-superkinds-typaram-not-send.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212

1313
trait Foo : Send { }
1414

15-
impl <T: Sync> Foo for T { } //~ ERROR cannot implement this trait
15+
impl <T: Sync+'static> Foo for T { } //~ ERROR the trait `core::kinds::Send` is not implemented
1616

1717
fn main() { }

src/test/compile-fail/comm-not-freeze.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
fn test<T: Sync>() {}
1212

1313
fn main() {
14-
test::<Sender<int>>(); //~ ERROR: does not fulfill `Sync`
15-
test::<Receiver<int>>(); //~ ERROR: does not fulfill `Sync`
16-
test::<Sender<int>>(); //~ ERROR: does not fulfill `Sync`
14+
test::<Sender<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
15+
test::<Receiver<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
16+
test::<Sender<int>>(); //~ ERROR: `core::kinds::Sync` is not implemented
1717
}

src/test/compile-fail/conflicting-implementations-aux.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
extern crate trait_impl_conflict;
1616
use trait_impl_conflict::Foo;
1717

18-
impl<A> Foo for A {
19-
//~^ ERROR conflicting implementations for trait `trait_impl_conflict::Foo`
20-
//~^^ ERROR cannot provide an extension implementation where both trait and type
21-
// are not defined in this crate
18+
impl<A> Foo for A { //~ ERROR E0117
2219
}
2320

2421
fn main() {

src/test/compile-fail/conflicting-implementations.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: conflicting implementations for trait `Foo`
1211
trait Foo {
1312
}
1413

15-
impl Foo for int {
14+
impl Foo for int { //~ ERROR conflicting implementations
1615

1716
}
1817

19-
impl<A> Foo for A {
18+
impl<A> Foo for A { //~ NOTE conflicting implementation here
2019

2120
}
2221

src/test/compile-fail/deriving-span-Default-struct.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ struct Error;
1818

1919
#[deriving(Default)]
2020
struct Struct {
21-
x: Error //~ ERROR
21+
x: Error //~ ERROR `core::default::Default` is not implemented
2222
}
2323

2424
fn main() {}

src/test/compile-fail/deriving-span-Zero-struct.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ extern crate rand;
1616

1717
struct Error;
1818

19-
#[deriving(Zero)] //~ ERROR failed to find an implementation
19+
#[deriving(Zero)] //~ ERROR not implemented
2020
struct Struct {
21-
x: Error //~ ERROR failed to find an implementation
22-
//~^ ERROR failed to find an implementation
23-
//~^^ ERROR type `Error` does not implement any method in scope
21+
x: Error
2422
}
2523

2624
fn main() {}

src/test/compile-fail/deriving-span-Zero-tuple-struct.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ extern crate rand;
1616

1717
struct Error;
1818

19-
#[deriving(Zero)] //~ ERROR failed to find an implementation
19+
#[deriving(Zero)] //~ ERROR not implemented
2020
struct Struct(
21-
Error //~ ERROR
22-
//~^ ERROR failed to find an implementation
23-
//~^^ ERROR type `Error` does not implement any method in scope
21+
Error
2422
);
2523

2624
fn main() {}

src/test/compile-fail/drop-on-non-struct.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
12-
13-
type Foo = Vec<u8>;
14-
15-
impl Drop for Foo {
16-
//~^ ERROR cannot provide an extension implementation
11+
impl Drop for int {
12+
//~^ ERROR the Drop trait may only be implemented on structures
13+
//~^^ ERROR cannot provide an extension implementation
1714
fn drop(&mut self) {
1815
println!("kaboom");
1916
}

src/test/compile-fail/dst-bad-assign-2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ pub fn main() {
4242
// Assignment.
4343
let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
4444
let z: Box<ToBar> = box Bar1 {f: 36};
45-
f5.ptr = *z; //~ ERROR dynamically sized type on lhs of assignment
46-
//~^ ERROR E0161
45+
f5.ptr = *z;
46+
//~^ ERROR the trait `core::kinds::Sized` is not implemented
4747
}

src/test/compile-fail/dst-bad-assign.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ pub fn main() {
4343
let f5: &mut Fat<ToBar> = &mut Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} };
4444
let z: Box<ToBar> = box Bar1 {f: 36};
4545
f5.ptr = Bar1 {f: 36}; //~ ERROR mismatched types: expected `ToBar`, found `Bar1`
46+
//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `ToBar`
4647
}

src/test/compile-fail/dst-bad-coerce1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ pub fn main() {
2828
let f1 = Fat { ptr: Foo };
2929
let f2: &Fat<Foo> = &f1;
3030
let f3: &Fat<Bar> = f2;
31-
//~^ ERROR failed to find an implementation of trait Bar for Foo
31+
//~^ ERROR the trait `Bar` is not implemented for the type `Foo`
3232
}

src/test/compile-fail/dst-bad-coerce2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ pub fn main() {
2222
// With a vec of ints.
2323
let f1 = Fat { ptr: [1, 2, 3] };
2424
let f2: &Fat<[int, ..3]> = &f1;
25-
let f3: &mut Fat<[int]> = f2; //~ ERROR cannot borrow immutable dereference
25+
let f3: &mut Fat<[int]> = f2; //~ ERROR mismatched types
2626

2727
// With a trait.
2828
let f1 = Fat { ptr: Foo };
2929
let f2: &Fat<Foo> = &f1;
30-
let f3: &mut Fat<Bar> = f2; //~ ERROR cannot borrow immutable dereference
30+
let f3: &mut Fat<Bar> = f2; //~ ERROR mismatched types
3131
}

src/test/compile-fail/dst-bad-coercions.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ pub fn main() {
3030
let y: &T = x; //~ ERROR mismatched types
3131

3232
// Test that we cannot convert an immutable ptr to a mutable one using *-ptrs
33-
let x: &mut T = &S; //~ ERROR types differ in mutability
34-
let x: *mut T = &S; //~ ERROR types differ in mutability
35-
let x: *mut S = &S;
36-
//~^ ERROR mismatched types
33+
let x: &mut T = &S; //~ ERROR mismatched types
34+
let x: *mut T = &S; //~ ERROR mismatched types
35+
let x: *mut S = &S; //~ ERROR mismatched types
3736

3837
// The below four sets of tests test that we cannot implicitly deref a *-ptr
3938
// during a coercion.

src/test/compile-fail/dst-bad-deep.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@ pub fn main() {
2121
let f: Fat<[int, ..3]> = Fat { ptr: [5i, 6, 7] };
2222
let g: &Fat<[int]> = &f;
2323
let h: &Fat<Fat<[int]>> = &Fat { ptr: *g };
24-
//~^ ERROR trying to initialise a dynamically sized struct
25-
//~^^ ERROR E0161
24+
//~^ ERROR the trait `core::kinds::Sized` is not implemented
2625
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// Check that when you implement a trait that has a sized type
12+
// parameter, the corresponding value must be sized. Also that the
13+
// self type must be sized if appropriate.
14+
15+
trait Foo<T> { fn take(self, x: &T) { } } // Note: T is sized
16+
17+
impl Foo<[int]> for uint { }
18+
//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[int]`
19+
20+
impl Foo<int> for [uint] { }
21+
//~^ ERROR the trait `core::kinds::Sized` is not implemented for the type `[uint]`
22+
23+
pub fn main() { }

src/test/compile-fail/error-should-say-copy-not-pod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
fn check_bound<T:Copy>(_: T) {}
1414

1515
fn main() {
16-
check_bound("nocopy".to_string()); //~ ERROR does not fulfill `Copy`
16+
check_bound("nocopy".to_string()); //~ ERROR the trait `core::kinds::Copy` is not implemented
1717
}

src/test/compile-fail/ifmt-unimpl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@
1010

1111
fn main() {
1212
format!("{:d}", "3");
13-
//~^ ERROR: failed to find an implementation of trait core::fmt::Signed
13+
//~^ ERROR: the trait `core::fmt::Signed` is not implemented
1414
}

src/test/compile-fail/impl-bounds-checking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ trait Getter<T: Clone2> {
1717
fn get(&self) -> T;
1818
}
1919

20-
impl Getter<int> for int { //~ ERROR failed to find an implementation of trait Clone2 for int
20+
impl Getter<int> for int { //~ ERROR the trait `Clone2` is not implemented
2121
fn get(&self) -> int { *self }
2222
}
2323

src/test/compile-fail/issue-14915.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ fn main() {
1515
let y: Gc<int> = box (GC) 0;
1616

1717
println!("{}", x + 1); //~ ERROR binary operation `+` cannot be applied to type `Box<int>`
18-
//~^ ERROR cannot determine a type for this bounded type parameter: unconstrained type
18+
//~^ ERROR unable to infer enough type information
1919
println!("{}", y + 1);
2020
//~^ ERROR binary operation `+` cannot be applied to type `Gc<int>`
21-
//~^^ ERROR cannot determine a type for this bounded type parameter: unconstrained type
21+
//~^^ ERROR unable to infer enough type information
2222
}

src/test/compile-fail/issue-3907-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ struct S {
1717
name: int
1818
}
1919

20-
fn bar(_x: Foo) {} //~ ERROR variable `_x` has dynamically sized type
20+
fn bar(_x: Foo) {} //~ ERROR the trait `core::kinds::Sized` is not implemented
2121

2222
fn main() {}

src/test/compile-fail/issue-5035-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
trait I {}
1212
type K = I+'static;
1313

14-
fn foo(_x: K) {} //~ ERROR: variable `_x` has dynamically sized type
14+
fn foo(_x: K) {} //~ ERROR: the trait `core::kinds::Sized` is not implemented
1515

1616
fn main() {}

src/test/compile-fail/issue-5883.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ struct Struct {
1515
}
1616

1717
fn new_struct(r: A+'static) -> Struct {
18-
//~^ ERROR variable `r` has dynamically sized type
19-
Struct { r: r } //~ ERROR trying to initialise a dynamically sized struct
20-
//~^ ERROR E0161
21-
//~^^ ERROR E0161
18+
//~^ ERROR the trait `core::kinds::Sized` is not implemented
19+
Struct { r: r }
20+
//~^ ERROR the trait `core::kinds::Sized` is not implemented
2221
}
2322

2423
trait Curve {}

src/test/compile-fail/issue-6458-2.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
extern crate debug;
1212

1313
fn main() {
14-
format!("{:?}", None); //~ ERROR: cannot determine a type for this bounded
14+
// Unconstrained type:
15+
format!("{:?}", None); //~ ERROR: E0101
1516
}

src/test/compile-fail/issue-7013.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,5 @@ struct A {
3232

3333
fn main() {
3434
let a = A {v: box B{v: None} as Box<Foo+Send>};
35-
//~^ ERROR cannot pack type `Box<B>`, which does not fulfill `Send`, as a trait bounded by Send
36-
let v = Rc::new(RefCell::new(a));
37-
let w = v.clone();
38-
let b = &*v;
39-
let mut b = b.borrow_mut();
40-
b.v.set(w.clone());
35+
//~^ ERROR the trait `core::kinds::Send` is not implemented for the type `B`
4136
}

src/test/compile-fail/kindck-copy.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,29 +34,29 @@ fn test<'a,T,U:Copy>(_: &'a int) {
3434
assert_copy::<&'a [int]>();
3535

3636
// ...unless they are mutable
37-
assert_copy::<&'static mut int>(); //~ ERROR does not fulfill
38-
assert_copy::<&'a mut int>(); //~ ERROR does not fulfill
37+
assert_copy::<&'static mut int>(); //~ ERROR `core::kinds::Copy` is not implemented
38+
assert_copy::<&'a mut int>(); //~ ERROR `core::kinds::Copy` is not implemented
3939

4040
// ~ pointers are not ok
41-
assert_copy::<Box<int>>(); //~ ERROR does not fulfill
42-
assert_copy::<String>(); //~ ERROR does not fulfill
43-
assert_copy::<Vec<int> >(); //~ ERROR does not fulfill
44-
assert_copy::<Box<&'a mut int>>(); //~ ERROR does not fulfill
41+
assert_copy::<Box<int>>(); //~ ERROR `core::kinds::Copy` is not implemented
42+
assert_copy::<String>(); //~ ERROR `core::kinds::Copy` is not implemented
43+
assert_copy::<Vec<int> >(); //~ ERROR `core::kinds::Copy` is not implemented
44+
assert_copy::<Box<&'a mut int>>(); //~ ERROR `core::kinds::Copy` is not implemented
4545

4646
// borrowed object types are generally ok
4747
assert_copy::<&'a Dummy>();
4848
assert_copy::<&'a Dummy+Copy>();
4949
assert_copy::<&'static Dummy+Copy>();
5050

5151
// owned object types are not ok
52-
assert_copy::<Box<Dummy>>(); //~ ERROR does not fulfill
53-
assert_copy::<Box<Dummy+Copy>>(); //~ ERROR does not fulfill
52+
assert_copy::<Box<Dummy>>(); //~ ERROR `core::kinds::Copy` is not implemented
53+
assert_copy::<Box<Dummy+Copy>>(); //~ ERROR `core::kinds::Copy` is not implemented
5454

5555
// mutable object types are not ok
56-
assert_copy::<&'a mut Dummy+Copy>(); //~ ERROR does not fulfill
56+
assert_copy::<&'a mut Dummy+Copy>(); //~ ERROR `core::kinds::Copy` is not implemented
5757

5858
// closures are like an `&mut` object
59-
assert_copy::<||>(); //~ ERROR does not fulfill
59+
assert_copy::<||>(); //~ ERROR `core::kinds::Copy` is not implemented
6060

6161
// unsafe ptrs are ok
6262
assert_copy::<*const int>();
@@ -74,11 +74,11 @@ fn test<'a,T,U:Copy>(_: &'a int) {
7474
assert_copy::<MyStruct>();
7575

7676
// structs containing non-POD are not ok
77-
assert_copy::<MyNoncopyStruct>(); //~ ERROR does not fulfill
77+
assert_copy::<MyNoncopyStruct>(); //~ ERROR `core::kinds::Copy` is not implemented
7878

7979
// managed or ref counted types are not ok
80-
assert_copy::<Gc<int>>(); //~ ERROR does not fulfill
81-
assert_copy::<Rc<int>>(); //~ ERROR does not fulfill
80+
assert_copy::<Gc<int>>(); //~ ERROR `core::kinds::Copy` is not implemented
81+
assert_copy::<Rc<int>>(); //~ ERROR `core::kinds::Copy` is not implemented
8282
}
8383

8484
pub fn main() {

src/test/compile-fail/kindck-impl-type-params-2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ fn take_param<T:Foo>(foo: &T) { }
1919
fn main() {
2020
let x = box 3i;
2121
take_param(&x);
22-
//~^ ERROR instantiating a type parameter with an incompatible type
22+
//~^ ERROR the trait `core::kinds::Copy` is not implemented
2323
}

0 commit comments

Comments
 (0)