-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Some clippy fixes in the compiler #110124
The head ref may contain hidden characters: "\u{1F4CE}-told-me-so"
Conversation
This pattern is fine for arena allocators.
Nothing was really incorrect before, but it did get nicer.
r? @jackh726 (rustbot has picked a reviewer for you, use r? to override) |
These commits modify compiler targets. Some changes occurred to the CTFE / Miri engine cc @rust-lang/miri
|
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.
r=me
The shadowing lead to an incorrect comparison. Rename it and compare it properly. compiler-errors told me that I should just include the fix here without a test.
Exhaustively destructure and ignore `()`
I removed the |
How do we repro the ICE? Seems worth someone writing an issue |
I used |
Co-authored-by: Michael Goulet <michael@errs.io>
Ok, looking at a90bd02, I think it makes sense that the r? @compiler-errors @bors r+ |
@@ -5,7 +5,7 @@ const RED_ZONE: usize = 100 * 1024; // 100k | |||
|
|||
// Only the first stack that is pushed, grows exponentially (2^n * STACK_PER_RECURSION) from then | |||
// on. This flag has performance relevant characteristics. Don't set it too high. | |||
const STACK_PER_RECURSION: usize = 1 * 1024 * 1024; // 1MB | |||
const STACK_PER_RECURSION: usize = 1024 * 1024; // 1MB |
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.
TBH, I think clippy is wrong to complain about this. Especially in a const
, there's absolutely nothing wrong with a 1 *
, and representing "X MB" as X * 1024 * 1024
is fine.
Maybe use 1 << 20
? That's also clearly 1 MiB
, and hopefully clippy wouldn't whine about it.
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 wish I agreed 1 << 20
was obviously 1 MB. Maybe I'm just uncommonly bad at all these bit twiddling operations.
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.
(For context: k
is a decimal shift by 3, M
is a decimal shift by 6, etc. The elementary school "move the decimal point" is, essentially, a shift. So M
≡ 10⁶, aka "<<₁₀ 6". And similarly Mi
≡ 2²⁰, aka << 20
. So "kebi", "mebi", "gibi", "tebi", etc are "<< 10", "<< 20", "<< 30", "<< 40", etc.)
Rollup of 6 pull requests Successful merges: - rust-lang#109724 (prioritize param env candidates if they don't guide type inference) - rust-lang#110021 (Fix a couple ICEs in the new `CastKind::Transmute` code) - rust-lang#110044 (Avoid some manual slice length calculation) - rust-lang#110115 (compiletest: Use remap-path-prefix only in CI) - rust-lang#110121 (Fix `x check --stage 1` when download-rustc is enabled) - rust-lang#110124 (Some clippy fixes in the compiler) Failed merges: - rust-lang#109752 (Stall auto trait assembly in new solver for int/float vars) r? `@ghost` `@rustbot` modify labels: rollup
Best reviewed commit-by-commit 📎.