diff options
| author | Matthew Jasper <mjjasper1@gmail.com> | 2021-09-01 22:52:17 +0100 |
|---|---|---|
| committer | Matthew Jasper <mjjasper1@gmail.com> | 2021-09-01 23:47:41 +0100 |
| commit | ff8c0ef0e47639b32fdba062851a1367a9cc9ae2 (patch) | |
| tree | 65030b964b24d8c0ccaf02bd00f475bb09dfd179 /src/test/ui/drop | |
| parent | 50171c310cd15e1b2d3723766ce64e2e4d6696fc (diff) | |
| download | rust-ff8c0ef0e47639b32fdba062851a1367a9cc9ae2.tar.gz rust-ff8c0ef0e47639b32fdba062851a1367a9cc9ae2.zip | |
Fix drop handling for `if let` expressions
MIR lowering for `if let` expressions is now more complicated now that `if let` exists in HIR. This PR adds a scope for the variables bound in an `if let` expression and then uses an approach similar to how we handle loops to ensure that we reliably drop the correct variables.
Diffstat (limited to 'src/test/ui/drop')
| -rw-r--r-- | src/test/ui/drop/drop-if-let-binding.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/test/ui/drop/drop-if-let-binding.rs b/src/test/ui/drop/drop-if-let-binding.rs new file mode 100644 index 00000000000..9c1ac4e0c7f --- /dev/null +++ b/src/test/ui/drop/drop-if-let-binding.rs @@ -0,0 +1,7 @@ +// build-pass +// regression test for issue #88307 +// compile-flags: -C opt-level=s + +fn main() { + if let Some(_val) = Option::<String>::None {} +} |
