Skip to content

Commit 21ddce3

Browse files
committed
Remove expected duplicate errors in UI tests
- coroutine/auto-trait-regions.rs: also reformulate the test to make sure we don't miss errors -- just duplicate ones. - traits/trait-upcasting/higher-ranked-upcasting-ub.rs: remove duplicate ERROR mismatched types - ui/associated-types/associated-types-eq-hr.rs: remove 5 duplicate errors for "implementation not general enough" and mismatched types" - ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs: two redundant higher-ranked subtype errors
1 parent 31b7743 commit 21ddce3

8 files changed

Lines changed: 29 additions & 116 deletions

tests/ui/associated-types/associated-types-eq-hr.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,11 @@ pub fn call_tuple_one() {
9696
tuple_one::<Tuple>();
9797
//~^ ERROR not general enough
9898
//~| ERROR not general enough
99-
//~| ERROR not general enough
100-
//~| ERROR not general enough
10199
}
102100

103101
pub fn call_tuple_two() {
104102
tuple_two::<Tuple>();
105103
//~^ ERROR not general enough
106-
//~| ERROR not general enough
107-
//~| ERROR mismatched types
108104
//~| ERROR mismatched types
109105
}
110106

@@ -115,7 +111,6 @@ pub fn call_tuple_three() {
115111
pub fn call_tuple_four() {
116112
tuple_four::<Tuple>();
117113
//~^ ERROR not general enough
118-
//~| ERROR not general enough
119114
}
120115

121116
fn main() {}

tests/ui/associated-types/associated-types-eq-hr.stderr

Lines changed: 4 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -62,60 +62,16 @@ LL | tuple_one::<Tuple>();
6262
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
6363

6464
error: implementation of `TheTrait` is not general enough
65-
--> $DIR/associated-types-eq-hr.rs:96:5
66-
|
67-
LL | tuple_one::<Tuple>();
68-
| ^^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
69-
|
70-
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
71-
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
72-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
73-
74-
error: implementation of `TheTrait` is not general enough
75-
--> $DIR/associated-types-eq-hr.rs:96:5
76-
|
77-
LL | tuple_one::<Tuple>();
78-
| ^^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
79-
|
80-
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
81-
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
82-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
83-
84-
error: implementation of `TheTrait` is not general enough
85-
--> $DIR/associated-types-eq-hr.rs:104:5
86-
|
87-
LL | tuple_two::<Tuple>();
88-
| ^^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
89-
|
90-
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
91-
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
92-
93-
error: implementation of `TheTrait` is not general enough
94-
--> $DIR/associated-types-eq-hr.rs:104:5
65+
--> $DIR/associated-types-eq-hr.rs:102:5
9566
|
9667
LL | tuple_two::<Tuple>();
9768
| ^^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
9869
|
9970
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
10071
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
101-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
102-
103-
error[E0308]: mismatched types
104-
--> $DIR/associated-types-eq-hr.rs:104:5
105-
|
106-
LL | tuple_two::<Tuple>();
107-
| ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
108-
|
109-
= note: expected reference `&'x _`
110-
found reference `&'y _`
111-
note: the lifetime requirement is introduced here
112-
--> $DIR/associated-types-eq-hr.rs:66:53
113-
|
114-
LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>,
115-
| ^^^^^^^^^^^^^
11672

11773
error[E0308]: mismatched types
118-
--> $DIR/associated-types-eq-hr.rs:104:5
74+
--> $DIR/associated-types-eq-hr.rs:102:5
11975
|
12076
LL | tuple_two::<Tuple>();
12177
| ^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
@@ -127,28 +83,17 @@ note: the lifetime requirement is introduced here
12783
|
12884
LL | T: for<'x, 'y> TheTrait<(&'x isize, &'y isize), A = &'y isize>,
12985
| ^^^^^^^^^^^^^
130-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
13186

13287
error: implementation of `TheTrait` is not general enough
133-
--> $DIR/associated-types-eq-hr.rs:116:5
88+
--> $DIR/associated-types-eq-hr.rs:112:5
13489
|
13590
LL | tuple_four::<Tuple>();
13691
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
13792
|
13893
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
13994
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
14095

141-
error: implementation of `TheTrait` is not general enough
142-
--> $DIR/associated-types-eq-hr.rs:116:5
143-
|
144-
LL | tuple_four::<Tuple>();
145-
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `TheTrait` is not general enough
146-
|
147-
= note: `Tuple` must implement `TheTrait<(&'0 isize, &'1 isize)>`, for any two lifetimes `'0` and `'1`...
148-
= note: ...but it actually implements `TheTrait<(&'2 isize, &'2 isize)>`, for some specific lifetime `'2`
149-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
150-
151-
error: aborting due to 12 previous errors
96+
error: aborting due to 7 previous errors
15297

15398
Some errors have detailed explanations: E0271, E0308.
15499
For more information about an error, try `rustc --explain E0271`.

tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,8 @@ fn foo() -> impl Sized {
1414
loop {
1515
match foo() {
1616
//~^ ERROR higher-ranked subtype error
17-
//~^^ ERROR higher-ranked subtype error
1817
Subtype::Bar => (),
1918
//~^ ERROR higher-ranked subtype error
20-
//~^^ ERROR higher-ranked subtype error
2119
Supertype::Var(x) => {}
2220
}
2321
}

tests/ui/borrowck/opaque-types-patterns-subtyping-ice-104779.stderr

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,10 @@ LL | match foo() {
1717
| ^^^^^
1818

1919
error: higher-ranked subtype error
20-
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:15:15
21-
|
22-
LL | match foo() {
23-
| ^^^^^
24-
|
25-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
26-
27-
error: higher-ranked subtype error
28-
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
20+
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:17:13
2921
|
3022
LL | Subtype::Bar => (),
3123
| ^^^^^^^^^^^^
3224

33-
error: higher-ranked subtype error
34-
--> $DIR/opaque-types-patterns-subtyping-ice-104779.rs:18:13
35-
|
36-
LL | Subtype::Bar => (),
37-
| ^^^^^^^^^^^^
38-
|
39-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
40-
41-
error: aborting due to 4 previous errors; 1 warning emitted
25+
error: aborting due to 2 previous errors; 1 warning emitted
4226

tests/ui/coroutine/auto-trait-regions.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ impl<'a> Foo for &'a OnlyFooIfRef {}
2020

2121
fn assert_foo<T: Foo>(f: T) {}
2222

23+
fn other_assertion() {
24+
// Disallow impls which relates lifetimes in the coroutine interior
25+
let generator = #[coroutine] move || {
26+
let a = A(&mut true, &mut true, No);
27+
//~^ ERROR borrow may still be in use when coroutine yields
28+
//~| ERROR borrow may still be in use when coroutine yields
29+
yield;
30+
assert_foo(a);
31+
};
32+
assert_foo(generator);
33+
//~^ ERROR not general enough
34+
}
35+
2336
fn main() {
2437
// Make sure 'static is erased for coroutine interiors so we can't match it in trait selection
2538
let x: &'static _ = &OnlyFooIfStaticRef(No);
@@ -39,15 +52,4 @@ fn main() {
3952
assert_foo(x);
4053
};
4154
assert_foo(generator); // ok
42-
43-
// Disallow impls which relates lifetimes in the coroutine interior
44-
let generator = #[coroutine] move || {
45-
let a = A(&mut true, &mut true, No);
46-
//~^ ERROR borrow may still be in use when coroutine yields
47-
//~| ERROR borrow may still be in use when coroutine yields
48-
yield;
49-
assert_foo(a);
50-
};
51-
assert_foo(generator);
52-
//~^ ERROR not general enough
5355
}

tests/ui/coroutine/auto-trait-regions.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0626]: borrow may still be in use when coroutine yields
2-
--> $DIR/auto-trait-regions.rs:45:19
2+
--> $DIR/auto-trait-regions.rs:26:19
33
|
44
LL | let generator = #[coroutine] move || {
55
| ------- within this coroutine
@@ -15,7 +15,7 @@ LL | let generator = #[coroutine] static move || {
1515
| ++++++
1616

1717
error[E0626]: borrow may still be in use when coroutine yields
18-
--> $DIR/auto-trait-regions.rs:45:30
18+
--> $DIR/auto-trait-regions.rs:26:30
1919
|
2020
LL | let generator = #[coroutine] move || {
2121
| ------- within this coroutine
@@ -31,22 +31,22 @@ LL | let generator = #[coroutine] static move || {
3131
| ++++++
3232

3333
error: implementation of `Foo` is not general enough
34-
--> $DIR/auto-trait-regions.rs:31:5
34+
--> $DIR/auto-trait-regions.rs:32:5
3535
|
3636
LL | assert_foo(generator);
3737
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
3838
|
39-
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
40-
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
39+
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
40+
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
4141

4242
error: implementation of `Foo` is not general enough
43-
--> $DIR/auto-trait-regions.rs:51:5
43+
--> $DIR/auto-trait-regions.rs:44:5
4444
|
4545
LL | assert_foo(generator);
4646
| ^^^^^^^^^^^^^^^^^^^^^ implementation of `Foo` is not general enough
4747
|
48-
= note: `Foo` would have to be implemented for the type `A<'0, '1>`, for any two lifetimes `'0` and `'1`...
49-
= note: ...but `Foo` is actually implemented for the type `A<'_, '2>`, for some specific lifetime `'2`
48+
= note: `&'0 OnlyFooIfStaticRef` must implement `Foo`, for any lifetime `'0`...
49+
= note: ...but `Foo` is actually implemented for the type `&'static OnlyFooIfStaticRef`
5050

5151
error: aborting due to 4 previous errors
5252

tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ub.current.stderr

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,6 @@ LL | x
77
= note: expected existential trait ref `for<'a, 'b> Supertrait<'a, 'b>`
88
found existential trait ref `for<'a> Supertrait<'a, 'a>`
99

10-
error[E0308]: mismatched types
11-
--> $DIR/higher-ranked-upcasting-ub.rs:22:5
12-
|
13-
LL | x
14-
| ^ one type is more general than the other
15-
|
16-
= note: expected existential trait ref `for<'a, 'b> Supertrait<'a, 'b>`
17-
found existential trait ref `for<'a> Supertrait<'a, 'a>`
18-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
19-
20-
error: aborting due to 2 previous errors
10+
error: aborting due to 1 previous error
2111

2212
For more information about this error, try `rustc --explain E0308`.

tests/ui/traits/trait-upcasting/higher-ranked-upcasting-ub.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ impl<'a> Subtrait<'a, 'a> for () {}
2121
fn unsound(x: &dyn for<'a> Subtrait<'a, 'a>) -> &dyn for<'a, 'b> Supertrait<'a, 'b> {
2222
x
2323
//[current]~^ ERROR mismatched types
24-
//[current]~| ERROR mismatched types
25-
//[next]~^^^ ERROR the trait bound `&dyn for<'a> Subtrait<'a, 'a>: CoerceUnsized<&dyn for<'a, 'b> Supertrait<'a, 'b>>` is not satisfied
24+
//[next]~^^ ERROR the trait bound `&dyn for<'a> Subtrait<'a, 'a>: CoerceUnsized<&dyn for<'a, 'b> Supertrait<'a, 'b>>` is not satisfied
2625
}
2726

2827
fn transmute<'a, 'b>(x: &'a str) -> &'b str {

0 commit comments

Comments
 (0)