about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/lib.rs
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2025-02-22 01:01:41 +0100
committerGitHub <noreply@github.com>2025-02-22 01:01:41 +0100
commit890c4d2e2663b9f50ebc1128ae5a89ad1febe6cb (patch)
tree9db92d99c9416c2c593c5f541c90856dd87a1d52 /compiler/rustc_codegen_llvm/src/lib.rs
parent5400270279fe10b99a248e635821bd696aecd65b (diff)
parent31febc684ba8847494b1d1e223e8fc2cc87f3dcc (diff)
downloadrust-890c4d2e2663b9f50ebc1128ae5a89ad1febe6cb.tar.gz
rust-890c4d2e2663b9f50ebc1128ae5a89ad1febe6cb.zip
Rollup merge of #137245 - estebank:from-residual-note-2, r=oli-obk
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:7: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`
   |        |
   |        this has type `Result<_, E>`
   |
note: `E` needs to implement `std::error::Error`
  --> $DIR/bad-question-mark-on-trait-object.rs:1:1
   |
LL | struct 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`.

Fix #137238.

-----

CC #137232, which was a smaller step related to this.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/lib.rs')
0 files changed, 0 insertions, 0 deletions