diff options
| author | Luqman Aden <laden@csclub.uwaterloo.ca> | 2014-12-05 18:35:16 -0500 |
|---|---|---|
| committer | Luqman Aden <laden@csclub.uwaterloo.ca> | 2014-12-05 18:56:40 -0500 |
| commit | 8ebc1c9fd88640b1833e0743b649a957f3337720 (patch) | |
| tree | 136bdabeb7e145931a9bac6bb7c24d35958e32b0 /src/test/debuginfo | |
| parent | 6f4c11be3b9706d1ba0e1b74b89de1478410a56f (diff) | |
| download | rust-8ebc1c9fd88640b1833e0743b649a957f3337720.tar.gz rust-8ebc1c9fd88640b1833e0743b649a957f3337720.zip | |
librustc: Fix debuginfo for captured variables in non-FnOnce unboxed closures.
Diffstat (limited to 'src/test/debuginfo')
| -rw-r--r-- | src/test/debuginfo/var-captured-in-stack-closure.rs | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index 92a3d358f5c..761d0f0be8f 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -28,6 +28,19 @@ // gdb-command:print *owned // gdb-check:$5 = 6 +// gdb-command:continue + +// gdb-command:print variable +// gdb-check:$6 = 2 +// gdb-command:print constant +// gdb-check:$7 = 2 +// gdb-command:print a_struct +// gdb-check:$8 = {a = -3, b = 4.5, c = 5} +// gdb-command:print *struct_ref +// gdb-check:$9 = {a = -3, b = 4.5, c = 5} +// gdb-command:print *owned +// gdb-check:$10 = 6 + // === LLDB TESTS ================================================================================== @@ -44,6 +57,20 @@ // lldb-command:print *owned // lldb-check:[...]$4 = 6 +// lldb-command:continue + +// lldb-command:print variable +// lldb-check:[...]$5 = 2 +// lldb-command:print constant +// lldb-check:[...]$6 = 2 +// lldb-command:print a_struct +// lldb-check:[...]$7 = Struct { a: -3, b: 4.5, c: 5 } +// lldb-command:print *struct_ref +// lldb-check:[...]$8 = Struct { a: -3, b: 4.5, c: 5 } +// lldb-command:print *owned +// lldb-check:[...]$9 = 6 + +#![feature(unboxed_closures)] #![allow(unused_variables)] struct Struct { @@ -65,12 +92,22 @@ fn main() { let struct_ref = &a_struct; let owned = box 6; - let closure = || { - zzz(); // #break - variable = constant + a_struct.a + struct_ref.a + *owned; - }; - - closure(); + { + let closure = || { + zzz(); // #break + variable = constant + a_struct.a + struct_ref.a + *owned; + }; + + closure(); + } + + { + let mut unboxed_closure = |&mut:| { + zzz(); // #break + variable = constant + a_struct.a + struct_ref.a + *owned; + }; + unboxed_closure(); + } } fn zzz() {()} |
