diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-10-16 19:10:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-16 19:10:49 +0200 |
| commit | 14663e09b7d316a5d48ae46eab46e4f4fedd9e8c (patch) | |
| tree | 1f89663a42a0faf766f2c1b32c0e37be297dd5e3 /tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs | |
| parent | cf25110defcc6e20b702a332489efa9f1c9f6c3f (diff) | |
| parent | 20c622e4564bed8f6e4f9ef8b05c3a004d45e6f8 (diff) | |
| download | rust-14663e09b7d316a5d48ae46eab46e4f4fedd9e8c.tar.gz rust-14663e09b7d316a5d48ae46eab46e4f4fedd9e8c.zip | |
Rollup merge of #116257 - estebank:issue-101351, r=b-naber
Suggest trait bounds for used associated type on type param
Fix #101351.
When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound:
```
error[E0220]: associated type `Associated` not found for `T`
--> file.rs:6:15
|
6 | field: T::Associated,
| ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo`
|
help: consider restricting type parameter `T`
|
5 | struct Generic<T: Foo> {
| +++++
```
When an associated type on a type parameter has a typo, suggest fixing
it:
```
error[E0220]: associated type `Baa` not found for `T`
--> $DIR/issue-55673.rs:9:8
|
LL | T::Baa: std::fmt::Debug,
| ^^^ there is a similarly named associated type `Bar` in the trait `Foo`
|
help: change the associated type name to use `Bar` from `Foo`
|
LL | T::Bar: std::fmt::Debug,
| ~~~
```
Diffstat (limited to 'tests/codegen/src-hash-algorithm/src-hash-algorithm-sha1.rs')
0 files changed, 0 insertions, 0 deletions
