diff --git a/src/librustc_codegen_ssa/mir/debuginfo.rs b/src/librustc_codegen_ssa/mir/debuginfo.rs index f66496d10fb..9cba77b7298 100644 --- a/src/librustc_codegen_ssa/mir/debuginfo.rs +++ b/src/librustc_codegen_ssa/mir/debuginfo.rs @@ -307,11 +307,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { let var_ty = self.monomorphized_place_ty(place.as_ref()); let var_kind = if self.mir.local_kind(place.local) == mir::LocalKind::Arg && place.projection.is_empty() + && var.source_info.scope == mir::OUTERMOST_SOURCE_SCOPE { - // FIXME(eddyb, #67586) take `var.source_info.scope` into - // account to avoid using `ArgumentVariable` more than once - // per argument local. - let arg_index = place.local.index() - 1; // FIXME(eddyb) shouldn't `ArgumentVariable` indices be diff --git a/src/test/ui/mir/mir-inlining/var-debuginfo-issue-67586.rs b/src/test/ui/mir/mir-inlining/var-debuginfo-issue-67586.rs new file mode 100644 index 00000000000..23cc114880c --- /dev/null +++ b/src/test/ui/mir/mir-inlining/var-debuginfo-issue-67586.rs @@ -0,0 +1,11 @@ +// run-pass +// compile-flags: -Z mir-opt-level=2 -C opt-level=0 -C debuginfo=2 + +#[inline(never)] +pub fn foo(bar: usize) -> usize { + std::convert::identity(bar) +} + +fn main() { + foo(0); +}