You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cargo clippy --fix fails with a warning saying that there likely is a bug in cargo or rustc itself.
It seems that the issue is related to the #[from] macro of the thiserror crate so maybe the issue is on their end but since the warning asked for a bug-report I thought I'd follow that.
All of the reported issues seems to be instances of
error[E0277]: `?` couldn't convert the error to `ERROR_TYPE_A`
...
the trait `std::convert::From<std::result::Result<_, ERROR_TYPE_B>>` is not implemented for `ERROR_TYPE_A`
However, the code compiles normally (using cargo build) as the trait is implemented using the thiserror crates #[from] macro.
Meta
rustc --version --verbose:
rustup 1.25.2 (2023-02-04)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.70.0-nightly (23ee2af2f 2023-04-07)`
Backtrace
warning: failed to automatically apply fixes suggested by rustc to crate `accounts_rs`
after fixes were automatically applied the compiler reported errors within these files:
* src/services/email_service.rs
* src/services/google_api_service.rs
* src/services/reset_password_service.rs
This likely indicates a bug in either rustc or cargo itself,
and we would appreciate a bug report! You're likely to see
a number of compiler warnings after this message which cargo
attempted to fix but failed. If you could open an issue at
https://github.com/rust-lang/rust/issues
quoting the full output of this command we'd be very appreciative!
Note that you may be able to make some more progress in the near-term
fixing code with the `--broken-code` flag
The following errors were reported:
error[E0277]: `?` couldn't convert the error to `services::email_service::EmailError`
--> src/services/email_service.rs:34:15
|
34 | })?;
| ^ the trait `std::convert::From<std::result::Result<_, services::google_api_service::GoogleApiError>>` is not implemented for `services::email_service::EmailError`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the trait `std::convert::From<services::google_api_service::GoogleApiError>` is implemented for `services::email_service::EmailError`
= note: required for `std::result::Result<(), services::email_service::EmailError>` to implement `std::ops::FromResidual<std::result::Result<std::convert::Infallible, std::result::Result<_, services::google_api_service::GoogleApiError>>>`
error[E0277]: `?` couldn't convert the error to `services::email_service::EmailError`
--> src/services/email_service.rs:40:15
|
40 | })?;
| ^ the trait `std::convert::From<std::result::Result<_, services::google_api_service::GoogleApiError>>` is not implemented for `services::email_service::EmailError`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the trait `std::convert::From<services::google_api_service::GoogleApiError>` is implemented for `services::email_service::EmailError`
= note: required for `std::result::Result<(), services::email_service::EmailError>` to implement `std::ops::FromResidual<std::result::Result<std::convert::Infallible, std::result::Result<_, services::google_api_service::GoogleApiError>>>`
error[E0277]: `?` couldn't convert the error to `services::reset_password_service::ResetPasswordError`
--> src/services/reset_password_service.rs:55:11
|
55 | })?;
| ^ the trait `std::convert::From<std::result::Result<_, services::reset_password_service::ResetPasswordError>>` is not implemented for `services::reset_password_service::ResetPasswordError`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `std::convert::From<T>`:
<services::reset_password_service::ResetPasswordError as std::convert::From<services::email_service::EmailError>>
<services::reset_password_service::ResetPasswordError as std::convert::From<sqlx::Error>>
<services::reset_password_service::ResetPasswordError as std::convert::From<util::accounts_error::AccountsError>>
= note: required for `std::result::Result<(), services::reset_password_service::ResetPasswordError>` to implement `std::ops::FromResidual<std::result::Result<std::convert::Infallible, std::result::Result<_, services::reset_password_service::ResetPasswordError>>>`
error[E0277]: `?` couldn't convert the error to `services::reset_password_service::ResetPasswordError`
--> src/services/reset_password_service.rs:166:11
|
166 | })?;
| ^ the trait `std::convert::From<std::result::Result<_, services::reset_password_service::ResetPasswordError>>` is not implemented for `services::reset_password_service::ResetPasswordError`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `std::convert::From<T>`:
<services::reset_password_service::ResetPasswordError as std::convert::From<services::email_service::EmailError>>
<services::reset_password_service::ResetPasswordError as std::convert::From<sqlx::Error>>
<services::reset_password_service::ResetPasswordError as std::convert::From<util::accounts_error::AccountsError>>
= note: required for `std::result::Result<(), services::reset_password_service::ResetPasswordError>` to implement `std::ops::FromResidual<std::result::Result<std::convert::Infallible, std::result::Result<_, services::reset_password_service::ResetPasswordError>>>`
error[E0277]: `?` couldn't convert the error to `services::google_api_service::GoogleApiError`
--> src/services/google_api_service.rs:94:7
|
94 | })?;
| ^ the trait `std::convert::From<std::result::Result<_, services::google_api_service::GoogleApiError>>` is not implemented for `services::google_api_service::GoogleApiError`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `std::convert::From<T>`:
<services::google_api_service::GoogleApiError as std::convert::From<jwt::Error>>
<services::google_api_service::GoogleApiError as std::convert::From<openssl::error::ErrorStack>>
<services::google_api_service::GoogleApiError as std::convert::From<reqwest::Error>>
= note: required for `std::result::Result<std::string::String, services::google_api_service::GoogleApiError>` to implement `std::ops::FromResidual<std::result::Result<std::convert::Infallible, std::result::Result<_, services::google_api_service::GoogleApiError>>>`
error[E0277]: `?` couldn't convert the error to `services::google_api_service::GoogleApiError`
--> src/services/google_api_service.rs:158:11
|
158 | })?;
| ^ the trait `std::convert::From<std::result::Result<_, services::google_api_service::GoogleApiError>>` is not implemented for `services::google_api_service::GoogleApiError`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `std::convert::From<T>`:
<services::google_api_service::GoogleApiError as std::convert::From<jwt::Error>>
<services::google_api_service::GoogleApiError as std::convert::From<openssl::error::ErrorStack>>
<services::google_api_service::GoogleApiError as std::convert::From<reqwest::Error>>
= note: required for `std::result::Result<(), services::google_api_service::GoogleApiError>` to implement `std::ops::FromResidual<std::result::Result<std::convert::Infallible, std::result::Result<_, services::google_api_service::GoogleApiError>>>`
error: aborting due to 6 previous errors
For more information about this error, try `rustc --explain E0277`.
Original diagnostics will follow.
This is followed by the standard cargo clippy output.
Issue
cargo clippy --fix
fails with a warning saying that there likely is a bug in cargo or rustc itself.It seems that the issue is related to the
#[from]
macro of thethiserror
crate so maybe the issue is on their end but since the warning asked for a bug-report I thought I'd follow that.All of the reported issues seems to be instances of
However, the code compiles normally (using
cargo build
) as the trait is implemented using thethiserror
crates#[from]
macro.Meta
rustc --version --verbose
:Backtrace
This is followed by the standard
cargo clippy
output.If helpful, the project in question is
https://github.com/viddem/accounts-rs
and the output above is on commitd9b0694
.The text was updated successfully, but these errors were encountered: