Skip to content
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

Slow compile times for promotion of [(); usize::MAX] #77062

Closed
carbotaniuman opened this issue Sep 22, 2020 · 5 comments · Fixed by #78172
Closed

Slow compile times for promotion of [(); usize::MAX] #77062

carbotaniuman opened this issue Sep 22, 2020 · 5 comments · Fixed by #78172
Assignees
Labels
A-const-eval Area: constant evaluation (mir interpretation) C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-compiletime Issue: Problems and improvements with respect to compile times. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@carbotaniuman
Copy link
Contributor

I tried this code:

fn main() {
    let _ = &[(); usize::MAX];
}

I expected to see this happen: code compiles in a reasonable amount of times or the slice gets elided entirely.

Instead, this happened: code takes multiple minutes to compile/gets killed by the playground.

Meta

rustc --version --verbose:

rustc 1.48.0-nightly (9b4154193 2020-09-14)
binary: rustc
commit-hash: 9b4154193e8471f36b1a9e781f1ef7d492fc6a6c
commit-date: 2020-09-14
host: x86_64-pc-windows-msvc
release: 1.48.0-nightly
LLVM version: 11.0

Also tested on playground stable and nightly.

@carbotaniuman carbotaniuman added the C-bug Category: This is a bug. label Sep 22, 2020
@jonas-schievink jonas-schievink added A-const-eval Area: constant evaluation (mir interpretation) I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-compiletime Issue: Problems and improvements with respect to compile times. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 22, 2020
@tesuji
Copy link
Contributor

tesuji commented Sep 23, 2020

The code compiled in about 6 seconds in Rust 1.29 and 1.30 : https://rust.godbolt.org/z/hbdora .
Before that it had capacity error. After that it exceeded 15 seconds limit of godbolt.

This is a regression-from-stable-to-stable but I cannot tag it.

@rustbot rustbot added E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 23, 2020
@jyn514 jyn514 added the regression-from-stable-to-stable Performance or correctness regression from one stable version to another. label Sep 23, 2020
@mstallmo
Copy link

It looks like this also works correctly on 1.31 stable as well: https://rust.godbolt.org/z/v5vEcE

@mstallmo mstallmo added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Sep 23, 2020
@mstallmo
Copy link

Decided on P-medium as discussed in the prioritization working group procedure.

@RalfJung
Copy link
Member

Cc @rust-lang/wg-const-eval

@wesleywiser
Copy link
Member

Fixed in #78061.

@wesleywiser wesleywiser self-assigned this Oct 21, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this issue Oct 22, 2020
bors added a commit to rust-lang-ci/rust that referenced this issue Oct 22, 2020
Rollup of 10 pull requests

Successful merges:

 - rust-lang#77420 (Unify const-checking structured errors for `&mut` and `&raw mut`)
 - rust-lang#77554 (Support signed integers and `char` in v0 mangling)
 - rust-lang#77976 (Mark inout asm! operands as used in liveness pass)
 - rust-lang#78009 (Haiku: explicitly set CMAKE_SYSTEM_NAME when cross-compiling)
 - rust-lang#78084 (Greatly improve display for small mobile devices screens)
 - rust-lang#78155 (Fix two small issues in compiler/rustc_lint/src/types.rs)
 - rust-lang#78156 (Fixed build failure of `rustfmt`)
 - rust-lang#78172 (Add test case for rust-lang#77062)
 - rust-lang#78188 (Add tracking issue number for pin_static_ref)
 - rust-lang#78200 (Add `ControlFlow::is_{break,continue}` methods)

Failed merges:

r? `@ghost`
@bors bors closed this as completed in 3adac03 Oct 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-eval Area: constant evaluation (mir interpretation) C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc I-compilemem Issue: Problems and improvements with respect to memory usage during compilation. I-compiletime Issue: Problems and improvements with respect to compile times. P-medium Medium priority regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants