Exponential compile time with invalid use of modifying-assignment operators
Open
Nobody has claimed this yet.
C-bug
I-compiletime
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Found by fuzzing and probably only affects fuzzing
Code
fn a() {
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1 += &
1
}
Where it's slow
According to -Z time-passes the slowness is within type_check_crate.
check_expr_coercible_to_type is on the stack multiple times (sample head)
Regression
Regression in nightly-2023-04-30, maybe due to #110877?
Commits in range
commit[0] 2023-04-28UTC: Auto merge of #110901 - GuillaumeGomez:inlined-repr-rustdoc, r=notriddle
commit[1] 2023-04-28UTC: Auto merge of #110967 - matthiaskrgr:rollup-vfbl7gm, r=matthiaskrgr
commit[2] 2023-04-29UTC: Auto merge of #110643 - pietroalbini:pa-bump-stage0, r=Mark-Simulacrum
commit[3] 2023-04-29UTC: Auto merge of #110978 - Dylan-DPC:rollup-xclzwax, r=Dylan-DPC
commit[4] 2023-04-29UTC: Auto merge of #108106 - the8472:layout-opt, r=wesleywiser
commit[5] 2023-04-29UTC: Auto merge of #110992 - bjorn3:sync_cg_clif-2023-04-29, r=bjorn3
commit[6] 2023-04-29UTC: Auto merge of #110994 - matthiaskrgr:rollup-wv4u5yi, r=matthiaskrgr
commit[7] 2023-04-29UTC: Auto merge of #110576 - jyn514:unify-test-args, r=ozkanonur
Version
rustc 1.75.0-nightly (fee5518cd 2023-11-05)
binary: rustc
commit-hash: fee5518cdd4435c60a57fe3bb734fc1a14abeb7a
commit-date: 2023-11-05
host: x86_64-apple-darwin
release: 1.75.0-nightly
LLVM version: 17.0.4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproducer in the issue and use -Z time-passes to inspect type_check_crate. Trace the repeated check_expr_coercible_to_type calls shown in the sample stack. Done means the invalid modifying-assignment input no longer causes exponential compile-time growth, with the reported behavior verified on the reproducer.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100