-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Provide better compiler output when using ?
on Option
in fn returning Result
or vice-versa?
#71089
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
F-on_unimplemented
Error messages that can be tackled with `#[rustc_on_unimplemented]`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
This error is emitted here: rust/src/librustc_trait_selection/traits/error_reporting/mod.rs Lines 278 to 313 in 8e18e26
We could look at whether the |
Can I claim this issue? |
@rustbot claim |
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 15, 2020
Provide better compiler output when using `?` on `Option` in fn returning `Result` and vice-versa Fixes rust-lang#71089
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 15, 2020
Provide better compiler output when using `?` on `Option` in fn returning `Result` and vice-versa Fixes rust-lang#71089
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 16, 2020
Provide better compiler output when using `?` on `Option` in fn returning `Result` and vice-versa Fixes rust-lang#71089
Dylan-DPC-zz
pushed a commit
to Dylan-DPC-zz/rust
that referenced
this issue
Apr 16, 2020
Provide better compiler output when using `?` on `Option` in fn returning `Result` and vice-versa Fixes rust-lang#71089
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
F-on_unimplemented
Error messages that can be tackled with `#[rustc_on_unimplemented]`
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
It seems that
rustc
should provide a better error message or hint when one tries to use the?
operator on anOption
in a function returning aResult
or vice-versa.Currently this is the error you get:
However, it would be better to suggest the use of
Option::ok_or
orOption::ok_or_else
, orResult::ok
, instead of referencing something dependent on thetry_trait
feature (NoneError
).This issue has been assigned to @Duddino via this comment.
The text was updated successfully, but these errors were encountered: