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
A-docsArea: documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
error[[E0277]](https://doc.rust-lang.org/nightly/error_codes/E0277.html): `?` couldn't convert the error to `B`
--> src/lib.rs:17:6
|
16 | fn f(x: Result<(), A>) -> Result<(), B> {
| ------------- expected `B` because of this
17 | x?;
| ^ the trait `From<A>` is not implemented for `B`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `FromResidual<R>`:
<Result<T, F> as FromResidual<Result<Infallible, E>>>
<Result<T, F> as FromResidual<Yeet<E>>>
= note: required for `Result<(), B>` to implement `FromResidual<Result<Infallible, A>>`
For more information about this error, try `rustc --explain E0277`.
If the Into<B> impl is replaced with a From<A> impl, the example will successfully compile.
The docs in core/std should no longer state that ? uses Into.
The text was updated successfully, but these errors were encountered:
memoryruins
added
the
A-docs
Area: documentation for any part of the project, including the compiler, standard library, and tools
label
May 16, 2023
…=thomcc
remove reference to Into in ? operator core/std docs, fixrust-lang#111655
remove the text stating that `?` uses `Into::into` and add text stating it uses `From::from` instead. This closesrust-lang#111655.
A-docsArea: documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Location
rust/library/core/src/convert/mod.rs
Lines 497 to 499 in b652d9a
Summary
According to the reference and rustc, the
?
operator uses theFrom
trait on the underlying error.For example (playground),
rustc 1.71.0-nightly (ce5919fce 2023-05-15)
If the
Into<B>
impl is replaced with aFrom<A>
impl, the example will successfully compile.The docs in core/std should no longer state that
?
usesInto
.The text was updated successfully, but these errors were encountered: