-
Notifications
You must be signed in to change notification settings - Fork 14k
Give integer literals a sign instead of relying on negation expressions #136860
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
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
Give integer literals a sign instead of relying on negation expressions r? `@ghost` A lot of situations in the compiler check for unary negation of literals, which I want to replace entirely at some point. I think the only place that should have to handle such things is the overflowing literals lint to detect double negation. Everywhere else we should just have the concept of negative literals.
This comment has been minimized.
This comment has been minimized.
|
☀️ Try build successful - checks-actions |
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (994d560): comparison URL. Overall result: ❌✅ regressions and improvements - please read the text belowBenchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf. Next Steps: If you can justify the regressions found in this try perf run, please indicate this with @bors rollup=never Instruction countThis is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.
Max RSS (memory usage)Results (primary -0.7%, secondary -2.9%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 785.339s -> 786.428s (0.14%) |
25e4dd9 to
515be05
Compare
This comment has been minimized.
This comment has been minimized.
515be05 to
4d3981a
Compare
This comment was marked as resolved.
This comment was marked as resolved.
4d3981a to
09304f1
Compare
This comment has been minimized.
This comment has been minimized.
ab82ba5 to
dc60c28
Compare
This comment has been minimized.
This comment has been minimized.
dc60c28 to
3cc8a08
Compare
This comment has been minimized.
This comment has been minimized.
3cc8a08 to
e473e47
Compare
| let _ = y.div_ceil(-7); | ||
| let _ = y.div_ceil(-7); | ||
| let _ = y.div_ceil(-7); | ||
| let _ = (y + -8) / -7; | ||
| let _ = (-8 + y) / -7; | ||
| let _ = (y - 8) / -7; |
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.
This is actually a bugfix.
|
Some changes occurred in compiler/rustc_attr_parsing Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri, @rust-lang/wg-const-eval Some changes occurred in src/tools/clippy cc @rust-lang/clippy Some changes occurred in cc @BoxyUwU HIR ty lowering was modified cc @fmease Some changes occurred in compiler/rustc_codegen_ssa/src/codegen_attrs.rs Some changes occurred in match checking cc @Nadrieril |
|
The 2 weeks of the MCP at rust-lang/compiler-team#835 is formally over |
|
☔ The latest upstream changes (presumably #137752) made this pull request unmergeable. Please resolve the merge conflicts. |
|
After reading the diff I think this a net negative even in case of HIR. I understand that it is a follow up to the work on patterns in #134248 and its predecessors.
I don't think the case of patterns should be extended to the rest of the language. Some type error treatment also becomes less natural with this approach, previously As for the early compilation, I think the right mindset there is that negative literals simply don't exist, and if something looks like a negative literal to you, then it's just imagination. So I clearly disagree with the idea of "just having the concept of negative literals everywhere". |
A lot of situations in the compiler check for unary negation of literals, which I want to replace entirely at some point. I think the only place that should have to handle such things is the overflowing literals lint to detect double negation. Everywhere else we should just have the concept of negative literals
See also the corresponding MCP: rust-lang/compiler-team#835