Skip to content

Commit cf33ee0

Browse files
committed
bless expectations to see diagnostics impact
1 parent 675d379 commit cf33ee0

14 files changed

+115
-108
lines changed

tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ fn take(
1212
K = { () }
1313
>,
1414
) {}
15-
//~^^^^^ ERROR implementation of `Project` is not general enough
16-
//~^^^^ ERROR higher-ranked subtype error
15+
//~^^^ ERROR higher-ranked subtype error
1716
//~| ERROR higher-ranked subtype error
1817

1918
trait Project { type Out; }

tests/ui/associated-consts/assoc-const-eq-bound-var-in-ty-not-wf.stderr

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,5 @@ LL | K = { () }
1212
|
1313
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1414

15-
error: implementation of `Project` is not general enough
16-
--> $DIR/assoc-const-eq-bound-var-in-ty-not-wf.rs:10:13
17-
|
18-
LL | _: impl Trait<
19-
| _____________^
20-
LL | | <<for<'a> fn(&'a str) -> &'a str as Project>::Out as Discard>::Out,
21-
LL | | K = { () }
22-
LL | | >,
23-
| |_____^ implementation of `Project` is not general enough
24-
|
25-
= note: `Project` would have to be implemented for the type `for<'a> fn(&'a str) -> &'a str`
26-
= note: ...but `Project` is actually implemented for the type `fn(&'0 str) -> &'0 str`, for some specific lifetime `'0`
27-
28-
error: aborting due to 3 previous errors
15+
error: aborting due to 2 previous errors
2916

