Skip to content

Commit ce5f8c9

Browse files
Bless test fallout (duplicate diagnostics)
1 parent aa39dbb commit ce5f8c9

File tree

54 files changed

+571
-128
lines changed

Some content is hidden

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

54 files changed

+571
-128
lines changed

src/tools/clippy/clippy_lints/src/future_not_send.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6464
}
6565
let ret_ty = return_ty(cx, cx.tcx.local_def_id_to_hir_id(fn_def_id).expect_owner());
6666
if let ty::Alias(ty::Opaque, AliasTy { def_id, args, .. }) = *ret_ty.kind() {
67-
let preds = cx.tcx.explicit_item_bounds(def_id);
67+
let preds = cx.tcx.explicit_item_super_predicates(def_id);
6868
let mut is_future = false;
6969
for (p, _span) in preds.iter_instantiated_copied(cx.tcx, args) {
7070
if let Some(trait_pred) = p.as_trait_clause() {

src/tools/clippy/clippy_utils/src/ty.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
9696
return false;
9797
}
9898

99-
for (predicate, _span) in cx.tcx.explicit_item_bounds(def_id).instantiate_identity_iter_copied() {
99+
for (predicate, _span) in cx.tcx.explicit_item_super_predicates(def_id).instantiate_identity_iter_copied() {
100100
match predicate.kind().skip_binder() {
101101
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
102102
// and check substitutions to find `U`.
@@ -328,7 +328,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
328328
},
329329
ty::Tuple(args) => args.iter().any(|ty| is_must_use_ty(cx, ty)),
330330
ty::Alias(ty::Opaque, ty::AliasTy { def_id, .. }) => {
331-
for (predicate, _) in cx.tcx.explicit_item_bounds(def_id).skip_binder() {
331+
for (predicate, _) in cx.tcx.explicit_item_super_predicates(def_id).skip_binder() {
332332
if let ty::ClauseKind::Trait(trait_predicate) = predicate.kind().skip_binder() {
333333
if cx.tcx.has_attr(trait_predicate.trait_ref.def_id, sym::must_use) {
334334
return true;
@@ -729,7 +729,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
729729
ty::Alias(ty::Opaque, ty::AliasTy { def_id, args, .. }) => sig_from_bounds(
730730
cx,
731731
ty,
732-
cx.tcx.item_bounds(def_id).iter_instantiated(cx.tcx, args),
732+
cx.tcx.item_super_predicates(def_id).iter_instantiated(cx.tcx, args),
733733
cx.tcx.opt_parent(def_id),
734734
),
735735
ty::FnPtr(sig) => Some(ExprFnSig::Sig(sig, None)),
@@ -807,7 +807,7 @@ fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option
807807

808808
for (pred, _) in cx
809809
.tcx
810-
.explicit_item_bounds(ty.def_id)
810+
.explicit_item_super_predicates(ty.def_id)
811811
.iter_instantiated_copied(cx.tcx, ty.args)
812812
{
813813
match pred.kind().skip_binder() {

tests/rustdoc-ui/invalid_associated_const.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
trait T {
44
type A: S<C<X = 0i32> = 34>;
55
//~^ ERROR associated type bindings are not allowed here
6+
//~| ERROR associated type bindings are not allowed here
67
}
78

89
trait S {

tests/rustdoc-ui/invalid_associated_const.stderr

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
44
LL | type A: S<C<X = 0i32> = 34>;
55
| ^^^^^^^^ associated type not allowed here
66

7-
error: aborting due to 1 previous error
7+
error[E0229]: associated type bindings are not allowed here
8+
--> $DIR/invalid_associated_const.rs:4:17
9+
|
10+
LL | type A: S<C<X = 0i32> = 34>;
11+
| ^^^^^^^^ associated type not allowed here
12+
|
13+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
14+
15+
error: aborting due to 2 previous errors
816

917
For more information about this error, try `rustc --explain E0229`.

tests/rustdoc-ui/issue-102467.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
trait T {
77
type A: S<C<X = 0i32> = 34>;
88
//~^ ERROR associated type bindings are not allowed here
9+
//~| ERROR associated type bindings are not allowed here
910
}
1011

1112
trait S {

tests/rustdoc-ui/issue-102467.stderr

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
44
LL | type A: S<C<X = 0i32> = 34>;
55
| ^^^^^^^^ associated type not allowed here
66

7-
error: aborting due to 1 previous error
7+
error[E0229]: associated type bindings are not allowed here
8+
--> $DIR/issue-102467.rs:7:17
9+
|
10+
LL | type A: S<C<X = 0i32> = 34>;
11+
| ^^^^^^^^ associated type not allowed here
12+
|
13+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
14+
15+
error: aborting due to 2 previous errors
816

917
For more information about this error, try `rustc --explain E0229`.

tests/rustdoc-ui/issues/issue-96287.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ pub trait TraitWithAssoc {
66

77
pub type Foo<V> = impl Trait<V::Assoc>;
88
//~^ ERROR
9+
//~| ERROR
910

1011
pub trait Trait<U> {}
1112

tests/rustdoc-ui/issues/issue-96287.stderr

+13-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,18 @@ help: consider restricting type parameter `V`
99
LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
1010
| ++++++++++++++++
1111

12-
error: aborting due to 1 previous error
12+
error[E0220]: associated type `Assoc` not found for `V`
13+
--> $DIR/issue-96287.rs:7:33
14+
|
15+
LL | pub type Foo<V> = impl Trait<V::Assoc>;
16+
| ^^^^^ there is an associated type `Assoc` in the trait `TraitWithAssoc`
17+
|
18+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
19+
help: consider restricting type parameter `V`
20+
|
21+
LL | pub type Foo<V: TraitWithAssoc> = impl Trait<V::Assoc>;
22+
| ++++++++++++++++
23+
24+
error: aborting due to 2 previous errors
1325

1426
For more information about this error, try `rustc --explain E0220`.

tests/ui/associated-consts/assoc-const-eq-param-in-ty.rs

+14
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,19 @@ fn take2<P: Project<SELF = {}>>(_: P) {}
3737

3838
trait Iface<'r> {
3939
//~^ NOTE the lifetime parameter `'r` is defined here
40+
//~| NOTE the lifetime parameter `'r` is defined here
4041
type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
4142
//~^ ERROR the type of the associated constant `K` must not depend on generic parameters
43+
//~| ERROR the type of the associated constant `K` must not depend on generic parameters
44+
//~| NOTE its type must not depend on the lifetime parameter `'r`
45+
//~| NOTE `K` has type `&'r [Self; Q]`
46+
//~| ERROR the type of the associated constant `K` must not depend on `Self`
47+
//~| NOTE its type must not depend on `Self`
48+
//~| NOTE `K` has type `&'r [Self; Q]`
49+
//~| ERROR the type of the associated constant `K` must not depend on generic parameters
50+
//~| NOTE its type must not depend on the const parameter `Q`
51+
//~| NOTE the const parameter `Q` is defined here
52+
//~| NOTE `K` has type `&'r [Self; Q]`
4253
//~| NOTE its type must not depend on the lifetime parameter `'r`
4354
//~| NOTE `K` has type `&'r [Self; Q]`
4455
//~| ERROR the type of the associated constant `K` must not depend on `Self`
@@ -48,6 +59,9 @@ trait Iface<'r> {
4859
//~| NOTE its type must not depend on the const parameter `Q`
4960
//~| NOTE the const parameter `Q` is defined here
5061
//~| NOTE `K` has type `&'r [Self; Q]`
62+
//~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
63+
//~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
64+
//~| NOTE duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5165
where
5266
Self: Sized + 'r;
5367
}

tests/ui/associated-consts/assoc-const-eq-param-in-ty.stderr

+37-5
Original file line numberDiff line numberDiff line change
@@ -44,26 +44,26 @@ LL | fn take2<P: Project<SELF = {}>>(_: P) {}
4444
= note: `SELF` has type `P`
4545

4646
error: the type of the associated constant `K` must not depend on generic parameters
47-
--> $DIR/assoc-const-eq-param-in-ty.rs:40:52
47+
--> $DIR/assoc-const-eq-param-in-ty.rs:41:52
4848
|
4949
LL | trait Iface<'r> {
5050
| -- the lifetime parameter `'r` is defined here
51-
LL |
51+
...
5252
LL | type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
5353
| ^ its type must not depend on the lifetime parameter `'r`
5454
|
5555
= note: `K` has type `&'r [Self; Q]`
5656

5757
error: the type of the associated constant `K` must not depend on `Self`
58-
--> $DIR/assoc-const-eq-param-in-ty.rs:40:52
58+
--> $DIR/assoc-const-eq-param-in-ty.rs:41:52
5959
|
6060
LL | type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
6161
| ^ its type must not depend on `Self`
6262
|
6363
= note: `K` has type `&'r [Self; Q]`
6464

6565
error: the type of the associated constant `K` must not depend on generic parameters
66-
--> $DIR/assoc-const-eq-param-in-ty.rs:40:52
66+
--> $DIR/assoc-const-eq-param-in-ty.rs:41:52
6767
|
6868
LL | type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
6969
| - ^ its type must not depend on the const parameter `Q`
@@ -72,5 +72,37 @@ LL | type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
7272
|
7373
= note: `K` has type `&'r [Self; Q]`
7474

75-
error: aborting due to 8 previous errors
75+
error: the type of the associated constant `K` must not depend on generic parameters
76+
--> $DIR/assoc-const-eq-param-in-ty.rs:41:52
77+
|
78+
LL | trait Iface<'r> {
79+
| -- the lifetime parameter `'r` is defined here
80+
...
81+
LL | type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
82+
| ^ its type must not depend on the lifetime parameter `'r`
83+
|
84+
= note: `K` has type `&'r [Self; Q]`
85+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
86+
87+
error: the type of the associated constant `K` must not depend on `Self`
88+
--> $DIR/assoc-const-eq-param-in-ty.rs:41:52
89+
|
90+
LL | type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
91+
| ^ its type must not depend on `Self`
92+
|
93+
= note: `K` has type `&'r [Self; Q]`
94+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
95+
96+
error: the type of the associated constant `K` must not depend on generic parameters
97+
--> $DIR/assoc-const-eq-param-in-ty.rs:41:52
98+
|
99+
LL | type Assoc<const Q: usize>: Trait<'r, Self, Q, K = { loop {} }>
100+
| - ^ its type must not depend on the const parameter `Q`
101+
| |
102+
| the const parameter `Q` is defined here
103+
|
104+
= note: `K` has type `&'r [Self; Q]`
105+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
106+
107+
error: aborting due to 11 previous errors
76108

tests/ui/associated-consts/issue-102335-const.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
trait T {
44
type A: S<C<X = 0i32> = 34>;
55
//~^ ERROR associated type bindings are not allowed here
6+
//~| ERROR associated type bindings are not allowed here
67
}
78

89
trait S {

tests/ui/associated-consts/issue-102335-const.stderr

+9-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ error[E0229]: associated type bindings are not allowed here
44
LL | type A: S<C<X = 0i32> = 34>;
55
| ^^^^^^^^ associated type not allowed here
66

7-
error: aborting due to 1 previous error
7+
error[E0229]: associated type bindings are not allowed here
8+
--> $DIR/issue-102335-const.rs:4:17
9+
|
10+
LL | type A: S<C<X = 0i32> = 34>;
11+
| ^^^^^^^^ associated type not allowed here
12+
|
13+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
14+
15+
error: aborting due to 2 previous errors
816

917
For more information about this error, try `rustc --explain E0229`.

tests/ui/associated-inherent-types/issue-109299-1.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ impl Lexer<i32> {
77
type Cursor = ();
88
}
99

10-
type X = impl for<T> Fn() -> Lexer<T>::Cursor; //~ ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
11-
//~^ ERROR: unconstrained opaque type
10+
type X = impl for<T> Fn() -> Lexer<T>::Cursor;
11+
//~^ ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
12+
//~| ERROR associated type `Cursor` not found for `Lexer<T>` in the current scope
13+
//~| ERROR: unconstrained opaque type
1214

1315
fn main() {}

tests/ui/associated-inherent-types/issue-109299-1.stderr

+14-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,19 @@ LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
1010
= note: the associated type was found for
1111
- `Lexer<i32>`
1212

13+
error[E0220]: associated type `Cursor` not found for `Lexer<T>` in the current scope
14+
--> $DIR/issue-109299-1.rs:10:40
15+
|
16+
LL | struct Lexer<T>(T);
17+
| --------------- associated item `Cursor` not found for this struct
18+
...
19+
LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
20+
| ^^^^^^ associated item not found in `Lexer<T>`
21+
|
22+
= note: the associated type was found for
23+
- `Lexer<i32>`
24+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
25+
1326
error: unconstrained opaque type
1427
--> $DIR/issue-109299-1.rs:10:10
1528
|
@@ -18,6 +31,6 @@ LL | type X = impl for<T> Fn() -> Lexer<T>::Cursor;
1831
|
1932
= note: `X` must be used in combination with a concrete type within the same module
2033

21-
error: aborting due to 2 previous errors
34+
error: aborting due to 3 previous errors
2235

2336
For more information about this error, try `rustc --explain E0220`.

tests/ui/associated-type-bounds/duplicate.rs

+9
Original file line numberDiff line numberDiff line change
@@ -132,16 +132,19 @@ where
132132

133133
fn FRPIT1() -> impl Iterator<Item: Copy, Item: Send> {
134134
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
135+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
135136
iter::empty()
136137
//~^ ERROR type annotations needed
137138
}
138139
fn FRPIT2() -> impl Iterator<Item: Copy, Item: Copy> {
139140
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
141+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
140142
iter::empty()
141143
//~^ ERROR type annotations needed
142144
}
143145
fn FRPIT3() -> impl Iterator<Item: 'static, Item: 'static> {
144146
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
147+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
145148
iter::empty()
146149
//~^ ERROR type annotations needed
147150
}
@@ -182,10 +185,13 @@ type ETAI3<T: Iterator<Item: 'static, Item: 'static>> = impl Copy;
182185
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
183186
type ETAI4 = impl Iterator<Item: Copy, Item: Send>;
184187
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
188+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
185189
type ETAI5 = impl Iterator<Item: Copy, Item: Copy>;
186190
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
191+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
187192
type ETAI6 = impl Iterator<Item: 'static, Item: 'static>;
188193
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
194+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
189195

190196
trait TRI1<T: Iterator<Item: Copy, Item: Send>> {}
191197
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
@@ -250,14 +256,17 @@ where
250256
trait TRA1 {
251257
type A: Iterator<Item: Copy, Item: Send>;
252258
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
259+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
253260
}
254261
trait TRA2 {
255262
type A: Iterator<Item: Copy, Item: Copy>;
256263
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
264+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
257265
}
258266
trait TRA3 {
259267
type A: Iterator<Item: 'static, Item: 'static>;
260268
//~^ ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
269+
//~| ERROR the value of the associated type `Item` in trait `Iterator` is already specified [E0719]
261270
}
262271

263272
fn main() {}

0 commit comments

Comments
 (0)