2d8f6389d0
Generator Resume Arguments
cc https://github.com/rust-lang/rust/issues/43122 and https://github.com/rust-lang/rust/issues/56974
Blockers:
* [x] Fix miscompilation when resume argument is live across a yield point (https://github.com/rust-lang/rust/pull/68524#issuecomment-578459069)
* [x] Fix 10% compile time regression in `await-call-tree` benchmarks (https://github.com/rust-lang/rust/pull/68524#issuecomment-578487162)
* [x] Fix remaining 1-3% regression (https://github.com/rust-lang/rust/pull/68524#issuecomment-579566255) - resolved (https://github.com/rust-lang/rust/pull/68524#issuecomment-581144901)
* [x] Make dropck rules account for resume arguments (https://github.com/rust-lang/rust/pull/68524#issuecomment-578541137)
Follow-up work:
* Change async/await desugaring to make use of this feature
* Rewrite [`box_region.rs`](
|
||
---|---|---|
.. | ||
const_prop | ||
inline | ||
nll | ||
address-of.rs | ||
array-index-is-temporary.rs | ||
basic_assignment.rs | ||
box_expr.rs | ||
byte_slice.rs | ||
combine_array_len.rs | ||
const-promotion-extern-static.rs | ||
copy_propagation_arg.rs | ||
copy_propagation.rs | ||
deaggregator_test_enum_2.rs | ||
deaggregator_test_enum.rs | ||
deaggregator_test_multiple.rs | ||
deaggregator_test.rs | ||
exponential-or.rs | ||
generator-drop-cleanup.rs | ||
generator-storage-dead-unwind.rs | ||
graphviz.rs | ||
issue-38669.rs | ||
issue-41110.rs | ||
issue-41697.rs | ||
issue-41888.rs | ||
issue-49232.rs | ||
issue-62289.rs | ||
loop_test.rs | ||
match_false_edges.rs | ||
match_test.rs | ||
match-arm-scopes.rs | ||
no-spurious-drop-after-call.rs | ||
packed-struct-drop-aligned.rs | ||
README.md | ||
remove_fake_borrows.rs | ||
retag.rs | ||
retain-never-const.rs | ||
return_an_array.rs | ||
simple-match.rs | ||
simplify_cfg.rs | ||
simplify_if.rs | ||
simplify_match.rs | ||
simplify_try.rs | ||
simplify-arm-identity.rs | ||
simplify-locals-removes-unused-consts.rs | ||
slice-drop-shim.rs | ||
storage_live_dead_in_statics.rs | ||
storage_ranges.rs | ||
uniform_array_move_out.rs | ||
uninhabited_enum_branching.rs | ||
uninhabited-enum.rs | ||
unreachable_asm_2.rs | ||
unreachable_asm.rs | ||
unreachable_diverging.rs | ||
unreachable.rs | ||
unusual-item-types.rs | ||
while-storage.rs |
This folder contains tests for MIR optimizations.
The test format is:
(arbitrary rust code)
// END RUST SOURCE
// START $file_name_of_some_mir_dump_0
// $expected_line_0
// (lines or elision)
// $expected_line_N
// END $file_name_of_some_mir_dump_0
// (lines or elision)
// START $file_name_of_some_mir_dump_N
// $expected_line_0
// (lines or elision)
// $expected_line_N
// END $file_name_of_some_mir_dump_N
All the test information is in comments so the test is runnable.
For each $file_name, compiletest expects [$expected_line_0, ...,
$expected_line_N] to appear in the dumped MIR in order. Currently it allows
other non-matched lines before and after, but not between $expected_lines,
should you want to skip lines, you must include an elision comment, of the form
(as a regex) //\s*...\s*
. The lines will be skipped lazily, that is, if there
are two identical lines in the output that match the line after the elision
comment, the first one will be matched.
Examples:
The following blocks will not match the one after it.
bb0: {
StorageLive(_1);
_1 = const true;
StorageDead(_1);
}
bb0: {
StorageLive(_1);
_1 = const true;
goto -> bb1
}
bb1: {
StorageDead(_1);
return;
}
But this will match the one above,
bb0: {
StorageLive(_1);
_1 = const true;
...
StorageDead(_1);
...
}
Lines match ignoring whitespace, and the prefix "//" is removed.
It also currently strips trailing comments -- partly because the full file path in "scope comments" is unpredictable and partly because tidy complains about the lines being too long.
compiletest handles dumping the MIR before and after every pass for you. The test writer only has to specify the file names of the dumped files (not the full path to the file) and what lines to expect. There is an option to rustc that tells it to dump the mir into some directly (rather then always dumping to the current directory).