]> git.lizzy.rs Git - rust.git/commit - src/tools/clippy
Auto merge of #69716 - jonas-schievink:generator-size, r=tmandry
authorbors <bors@rust-lang.org>
Sat, 14 Mar 2020 02:04:49 +0000 (02:04 +0000)
committerbors <bors@rust-lang.org>
Sat, 14 Mar 2020 02:04:49 +0000 (02:04 +0000)
commit5ed3453af9db9c516e564e25ba9ee28056d48103
tree65db0063b1b17f28b7c2c553c13e87b1b27bb5aa
parentbe055d96c4c223a5ad49a0181f0b43bc46781708
parentb26e27c5f3e7f24982f90183630b3fcffc3f7b8a
Auto merge of #69716 - jonas-schievink:generator-size, r=tmandry

Don't store locals in generators that are immediately overwritten with the resume argument

This fixes https://github.com/rust-lang/rust/issues/69672 and makes https://github.com/rust-lang/rust/pull/69033 pass the async fn size tests again (in other words, there will be no size regression of async fn if both this and https://github.com/rust-lang/rust/pull/69033 land).

~~This is a small botch and I'd rather have a more precise analysis, but that seems much harder to pull off, so this special-cases `Yield` terminators that store the resume argument into a simple local (ie. without any field projections) and explicitly marks that local as "not live" in the suspend point of that yield. We know that this local does not need to be stored in the generator for this suspend point because the next resume would immediately overwrite it with the passed-in resume argument anyways. The local might still end up in the state if it is used across another yield.~~ (this now properly updates the dataflow framework to handle this case)
src/librustc_mir/dataflow/generic/engine.rs
src/librustc_mir/dataflow/generic/graphviz.rs
src/librustc_mir/transform/generator.rs