-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Bad/confusing error message with Residuals #90863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The ascii-art points to it. |
Yes, this line does so at the very bottom.
I was not clear what my intention was with that point. Such as:
or:
|
I was just thinking about this frequently-confusing message, and I have an additional idea here. I agree with the above that the span over the whole function item is confusing and marking just the signature or name would be better, but, in addition, this error could have a suggestion to change the function's return type: -pub fn main() -> T {
+pub fn main() -> Result<T, E> { where It might also help if it had a dedicated error code instead of E0277, so that the error guide could explain about the use of |
I would agree that the FromResidual lines are distracting. It took me a solid minute to realize this wasn't some weird new error message I hadn't seen before and that Not sure how it could be improved though... |
Current output on stable:
#137232 will remove the I believe that the current output pretty much matches the originally requested, so I'll go ahead and close this ticket. Other tickets for other specific cases can be created, of course :) |
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1b1c18cee65bf066a53f2c1a8c3653d0
The current output is:
What is wrong?:
Result
orOption
could be better. It could be more explicit on whethermain()
orget_result()
needs to returnResult
orOption
.help: the trait `FromResidual<Result<Infallible, anyhow::Error>>` is not implemented for `()` note: required by `from_residual`.
is help text for the internal compiler which does not need to be passed to developers. It's generally incomprehensible to most who do not know that this trait bound error has nothing to do with their code and would confuse a mass of new Rust programmers.Ideally the output should look like:
The text was updated successfully, but these errors were encountered: