diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-09-03 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2020-09-03 17:01:27 +0200 |
| commit | 9daf8fd5b1d369cd2f91ac919dc5d17f4fd43c0c (patch) | |
| tree | 66fbdfad809b768916b1f81ccaffd06293955129 /src/test/ui/mir | |
| parent | 08deb863bdebfcbbb71c18acf903eca84f1df4e7 (diff) | |
| download | rust-9daf8fd5b1d369cd2f91ac919dc5d17f4fd43c0c.tar.gz rust-9daf8fd5b1d369cd2f91ac919dc5d17f4fd43c0c.zip | |
inliner: Emit storage markers for introduced arg temporaries
When introducing argument temporaries during inlining, emit storage marker statements just before the assignment and in the beginning of the return block. This ensures that such temporaries will not be considered live across yield points after inlining inside a generator.
Diffstat (limited to 'src/test/ui/mir')
| -rw-r--r-- | src/test/ui/mir/issue-71793-inline-args-storage.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/mir/issue-71793-inline-args-storage.rs b/src/test/ui/mir/issue-71793-inline-args-storage.rs new file mode 100644 index 00000000000..87b2806d4e2 --- /dev/null +++ b/src/test/ui/mir/issue-71793-inline-args-storage.rs @@ -0,0 +1,16 @@ +// Verifies that inliner emits StorageLive & StorageDead when introducing +// temporaries for arguments, so that they don't become part of the generator. +// Regression test for #71793. +// +// check-pass +// edition:2018 +// compile-args: -Zmir-opt-level=2 + +#![crate_type = "lib"] + +pub async fn connect() {} + +pub async fn connect_many() { + Vec::<String>::new().first().ok_or("").unwrap(); + connect().await; +} |