tests/ui/associated-types/issue-38821.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@ pub trait Column: Expression {}
3232
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
3333
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
3434
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
35-
pub enum ColumnInsertValue<Col, Expr> where
36-
//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
37-
Col: Column,
38-
Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
39-
//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
4035
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
4136
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
4237
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
4338
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
4439
//~| ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
40+
pub enum ColumnInsertValue<Col, Expr> where
41+
//~^ ERROR the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
42+
Col: Column,
43+
Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
44+
//~^ ERROR the trait bound `<Col as Expression>::SqlType: IntoNullable` is not satisfied
4545
{
4646
Expression(Col, Expr),
4747
Default(Col),

tests/ui/associated-types/issue-38821.stderr

Lines changed: 42 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
2-
--> $DIR/issue-38821.rs:35:1
2+
--> $DIR/issue-38821.rs:40:1
33
|
44
LL | pub enum ColumnInsertValue<Col, Expr> where
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
@@ -16,8 +16,8 @@ help: consider extending the `where` clause, but there might be an alternative b
1616
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull
1717
| +++++++++++++++++++++++++++++++++++++
1818

19-
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
20-
--> $DIR/issue-38821.rs:38:22
19+
error[E0277]: the trait bound `<Col as Expression>::SqlType: IntoNullable` is not satisfied
20+
--> $DIR/issue-38821.rs:43:22
2121
|
2222
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
2323
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
@@ -82,10 +82,10 @@ LL | impl<T: NotNull> IntoNullable for T {
8282
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
8383

8484
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
85-
--> $DIR/issue-38821.rs:38:22
85+
--> $DIR/issue-38821.rs:23:10
8686
|
87-
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
88-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
87+
LL | #[derive(Debug, Copy, Clone)]
88+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
8989
|
9090
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
9191
--> $DIR/issue-38821.rs:9:18
@@ -94,6 +94,14 @@ LL | impl<T: NotNull> IntoNullable for T {
9494
| ------- ^^^^^^^^^^^^ ^
9595
| |
9696
| unsatisfied trait bound introduced here
97+
note: required for `ColumnInsertValue<Col, Expr>` to implement `Debug`
98+
--> $DIR/issue-38821.rs:23:10
99+
|
100+
LL | #[derive(Debug, Copy, Clone)]
101+
| ^^^^^
102+
...
103+
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
104+
| ------------------------------------------------ unsatisfied trait bound introduced in this `derive` macro
97105
help: consider further restricting the associated type
98106
|
99107
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -118,10 +126,10 @@ LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Co
118126
| +++++++++++++++++++++++++++++++++++++++
119127

120128
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
121-
--> $DIR/issue-38821.rs:38:22
129+
--> $DIR/issue-38821.rs:23:17
122130
|
123-
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
124-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
131+
LL | #[derive(Debug, Copy, Clone)]
132+
| ^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
125133
|
126134
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
127135
--> $DIR/issue-38821.rs:9:18
@@ -130,6 +138,14 @@ LL | impl<T: NotNull> IntoNullable for T {
130138
| ------- ^^^^^^^^^^^^ ^
131139
| |
132140
| unsatisfied trait bound introduced here
141+
note: required for `ColumnInsertValue<Col, Expr>` to implement `Copy`
142+
--> $DIR/issue-38821.rs:23:17
143+
|
144+
LL | #[derive(Debug, Copy, Clone)]
145+
| ^^^^
146+
...
147+
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
148+
| ------------------------------------------------ unsatisfied trait bound introduced in this `derive` macro
133149
help: consider further restricting the associated type
134150
|
135151
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -183,10 +199,10 @@ LL | impl<T: NotNull> IntoNullable for T {
183199
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
184200

185201
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
186-
--> $DIR/issue-38821.rs:38:22
202+
--> $DIR/issue-38821.rs:23:23
187203
|
188-
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
189-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
204+
LL | #[derive(Debug, Copy, Clone)]
205+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
190206
|
191207
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
192208
--> $DIR/issue-38821.rs:9:18
@@ -195,6 +211,14 @@ LL | impl<T: NotNull> IntoNullable for T {
195211
| ------- ^^^^^^^^^^^^ ^
196212
| |
197213
| unsatisfied trait bound introduced here
214+
note: required for `ColumnInsertValue<Col, Expr>` to implement `Clone`
215+
--> $DIR/issue-38821.rs:23:23
216+
|
217+
LL | #[derive(Debug, Copy, Clone)]
218+
| ^^^^^
219+
...
220+
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
221+
| ------------------------------------------------ unsatisfied trait bound introduced in this `derive` macro
198222
help: consider further restricting the associated type
199223
|
200224
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>, <Col as Expression>::SqlType: NotNull,
@@ -216,10 +240,10 @@ LL | impl<T: NotNull> IntoNullable for T {
216240
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
217241

218242
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
219-
--> $DIR/issue-38821.rs:38:22
243+
--> $DIR/issue-38821.rs:23:10
220244
|
221-
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
222-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
245+
LL | #[derive(Debug, Copy, Clone)]
246+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
223247
|
224248
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
225249
--> $DIR/issue-38821.rs:9:18
@@ -245,10 +269,10 @@ LL | impl<T: NotNull> IntoNullable for T {
245269
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
246270

247271
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
248-
--> $DIR/issue-38821.rs:38:22
272+
--> $DIR/issue-38821.rs:23:23
249273
|
250-
LL | Expr: Expression<SqlType=<Col::SqlType as IntoNullable>::Nullable>,
251-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
274+
LL | #[derive(Debug, Copy, Clone)]
275+
| ^^^^^ the trait `NotNull` is not implemented for `<Col as Expression>::SqlType`
252276
|
253277
note: required for `<Col as Expression>::SqlType` to implement `IntoNullable`
254278
--> $DIR/issue-38821.rs:9:18
@@ -257,7 +281,6 @@ LL | impl<T: NotNull> IntoNullable for T {
257281
| ------- ^^^^^^^^^^^^ ^
258282
| |
259283
| unsatisfied trait bound introduced here
260-
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
261284

262285
error[E0277]: the trait bound `<Col as Expression>::SqlType: NotNull` is not satisfied
263286
--> $DIR/issue-38821.rs:23:10

tests/ui/lifetimes/issue-76168-hr-outlives-3.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ async fn wrapper<F>(f: F)
1010
where
1111
F:,
1212
for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
13-
//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
14-
//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
15-
//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
1613
{
1714
//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
1815
let mut i = 41;

tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,6 @@ LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a
99
|
1010
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
1111

12-
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
13-
--> $DIR/issue-76168-hr-outlives-3.rs:12:50
14-
|
15-
LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
16-
| ^^^^^^^^^^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
17-
|
18-
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
19-
20-
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
21-
--> $DIR/issue-76168-hr-outlives-3.rs:12:57
22-
|
23-
LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
24-
| ^^^^^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
25-
|
26-
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
27-
28-
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
29-
--> $DIR/issue-76168-hr-outlives-3.rs:12:72
30-
|
31-
LL | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
32-
| ^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
33-
|
34-
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
35-
3612
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
3713
--> $DIR/issue-76168-hr-outlives-3.rs:6:1
3814
|
@@ -57,7 +33,7 @@ LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a
5733
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5834

5935
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
60-
--> $DIR/issue-76168-hr-outlives-3.rs:16:1
36+
--> $DIR/issue-76168-hr-outlives-3.rs:13:1
6137
|
6238
LL | / {
6339
LL | |
@@ -68,6 +44,6 @@ LL | | }
6844
|
6945
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
7046

71-
error: aborting due to 7 previous errors
47+
error: aborting due to 4 previous errors
7248

7349
For more information about this error, try `rustc --explain E0277`.

tests/ui/methods/filter-relevant-fn-bounds.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ impl Wrapper {
99
//~^ ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
1010
where
1111
F: for<'a> FnOnce(<F as Output<'a>>::Type),
12-
//~^ ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
13-
//~| ERROR the trait bound `for<'a> F: Output<'a>` is not satisfied
1412
{
1513
}
1614
}

tests/ui/methods/filter-relevant-fn-bounds.stderr

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,37 +12,15 @@ help: consider further restricting type parameter `F` with trait `Output`
1212
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
1313
| ++++++++++++++++++++
1414

15-
error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
16-
--> $DIR/filter-relevant-fn-bounds.rs:11:12
17-
|
18-
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
19-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
20-
|
21-
help: consider further restricting type parameter `F` with trait `Output`
22-
|
23-
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
24-
| ++++++++++++++++++++
25-
26-
error[E0277]: the trait bound `for<'a> F: Output<'a>` is not satisfied
27-
--> $DIR/filter-relevant-fn-bounds.rs:11:20
28-
|
29-
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
30-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `for<'a> Output<'a>` is not implemented for `F`
31-
|
32-
help: consider further restricting type parameter `F` with trait `Output`
33-
|
34-
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
35-
| ++++++++++++++++++++
36-
37-
error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
38-
--> $DIR/filter-relevant-fn-bounds.rs:20:34
15+
error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}`
16+
--> $DIR/filter-relevant-fn-bounds.rs:18:34
3917
|
4018
LL | wrapper.do_something_wrapper(|value| ());
41-
| -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
19+
| -------------------- ^^^^^^^^^^ expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}`
4220
| |
4321
| required by a bound introduced by this call
4422
|
45-
= help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:20:34: 20:41}`
23+
= help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}`
4624
help: this trait has no implementations, consider adding one
4725
--> $DIR/filter-relevant-fn-bounds.rs:1:1
4826
|
@@ -57,6 +35,6 @@ LL | fn do_something_wrapper<O, F>(self, _: F)
5735
LL | F: for<'a> FnOnce(<F as Output<'a>>::Type),
5836
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Wrapper::do_something_wrapper`
5937

60-
error: aborting due to 4 previous errors
38+
error: aborting due to 2 previous errors
6139

6240
For more information about this error, try `rustc --explain E0277`.

tests/ui/regions/regions-normalize-in-where-clause-list.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ fn bar<'a, 'b>()
2525
where
2626
<() as Project<'a, 'b>>::Item: Eq,
2727
//~^ ERROR cannot infer
28+
//~| ERROR cannot infer
2829
{
2930
}
3031

tests/ui/regions/regions-normalize-in-where-clause-list.stderr

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,31 @@ LL | <() as Project<'a, 'b>>::Item: Eq,
2222
= note: expected `Project<'a, 'b>`
2323
found `Project<'_, '_>`
2424

25-
error: aborting due to 1 previous error
25+
error[E0803]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
26+
--> $DIR/regions-normalize-in-where-clause-list.rs:26:36
27+
|
28+
LL | <() as Project<'a, 'b>>::Item: Eq,
29+
| ^^
30+
|
31+
note: first, the lifetime cannot outlive the lifetime `'a` as defined here...
32+
--> $DIR/regions-normalize-in-where-clause-list.rs:24:8
33+
|
34+
LL | fn bar<'a, 'b>()
35+
| ^^
36+
note: ...but the lifetime must also be valid for the lifetime `'b` as defined here...
37+
--> $DIR/regions-normalize-in-where-clause-list.rs:24:12
38+
|
39+
LL | fn bar<'a, 'b>()
40+
| ^^
41+
note: ...so that the types are compatible
42+
--> $DIR/regions-normalize-in-where-clause-list.rs:26:36
43+
|
44+
LL | <() as Project<'a, 'b>>::Item: Eq,
45+
| ^^
46+
= note: expected `Project<'a, 'b>`
47+
found `Project<'_, '_>`
48+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
49+
50+
error: aborting due to 2 previous errors
2651

2752
For more information about this error, try `rustc --explain E0803`.

0 commit comments

Comments
 (0)