diff --git a/src/librustc_codegen_ssa/mir/mod.rs b/src/librustc_codegen_ssa/mir/mod.rs index 85a663dacdc..c7e2131eed5 100644 --- a/src/librustc_codegen_ssa/mir/mod.rs +++ b/src/librustc_codegen_ssa/mir/mod.rs @@ -586,10 +586,17 @@ fn arg_local_refs<'a, 'tcx: 'a, Bx: BuilderMethods<'a, 'tcx>>( return; } + let pin_did = tcx.lang_items().pin_type(); // Or is it the closure environment? let (closure_layout, env_ref) = match arg.layout.ty.sty { ty::RawPtr(ty::TypeAndMut { ty, .. }) | ty::Ref(_, ty, _) => (bx.layout_of(ty), true), + ty::Adt(def, substs) if Some(def.did) == pin_did => { + match substs.type_at(0).sty { + ty::Ref(_, ty, _) => (bx.layout_of(ty), true), + _ => (arg.layout, false), + } + } _ => (arg.layout, false) }; diff --git a/src/test/debuginfo/generators.rs b/src/test/debuginfo/generators.rs new file mode 100644 index 00000000000..b56d222e0e0 --- /dev/null +++ b/src/test/debuginfo/generators.rs @@ -0,0 +1,36 @@ +// min-lldb-version: 310 + +// compile-flags:-g + +// === GDB TESTS =================================================================================== + +// gdb-command:run +// gdb-command:print a +// gdb-check:$1 = 5 + +// === LLDB TESTS ================================================================================== + +// lldb-command:run +// lldb-command:print a +// lldbg-check:(int) $0 = 5 +// lldbr-check:(int) a = 5 + +#![feature(omit_gdb_pretty_printer_section, generators, generator_trait, pin)] +#![omit_gdb_pretty_printer_section] + +use std::ops::Generator; +use std::pin::Pin; + +fn main() { + let mut a = 5; + let mut b = || { + yield; + _zzz(); // #break + a = 6; + }; + Pin::new(&mut b).resume(); + Pin::new(&mut b).resume(); + _zzz(); // #break +} + +fn _zzz() {()}