mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
6cb627b681
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. |
||
---|---|---|
.. | ||
apit-unsized.rs | ||
apit-unsized.stderr | ||
enum-unit-variant-trait-bound.rs | ||
enum-unit-variant-trait-bound.stderr | ||
impl-bound-with-references-error.rs | ||
impl-bound-with-references-error.stderr | ||
impl-derived-implicit-sized-bound-2.rs | ||
impl-derived-implicit-sized-bound-2.stderr | ||
impl-derived-implicit-sized-bound.rs | ||
impl-derived-implicit-sized-bound.stderr | ||
impl-missing-where-clause-lifetimes-from-trait.rs | ||
impl-missing-where-clause-lifetimes-from-trait.stderr | ||
issue-75961.rs | ||
issue-82038.rs | ||
issue-82038.stderr | ||
issue-93008.rs | ||
issue-94680.rs | ||
issue-94999.rs | ||
issue-95640.rs | ||
mismatch-fn-trait.rs | ||
mismatch-fn-trait.stderr | ||
restrict-assoc-type-of-generic-bound.fixed | ||
restrict-assoc-type-of-generic-bound.rs | ||
restrict-assoc-type-of-generic-bound.stderr | ||
shadowed-path-in-trait-bound-suggestion.fixed | ||
shadowed-path-in-trait-bound-suggestion.rs | ||
shadowed-path-in-trait-bound-suggestion.stderr | ||
unsized-bound.rs | ||
unsized-bound.stderr |