Compiling #[derive(Debug)] enum
+ dbg!
is quadratic with enum variants
#133945
Labels
A-macros
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)
C-bug
Category: This is a bug.
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.
I tried compiling this code: lib.rs.zip
The code above was generated with the following python script:
I then compiled the code with
cargo build --release
. It takes 21.00s to compile on my machine, which is rather slow. It would be nice if it compiled faster.Note that reducing the number of variants from 10000 to 1000 makes the compilation take only 0.20s to compile on my machine. I suspect that something in the Debug trait impl is taking quadratic time, but only if you actually try to debug-print something.
This issue was discovered by tongke on the rust community discord.
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: