Esteban Küber
f0c93117ed
Use root obligation on E0277 for some cases
...
When encountering trait bound errors that satisfy some heuristics that
tell us that the relevant trait for the user comes from the root
obligation and not the current obligation, we use the root predicate for
the main message.
This allows to talk about "X doesn't implement Pattern<'_>" over the
most specific case that just happened to fail, like "char doesn't
implement Fn(&mut char)" in
`tests/ui/traits/suggest-dereferences/root-obligation.rs`
The heuristics are:
- the type of the leaf predicate is (roughly) the same as the type
from the root predicate, as a proxy for "we care about the root"
- the leaf trait and the root trait are different, so as to avoid
talking about `&mut T: Trait` and instead remain talking about
`T: Trait` instead
- the root trait is not `Unsize`, as to avoid talking about it in
`tests/ui/coercion/coerce-issue-49593-box-never.rs`.
```
error[E0277]: the trait bound `&char: Pattern<'_>` is not satisfied
--> $DIR/root-obligation.rs:6:38
|
LL | .filter(|c| "aeiou".contains(c))
| -------- ^ the trait `Fn<(char,)>` is not implemented for `&char`, which is required by `&char: Pattern<'_>`
| |
| required by a bound introduced by this call
|
= note: required for `&char` to implement `FnOnce<(char,)>`
= note: required for `&char` to implement `Pattern<'_>`
note: required by a bound in `core::str::<impl str>::contains`
--> $SRC_DIR/core/src/str/mod.rs:LL:COL
help: consider dereferencing here
|
LL | .filter(|c| "aeiou".contains(*c))
| +
```
Fix #79359 , fix #119983 , fix #118779 , cc #118415 (the suggestion needs
to change).
2024-03-03 18:53:35 +00:00
..
2023-05-09 20:35:39 -04:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2023-09-29 21:56:57 +02:00
2023-10-08 20:17:53 -07:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-02-16 20:02:50 +00:00
2024-01-12 11:02:57 +01:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-25 08:15:44 +01:00
2024-02-25 08:15:44 +01:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-10 03:23:51 +00:00
2024-02-10 03:23:51 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-05-05 21:44:48 +02:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-05-11 18:06:31 +04:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-08-18 19:57:28 +02:00
2024-01-13 12:46:58 -05:00
2023-12-23 00:52:42 +01:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-02-08 08:10:43 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-05-03 22:41:29 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-02-16 20:02:50 +00:00
2024-02-11 15:12:10 +01:00
2024-02-11 15:12:10 +01:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-09-08 12:46:09 +01:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-02-08 08:10:43 +00:00
2024-02-08 08:10:43 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-24 14:21:57 +01:00
2023-11-24 19:15:52 +01:00
2023-01-24 14:21:57 +01:00
2023-10-29 23:55:46 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-19 13:38:24 -05:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-06-19 12:54:34 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-11-22 19:30:47 +00:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-12-20 18:16:28 +01:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-01-12 14:11:16 +03:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2023-12-12 20:13:37 +00:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-01-09 21:08:16 +00:00
2024-01-13 12:46:58 -05:00
2024-01-07 18:00:03 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-12 17:44:53 +00:00
2024-02-17 23:16:30 -08:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-12-05 19:53:59 +00:00
2023-12-05 19:53:59 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-11-30 08:26:13 -08:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-01-02 13:49:47 +01:00
2024-01-02 13:49:48 +01:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-02-08 08:10:43 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-05-02 22:36:24 +00:00
2023-11-24 19:15:52 +01:00
2024-01-09 17:00:24 +01:00
2024-01-15 21:24:13 +00:00
2024-02-01 20:01:05 +01:00
2024-02-01 20:01:05 +01:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-02-16 03:39:58 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-19 20:38:51 +00:00
2024-01-19 21:13:11 +00:00
2024-01-19 20:38:51 +00:00
2024-01-19 21:13:11 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2024-03-03 13:10:15 +01:00
2024-03-03 13:10:15 +01:00
2023-10-27 19:56:12 +02:00
2023-12-04 11:56:21 +01:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-16 13:27:58 -08:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-10-23 13:04:47 -07:00
2023-10-23 13:04:47 -07:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-01-22 14:24:31 +00:00
2024-01-22 14:24:31 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2024-03-03 18:53:35 +00:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-05-01 16:15:13 +08:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-01-09 21:08:16 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-12 12:47:31 +08:00
2024-02-12 12:47:31 +08:00
2024-02-16 20:02:50 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2024-01-03 18:59:42 +00:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-08 08:10:43 +00:00
2024-02-08 08:10:43 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-29 17:43:07 +08:00
2024-01-29 17:43:07 +08:00
2024-01-13 12:46:58 -05:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2023-10-05 01:04:41 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-29 17:43:07 +08:00
2024-01-29 17:43:07 +08:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2024-02-16 20:02:50 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-02-16 20:02:50 +00:00
2023-04-21 15:34:38 +02:00
2023-01-11 09:32:08 +00:00
2024-01-13 12:46:58 -05:00
2023-01-11 09:32:08 +00:00
2023-11-24 19:15:52 +01:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00