about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-02-18 20:29:10 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-02-20 18:15:39 +0000
commite565eeed78d0e59e475dce34b0833bbf8f84871b (patch)
tree1c290b3048e8afdd32dc25ab62fbaf08cbc9eb73 /compiler/rustc_mir_transform/src
parent28b83ee59698ae069f5355b8e03f976406f410f5 (diff)
downloadrust-e565eeed78d0e59e475dce34b0833bbf8f84871b.tar.gz
rust-e565eeed78d0e59e475dce34b0833bbf8f84871b.zip
Tweak E0277 when predicate comes indirectly from `?`
When a `?` operation requires an `Into` conversion with additional bounds (like having a concrete error but wanting to convert to a trait object), we handle it speficically and provide the same kind of information we give other `?` related errors.

```
error[E0277]: `?` couldn't convert the error: `E: std::error::Error` is not satisfied
  --> $DIR/bad-question-mark-on-trait-object.rs:5:13
   |
LL | fn foo() -> Result<(), Box<dyn std::error::Error>> {
   |             -------------------------------------- required `E: std::error::Error` because of this
LL |     Ok(bar()?)
   |             ^ the trait `std::error::Error` is not implemented for `E`
   |
   = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
   = note: required for `Box<dyn std::error::Error>` to implement `From<E>`
```

Avoid talking about `FromResidual` when other more relevant information is being given, particularly from `rust_on_unimplemented`.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
0 files changed, 0 insertions, 0 deletions