mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-02 21:17:39 +00:00
27 lines
1.2 KiB
Plaintext
27 lines
1.2 KiB
Plaintext
![]() |
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>`
|
||
|
|
||
|
error[E0277]: `?` couldn't convert the error to `X`
|
||
|
--> $DIR/bad-question-mark-on-trait-object.rs:15:13
|
||
|
|
|
||
|
LL | fn bat() -> Result<(), X> {
|
||
|
| ------------- expected `X` because of this
|
||
|
LL | Ok(bar()?)
|
||
|
| -----^ the trait `From<E>` is not implemented for `X`
|
||
|
| |
|
||
|
| this can't be annotated with `?` because it has type `Result<_, E>`
|
||
|
|
|
||
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
|
||
|
|
||
|
error: aborting due to 2 previous errors
|
||
|
|
||
|
For more information about this error, try `rustc --explain E0277`.
|