-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Fixed length array type with extremely high count causes excessive compile time #15918
Comments
This doesn't compile anymore:
fn main() {
let x: [usize; 18446744073709551615];
} The largest rustc allows is a size of 2^46. It compiles fine, in short time! fn main() {
let x: [u8; 1 << 46];
} |
This is still a problem with zero-sized types if you have an initializer: fn main() {
let x = [(); 18446744073709551615];
} I let it run for 10 seconds before killing it. |
Weird, I can't reproduce that. I tried different options like optimization or not, debug info or not.
|
@bluss Oops, my bad. It's hanging on running the program, not compiling it. |
This seems to be (mostly) expected: without optimisations the very large initializer compiles to a (no-op) loop, which would be setting each element if they needed any setting. .LBB0_1:
movq -16(%rsp), %rax
addq $1, %rax
cmpq $-1, %rax
movq %rax, -16(%rsp)
jb .LBB0_1 With optimisations this is of course eliminated. But compile times are very fast in either case, so I'm closing. |
Expand lint tables && make clippy happy 🎉 This PR expands the lint tables on `./Cargo.toml` and thereby makes `cargo clippy` exit successfully! 🎉 Fixes rust-lang#15918 ## How? In the beginning there are some warnings for rustc. Next, and most importantly, there is the clippy lint table. There are a few sections in there. First there are the lint groups. Second there are all lints which are permanently allowed with the reasoning why they are allowed. Third there is a huge list of temporarily allowed lints. They should be removed in the mid-term, but incur a substantial amount of work, therefore they are allowed for now and can be worked on bit by bit. Fourth there are all lints which should warn. Additionally there are a few allow statements in the code for lints which should be permanently allowed in this specific place, but not in the whole code base. ## Follow up work - [ ] Run clippy in CI - [ ] Remove tidy test (at least `@Veykril` wrote this in rust-lang#15017) - [ ] Work on temporarily allowed lints
A local variable with a fixed-length array type with an excessively. This is true even if there's no initializer expression.
I haven't profiled to figure out what the compiler is actually doing. I also have no idea how long this actually runs for; I ended up killing rustc after about 30 seconds.
The text was updated successfully, but these errors were encountered: