diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2023-11-02 02:20:04 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2023-11-02 18:04:41 +0000 |
| commit | 9e7345be1f5201634e421aa0963c56a976f36da9 (patch) | |
| tree | 748add949c50c0bfd11809a9886cb0c9812d33c4 /compiler/rustc_incremental/src/errors.rs | |
| parent | 75b064d26970ca8e7a487072f51835ebb057d575 (diff) | |
| download | rust-9e7345be1f5201634e421aa0963c56a976f36da9.tar.gz rust-9e7345be1f5201634e421aa0963c56a976f36da9.zip | |
Fix incorrect trait bound restriction suggestion
Suggest
```
error[E0308]: mismatched types
--> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
|
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
| - - expected `B` because of return type
| |
| expected this type parameter
LL | return a.bar();
| ^^^^^^^ expected type parameter `B`, found associated type
|
= note: expected type parameter `B`
found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
|
LL | pub fn foo<A: MyTrait<T = B>, B>(a: A) -> B {
| +++++++
```
instead of
```
error[E0308]: mismatched types
--> $DIR/restrict-assoc-type-of-generic-bound.rs:9:12
|
LL | pub fn foo<A: MyTrait, B>(a: A) -> B {
| - - expected `B` because of return type
| |
| expected this type parameter
LL | return a.bar();
| ^^^^^^^ expected type parameter `B`, found associated type
|
= note: expected type parameter `B`
found associated type `<A as MyTrait>::T`
help: consider further restricting this bound
|
LL | pub fn foo<A: MyTrait + <T = B>, B>(a: A) -> B {
| +++++++++
```
Fix #117501.
Diffstat (limited to 'compiler/rustc_incremental/src/errors.rs')
0 files changed, 0 insertions, 0 deletions
