-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add lint check for negating uint literals and variables. #13579
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
Conversation
Travis failed because he doesn't know the new lint check in stage1. |
If you take a look at the logs that are preceded with "failure:" you can see the logs of the otuput that buildbot collected during the run. It looks like there are some warnings in the standard library which should be addressed. |
I think the Problem is, that the stage0 compiler doesn't know the new lint rule:
and bails out later. But it may also be that it doesn't recognize my If I compile with |
The warnings are ok because they all go away after stage0, you'll want to look near the ends of the logs rather than the top:
|
Ok, works now but how about looking at the places where I had to explicitly allow unsigned negation for possible bugs? |
_ => () | ||
} | ||
} | ||
} |
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.
Sorry it took awhile to get to this, it fell under my radar!
Our code conventions dictate 4-space tabs, could you re-tab these? Additionally, did the first case catch use cases that the second case didn't catch? I would have expected ty::get(t).sty
to be ty_uint
for uint literals.
Ok, I retabbed the code. Yes the second case would also work for uint literals, but I wanted to differentiate between these two to give a more precise warning message. |
Sorry, I forgot to adapt the testcase to the new warning text |
It looks like there was also a failure on windows: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/4747/steps/test/logs/stdio |
Oops, this is the right link: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-c/builds/4733/steps/compile/logs/stdio |
Ok, should I change the signedness of the expression or add an allow attribute? |
It's always best to fix it at the source if possible, but it's also ok to fix it up after-the fact. |
I can't test it on windows, will |
That will likely do the trick, yes. |
Ok, I changed it |
See #11273 and #13318