diff options
| author | SNCPlay42 <SNCPlay42@gmail.com> | 2020-10-26 09:28:09 +0000 |
|---|---|---|
| committer | SNCPlay42 <SNCPlay42@gmail.com> | 2020-10-26 09:29:50 +0000 |
| commit | 8bf9abbb7b7321ed4014b7f0d9978e425c966c95 (patch) | |
| tree | ce93fe13b97dc4e902dca27edcce874812a7025a /src | |
| parent | 69e68cf550fb7ba6137b167c17d0fcbe7ea06ce2 (diff) | |
always record reference to binding in match if guards
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/generator/yielding-in-match-guards.rs | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/test/ui/generator/yielding-in-match-guards.rs b/src/test/ui/generator/yielding-in-match-guards.rs index d8aa354b1c6..c76726414df 100644 --- a/src/test/ui/generator/yielding-in-match-guards.rs +++ b/src/test/ui/generator/yielding-in-match-guards.rs @@ -1,4 +1,4 @@ -// check-pass +// build-pass // edition:2018 // This test is derived from @@ -11,6 +11,7 @@ // of the underlying generator. async fn f() -> u8 { 1 } +async fn foo() -> [bool; 10] { [false; 10] } pub async fn g(x: u8) { match x { @@ -19,6 +20,24 @@ pub async fn g(x: u8) { } } +// #78366: check the reference to the binding is recorded even if the binding is not autorefed + +async fn h(x: usize) { + match x { + y if foo().await[y] => (), + _ => (), + } +} + +async fn i(x: u8) { + match x { + y if f().await == y + 1 => (), + _ => (), + } +} + fn main() { let _ = g(10); + let _ = h(9); + let _ = i(8); } |
