Skip to content

Commit 5ffc464

Browse files
authored
Rollup merge of #98012 - compiler-errors:poly-trait-refs-are-traits, r=cjgillot
`ValuePairs::PolyTraitRefs` should be called "trait"s in type error diagnostics Pretty simple, we already do this for `ValuePairs::TraitRefs`...
2 parents 58d0d2e + acab446 commit 5ffc464

File tree

10 files changed

+31
-29
lines changed

10 files changed

+31
-29
lines changed

compiler/rustc_infer/src/infer/error_reporting/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,9 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
15881588
Mismatch::Variable(infer::ExpectedFound { expected, found }),
15891589
)
15901590
}
1591-
ValuePairs::TraitRefs(_) => (false, Mismatch::Fixed("trait")),
1591+
ValuePairs::TraitRefs(_) | ValuePairs::PolyTraitRefs(_) => {
1592+
(false, Mismatch::Fixed("trait"))
1593+
}
15921594
_ => (false, Mismatch::Fixed("type")),
15931595
};
15941596
let vals = match self.values_str(values) {

src/test/ui/generator/resume-arg-late-bound.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
44
LL | test(gen);
55
| ^^^^^^^^^ one type is more general than the other
66
|
7-
= note: expected type `for<'a> Generator<&'a mut bool>`
8-
found type `Generator<&mut bool>`
7+
= note: expected trait `for<'a> Generator<&'a mut bool>`
8+
found trait `Generator<&mut bool>`
99
note: the lifetime requirement is introduced here
1010
--> $DIR/resume-arg-late-bound.rs:8:17
1111
|

src/test/ui/higher-rank-trait-bounds/normalize-under-binder/issue-71955.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
44
LL | foo(bar, "string", |s| s.len() == 5);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
66
|
7-
= note: expected type `for<'r, 's> FnOnce<(&'r &'s str,)>`
8-
found type `for<'r> FnOnce<(&'r &str,)>`
7+
= note: expected trait `for<'r, 's> FnOnce<(&'r &'s str,)>`
8+
found trait `for<'r> FnOnce<(&'r &str,)>`
99
note: this closure does not fulfill the lifetime requirements
1010
--> $DIR/issue-71955.rs:45:24
1111
|
@@ -23,8 +23,8 @@ error[E0308]: mismatched types
2323
LL | foo(bar, "string", |s| s.len() == 5);
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
2525
|
26-
= note: expected type `FnOnce<(&&str,)>`
27-
found type `for<'r> FnOnce<(&'r &str,)>`
26+
= note: expected trait `FnOnce<(&&str,)>`
27+
found trait `for<'r> FnOnce<(&'r &str,)>`
2828
note: this closure does not fulfill the lifetime requirements
2929
--> $DIR/issue-71955.rs:45:24
3030
|
@@ -42,8 +42,8 @@ error[E0308]: mismatched types
4242
LL | foo(baz, "string", |s| s.0.len() == 5);
4343
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
4444
|
45-
= note: expected type `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>`
46-
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
45+
= note: expected trait `for<'r, 's> FnOnce<(&'r Wrapper<'s>,)>`
46+
found trait `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
4747
note: this closure does not fulfill the lifetime requirements
4848
--> $DIR/issue-71955.rs:48:24
4949
|
@@ -61,8 +61,8 @@ error[E0308]: mismatched types
6161
LL | foo(baz, "string", |s| s.0.len() == 5);
6262
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other
6363
|
64-
= note: expected type `FnOnce<(&Wrapper<'_>,)>`
65-
found type `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
64+
= note: expected trait `FnOnce<(&Wrapper<'_>,)>`
65+
found trait `for<'r> FnOnce<(&'r Wrapper<'_>,)>`
6666
note: this closure does not fulfill the lifetime requirements
6767
--> $DIR/issue-71955.rs:48:24
6868
|

src/test/ui/issues/issue-27942.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
44
LL | fn select(&self) -> BufferViewHandle<R>;
55
| ^^^^^^^^^^^^^^^^^^^ lifetime mismatch
66
|
7-
= note: expected type `Resources<'_>`
8-
found type `Resources<'a>`
7+
= note: expected trait `Resources<'_>`
8+
found trait `Resources<'a>`
99
note: the anonymous lifetime defined here...
1010
--> $DIR/issue-27942.rs:5:15
1111
|
@@ -23,8 +23,8 @@ error[E0308]: mismatched types
2323
LL | fn select(&self) -> BufferViewHandle<R>;
2424
| ^^^^^^^^^^^^^^^^^^^ lifetime mismatch
2525
|
26-
= note: expected type `Resources<'_>`
27-
found type `Resources<'a>`
26+
= note: expected trait `Resources<'_>`
27+
found trait `Resources<'a>`
2828
note: the lifetime `'a` as defined here...
2929
--> $DIR/issue-27942.rs:3:18
3030
|

src/test/ui/lifetimes/issue-79187-2.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ error[E0308]: mismatched types
3131
LL | take_foo(|a| a);
3232
| ^^^^^^^^^^^^^^^ one type is more general than the other
3333
|
34-
= note: expected type `for<'r> Fn<(&'r i32,)>`
35-
found type `Fn<(&i32,)>`
34+
= note: expected trait `for<'r> Fn<(&'r i32,)>`
35+
found trait `Fn<(&i32,)>`
3636
note: this closure does not fulfill the lifetime requirements
3737
--> $DIR/issue-79187-2.rs:8:14
3838
|

src/test/ui/lifetimes/issue-79187.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
44
LL | thing(f);
55
| ^^^^^^^^ one type is more general than the other
66
|
7-
= note: expected type `for<'r> FnOnce<(&'r u32,)>`
8-
found type `FnOnce<(&u32,)>`
7+
= note: expected trait `for<'r> FnOnce<(&'r u32,)>`
8+
found trait `FnOnce<(&u32,)>`
99
note: this closure does not fulfill the lifetime requirements
1010
--> $DIR/issue-79187.rs:4:13
1111
|

src/test/ui/lifetimes/lifetime-errors/issue_74400.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ error[E0308]: mismatched types
1515
LL | f(data, identity)
1616
| ^^^^^^^^^^^^^^^^^ one type is more general than the other
1717
|
18-
= note: expected type `for<'r> Fn<(&'r T,)>`
19-
found type `Fn<(&T,)>`
18+
= note: expected trait `for<'r> Fn<(&'r T,)>`
19+
found trait `Fn<(&T,)>`
2020
note: the lifetime requirement is introduced here
2121
--> $DIR/issue_74400.rs:8:34
2222
|

src/test/ui/mismatched_types/closure-mismatch.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ error[E0308]: mismatched types
1313
LL | baz(|_| ());
1414
| ^^^^^^^^^^^ one type is more general than the other
1515
|
16-
= note: expected type `for<'r> Fn<(&'r (),)>`
17-
found type `Fn<(&(),)>`
16+
= note: expected trait `for<'r> Fn<(&'r (),)>`
17+
found trait `Fn<(&(),)>`
1818
note: this closure does not fulfill the lifetime requirements
1919
--> $DIR/closure-mismatch.rs:8:9
2020
|

src/test/ui/rfc1623.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ error[E0308]: mismatched types
44
LL | f: &id,
55
| ^^^ one type is more general than the other
66
|
7-
= note: expected type `for<'a, 'b> Fn<(&'a Foo<'b>,)>`
8-
found type `Fn<(&Foo<'_>,)>`
7+
= note: expected trait `for<'a, 'b> Fn<(&'a Foo<'b>,)>`
8+
found trait `Fn<(&Foo<'_>,)>`
99

1010
error[E0308]: mismatched types
1111
--> $DIR/rfc1623.rs:28:8
1212
|
1313
LL | f: &id,
1414
| ^^^ one type is more general than the other
1515
|
16-
= note: expected type `for<'a, 'b> Fn<(&'a Foo<'b>,)>`
17-
found type `Fn<(&Foo<'_>,)>`
16+
= note: expected trait `for<'a, 'b> Fn<(&'a Foo<'b>,)>`
17+
found trait `Fn<(&Foo<'_>,)>`
1818

1919
error: implementation of `FnOnce` is not general enough
2020
--> $DIR/rfc1623.rs:28:8

src/test/ui/type-alias-impl-trait/issue-57611-trait-alias.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ error[E0308]: mismatched types
44
LL | |x| x
55
| ^^^^^ one type is more general than the other
66
|
7-
= note: expected type `for<'r> Fn<(&'r X,)>`
8-
found type `Fn<(&X,)>`
7+
= note: expected trait `for<'r> Fn<(&'r X,)>`
8+
found trait `Fn<(&X,)>`
99
note: this closure does not fulfill the lifetime requirements
1010
--> $DIR/issue-57611-trait-alias.rs:21:9
1111
|

0 commit comments

Comments
 (0)