Open alansartorio opened 1 year ago
@rustbot label +I-compiletime
I'm seeing similar when using a lazy state monad implemented at the type level, where each step in the binding chain introduces multiple layers of nesting to the final thunk struct.
This quickly adds up: The pure functional equivalent of binding 3 ZST-tagged variables, feeding them to a function, and storing back its output compiles in ~0.5sec, but balloons up to ~150sec with a chain of twice that length.
I tried this code:
And for each wrap I add, compilation times and memory usage double unexpectedly.
When I run
RUSTFLAGS="-Z time-passes" cargo check
I get this:Here's a playground where you can reproduce it: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=db81287cfac9166b22476eb739703812
I got this code by reducing a parser I was writing using the chumsky crate:
I checked some similar issues but I couldn't find the same problem I have:
This one says that it worked fine on version 1.40.0, but my code doesn't https://github.com/rust-lang/rust/issues/83341
This one uses the
return_position_impl_trait_in_trait
feature, mine doesn't https://github.com/rust-lang/rust/issues/102527Meta
rustc --version --verbose
: