diff options
| author | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-20 10:11:10 +0000 | 
|---|---|---|
| committer | Oli Scherer <git-spam-no-reply9815368754983@oli-obk.de> | 2023-10-20 21:14:02 +0000 | 
| commit | 5c1872d7ae10193ec41075c7ebc21bd43a236f53 (patch) | |
| tree | 80ab2149a50bcdd60e584d789d6bbe8f5503ad50 /tests/ui/coroutine/yield-in-initializer.rs | |
| parent | af93c20c06ec1f577f0544aaf98403a5d9ff143c (diff) | |
| download | rust-5c1872d7ae10193ec41075c7ebc21bd43a236f53.tar.gz rust-5c1872d7ae10193ec41075c7ebc21bd43a236f53.zip | |
Rename `generator` folder
Diffstat (limited to 'tests/ui/coroutine/yield-in-initializer.rs')
| -rw-r--r-- | tests/ui/coroutine/yield-in-initializer.rs | 17 | 
1 files changed, 17 insertions, 0 deletions
| diff --git a/tests/ui/coroutine/yield-in-initializer.rs b/tests/ui/coroutine/yield-in-initializer.rs new file mode 100644 index 00000000000..5a7b3a4feaf --- /dev/null +++ b/tests/ui/coroutine/yield-in-initializer.rs @@ -0,0 +1,17 @@ +// run-pass + +#![feature(coroutines)] + +fn main() { + static || { //~ WARN unused coroutine that must be used + loop { + // Test that `opt` is not live across the yield, even when borrowed in a loop + // See https://github.com/rust-lang/rust/issues/52792 + let opt = { + yield; + true + }; + let _ = &opt; + } + }; +} | 
