-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Change some helps to suggestions #31053
Conversation
No tests? |
8f05786
to
de82599
Compare
Pushed the test fixes. |
de82599
to
4a9a568
Compare
oh, the issue is that the other suggestion is hard to trigger, not sure the context in which resolve is set to emit_errors=false |
"E0519"); | ||
if let Ok(snip) = cx.sess().codemap().span_to_snippet(lit_span) { | ||
err.span_suggestion(span, "try using a cast or the `!` operator:", | ||
format!("!{}", snip)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the cast way is the only one you can do generically. as -1isize as usize
does not yield the same as !1usize
. It would need to be !(x-1)
, which errors if x == 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. Adding a generic cast here is harder so I'll just fix up the help message.
☔ The latest upstream changes (presumably #31010) made this pull request unmergeable. Please resolve the merge conflicts. |
Given that the unsigned one doesn't have a generic suggestion and the other one can't be triggered, closing |
r? @eddyb