Files
rust/tests/ui/traits
Matthias Krüger dd60b6ca27 Rollup merge of #137232 - estebank:from-residual-note, r=petrochenkov
Don't mention `FromResidual` on bad `?`

Unless `try_trait_v2` is enabled, don't mention that `FromResidual` isn't implemented for a specific type when the implicit `From` conversion of a `?` fails. For the end user on stable, `?` might as well be a compiler intrinsic, so we remove that note to avoid further confusion and allowing other parts of the error to be more prominent.

```
error[E0277]: `?` couldn't convert the error to `u8`
  --> $DIR/bad-interconversion.rs:4:20
   |
LL | fn result_to_result() -> Result<u64, u8> {
   |                          --------------- expected `u8` because of this
LL |     Ok(Err(123_i32)?)
   |        ------------^ the trait `From<i32>` is not implemented for `u8`
   |        |
   |        this can't be annotated with `?` because it has type `Result<_, i32>`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = help: the following other types implement trait `From<T>`:
             `u8` implements `From<Char>`
             `u8` implements `From<bool>`
```
2025-02-19 18:52:08 +01:00
..
2025-01-30 11:56:29 +01:00
2025-01-30 15:30:04 +00:00
2024-12-18 16:35:06 +01:00
2023-06-19 15:39:55 +02:00
2024-10-18 00:33:50 +02:00
2024-10-18 00:33:50 +02:00
2024-10-18 00:33:50 +02:00
2024-04-07 17:38:07 -03:00
2024-03-03 16:30:48 -03:00
2024-02-07 10:42:01 +08:00
2024-03-03 16:30:48 -03:00
2024-03-03 16:30:48 -03:00
2023-04-20 15:06:17 -03:00
2024-02-07 10:42:01 +08:00
2023-10-13 19:18:46 +00:00
2025-02-03 10:39:32 -05:00
2023-12-05 17:15:46 +00:00
2025-02-14 00:37:23 +01:00
2025-02-14 00:37:23 +01:00
2024-01-05 10:00:59 +00:00
2023-01-13 18:20:24 +00:00