Skip to content

Commit 13cee1e

Browse files
committed
This new caching sometimes suppresses duplicate errors that occur in
different parts of the crate, so modify the test cases that were relying on that to test distinct types etc.
1 parent f0f13f8 commit 13cee1e

7 files changed

+31
-20
lines changed

src/test/compile-fail/associated-types-path-2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ pub fn f1_uint_uint() {
4545
pub fn f1_uint_int() {
4646
f1(2u32, 4i32);
4747
//~^ ERROR the trait `Foo` is not implemented
48-
//~| ERROR the trait `Foo` is not implemented
4948
}
5049

5150
pub fn f2_int() {

src/test/compile-fail/dst-object-from-unsized-type.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
trait Foo { fn foo(&self) {} }
1414
impl Foo for str {}
15+
impl Foo for [u8] {}
1516

1617
fn test1<T: ?Sized + Foo>(t: &T) {
1718
let u: &Foo = t;
@@ -28,9 +29,9 @@ fn test3() {
2829
//~^ ERROR `core::marker::Sized` is not implemented for the type `str`
2930
}
3031

31-
fn test4() {
32-
let _: &Foo = "hi" as &Foo;
33-
//~^ ERROR `core::marker::Sized` is not implemented for the type `str`
32+
fn test4(x: &[u8]) {
33+
let _: &Foo = x as &Foo;
34+
//~^ ERROR `core::marker::Sized` is not implemented for the type `[u8]`
3435
}
3536

3637
fn main() { }

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,10 @@ fn foo2<'a>() {
5050
}
5151

5252
fn foo3<'a>() {
53-
let t: Box<S<String>> = box S(marker::PhantomData);
54-
let a: Box<Gettable<String>> = t;
53+
struct Foo; // does not impl Copy
54+
55+
let t: Box<S<Foo>> = box S(marker::PhantomData);
56+
let a: Box<Gettable<Foo>> = t;
5557
//~^ ERROR the trait `core::marker::Copy` is not implemented
5658
}
5759

src/test/compile-fail/trait-bounds-on-structs-and-enums.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct TupleLike(
5252
);
5353

5454
enum Enum {
55-
DictionaryLike { field: Bar<i32> }, //~ ERROR not implemented
55+
DictionaryLike { field: Bar<u8> }, //~ ERROR not implemented
5656
}
5757

5858
trait PolyTrait<T>
@@ -62,7 +62,7 @@ trait PolyTrait<T>
6262

6363
struct Struct;
6464

65-
impl PolyTrait<Foo<usize>> for Struct {
65+
impl PolyTrait<Foo<u16>> for Struct {
6666
//~^ ERROR not implemented
6767
}
6868

src/test/compile-fail/traits-negative-impls.rs

+18-9
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ use std::marker::Send;
1919

2020
struct Outer<T: Send>(T);
2121

22-
struct TestType;
23-
impl !Send for TestType {}
24-
2522
struct Outer2<T>(T);
2623

2724
unsafe impl<T: Send> Sync for Outer2<T> {}
@@ -30,29 +27,41 @@ fn is_send<T: Send>(_: T) {}
3027
fn is_sync<T: Sync>(_: T) {}
3128

3229
fn dummy() {
30+
struct TestType;
31+
impl !Send for TestType {}
32+
3333
Outer(TestType);
34-
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
34+
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
3535

3636
is_send(TestType);
37-
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
37+
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
3838

3939
is_send((8, TestType));
40-
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
40+
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy::TestType`
4141
}
4242

4343
fn dummy2() {
44+
struct TestType;
45+
impl !Send for TestType {}
46+
4447
is_send(Box::new(TestType));
45-
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
48+
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy2::TestType`
4649
}
4750

4851
fn dummy3() {
52+
struct TestType;
53+
impl !Send for TestType {}
54+
4955
is_send(Box::new(Outer2(TestType)));
50-
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
56+
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `dummy3::TestType`
5157
}
5258

5359
fn main() {
60+
struct TestType;
61+
impl !Send for TestType {}
62+
5463
// This will complain about a missing Send impl because `Sync` is implement *just*
5564
// for T that are `Send`. Look at #20366 and #19950
5665
is_sync(Outer2(TestType));
57-
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `TestType`
66+
//~^ ERROR the trait `core::marker::Send` is not implemented for the type `main::TestType`
5867
}

src/test/compile-fail/typeck-default-trait-impl-trait-where-clause.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ fn test() {
4040
}
4141

4242
fn main() {
43-
foo::<i32>();
44-
//~^ ERROR the trait `NotImplemented` is not implemented for the type `core::option::Option<i32>`
43+
foo::<u32>();
44+
//~^ ERROR the trait `NotImplemented` is not implemented for the type `core::option::Option<u32>`
4545
}

src/test/compile-fail/unsized5.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct S3 {
2424
g: [usize]
2525
}
2626
struct S4 {
27-
f: str, //~ ERROR `core::marker::Sized` is not implemented
27+
f: [u8], //~ ERROR `core::marker::Sized` is not implemented
2828
g: usize
2929
}
3030
enum E<X: ?Sized> {

0 commit comments

Comments
 (0)