diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-03-22 20:31:28 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-22 20:31:28 +0100 |
| commit | 1c37a237002abe01727de97b096aad2f947414ce (patch) | |
| tree | c355604774441e67377bc44c1a0be1d25883453c | |
| parent | 879899ca8963e8035172b649169143824a849f5d (diff) | |
| parent | f9a9c4bf3bc8c8675ef12c6f3580aea6a9df667c (diff) | |
| download | rust-1c37a237002abe01727de97b096aad2f947414ce.tar.gz rust-1c37a237002abe01727de97b096aad2f947414ce.zip | |
Rollup merge of #122195 - jieyouxu:impl-return-note, r=fmease
Note that the caller chooses a type for type param
```
error[E0308]: mismatched types
--> $DIR/return-impl-trait.rs:23:5
|
LL | fn other_bounds<T>() -> T
| - -
| | |
| | expected `T` because of return type
| | help: consider using an impl return type: `impl Trait`
| expected this type parameter
...
LL | ()
| ^^ expected type parameter `T`, found `()`
|
= note: expected type parameter `T`
found unit type `()`
= note: the caller chooses the type of T which can be different from ()
```
Tried to see if "expected this type parameter" can be replaced, but that goes all the way to `rustc_infer` so seems not worth the effort and can affect other diagnostics.
Revives #112088 and #104755.
| -rw-r--r-- | tests/ui/builtin_type_shadow.stderr | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/ui/builtin_type_shadow.stderr b/tests/ui/builtin_type_shadow.stderr index 1e15cdee772..033204af925 100644 --- a/tests/ui/builtin_type_shadow.stderr +++ b/tests/ui/builtin_type_shadow.stderr @@ -19,6 +19,7 @@ LL | 42 | = note: expected type parameter `u32` found type `{integer}` + = note: the caller chooses a type for `u32` which can be different from `i32` error: aborting due to 2 previous errors |
