Matthias Krüger
14663e09b7
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,
| ~~~
```
2023-10-16 19:10:49 +02:00
..
2023-06-20 22:54:12 +08:00
2023-07-07 09:00:50 +08:00
2023-07-07 09:00:50 +08:00
2023-07-07 09:00:50 +08:00
2023-09-25 15:56:36 +00:00
2023-09-19 18:15:23 +02:00
2023-09-19 18:15:23 +02:00
2023-09-10 23:06:14 +02:00
2023-04-12 22:50:10 +00:00
2023-07-29 00:19:50 +08:00
2023-07-29 00:19:50 +08:00
2023-04-02 19:42:30 -04:00
2023-04-02 19:42:30 -04:00
2023-04-12 22:50:10 +00:00
2023-05-11 13:21:10 +01:00
2023-05-11 13:21:10 +01:00
2023-07-02 15:35:18 +08:00
2023-07-07 10:18:20 +08:00
2023-07-02 15:35:18 +08:00
2023-07-07 10:18:20 +08:00
2023-06-12 20:24:48 +08:00
2023-09-25 15:56:36 +00:00
2023-09-25 15:56:36 +00:00
2023-04-12 22:50:10 +00:00
2023-09-10 23:07:48 +02:00
2023-09-10 23:07:48 +02:00
2023-09-10 23:07:48 +02:00
2023-06-10 17:11:38 +08:00
2023-06-10 17:11:38 +08:00
2023-09-25 15:56:36 +00:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00
2023-05-08 17:58:01 -03:00
2023-05-08 17:58:01 -03:00
2023-05-08 17:58:01 -03:00
2023-05-08 17:58:01 -03:00
2023-04-12 22:50:10 +00:00
2023-08-28 17:47:37 -03:00
2023-08-28 17:47:37 -03:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00
2023-09-25 15:56:36 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-05-15 00:00:00 +00:00
2023-05-15 00:00:00 +00:00
2023-10-13 19:13:56 +00:00
2023-10-13 19:13:56 +00:00
2023-10-13 19:13:56 +00:00
2023-09-25 15:56:36 +00:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00
2023-10-13 21:01:36 +00:00
2023-10-13 21:01:36 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-09-23 01:54:05 +00:00
2023-06-14 01:38:35 +08:00
2023-03-20 03:22:31 +08:00
2023-03-20 03:22:31 +08:00
2023-06-14 01:38:35 +08:00
2023-06-14 01:38:35 +08:00
2023-05-10 22:35:01 +08:00
2023-05-10 22:35:01 +08:00
2023-05-17 16:59:39 +08:00
2023-05-17 16:59:39 +08:00
2023-05-19 22:11:54 +08:00
2023-05-19 22:11:54 +08:00
2023-06-15 18:19:09 +08:00
2023-06-15 18:19:09 +08:00
2023-06-15 18:19:09 +08:00
2023-07-18 09:52:08 +08:00
2023-07-18 09:52:08 +08:00
2023-07-18 09:52:08 +08:00
2023-08-05 15:58:26 +08:00
2023-09-28 19:47:58 +08:00
2023-09-28 19:47:58 +08:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-06-22 16:50:31 +00:00
2023-09-25 15:56:36 +00:00
2023-10-02 19:12:42 +02:00
2023-04-12 22:50:10 +00:00
2023-06-12 20:24:48 +08:00
2023-07-18 21:53:34 -04:00
2023-09-25 15:56:36 +00:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00
2023-05-10 22:35:01 +08:00
2023-09-07 05:19:43 +00:00
2023-09-07 05:18:54 +00:00
2023-09-07 05:18:54 +00:00
2023-04-04 14:10:13 +01:00
2023-04-04 14:10:13 +01:00
2023-09-25 15:56:36 +00:00
2023-09-25 15:56:36 +00:00
2023-08-02 15:30:24 +00:00
2023-08-02 15:30:24 +00:00
2023-07-13 08:26:02 +08:00
2023-07-13 08:26:02 +08:00
2023-07-18 09:52:08 +08:00
2023-04-12 22:50:10 +00:00
2023-04-12 22:50:10 +00:00
2023-09-10 23:06:14 +02:00
2023-09-10 23:06:14 +02:00