Name return place in debuginfo if it is a user variable
This commit is contained in:
parent
c38283d7a7
commit
b19d5c0592
2 changed files with 6 additions and 1 deletions
|
@ -115,7 +115,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||||
let full_debug_info = bx.sess().opts.debuginfo == DebugInfo::Full;
|
let full_debug_info = bx.sess().opts.debuginfo == DebugInfo::Full;
|
||||||
|
|
||||||
// FIXME(eddyb) maybe name the return place as `_0` or `return`?
|
// FIXME(eddyb) maybe name the return place as `_0` or `return`?
|
||||||
if local == mir::RETURN_PLACE {
|
if local == mir::RETURN_PLACE && !self.mir.local_decls[mir::RETURN_PLACE].is_user_variable()
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
use rustc_hir::Mutability;
|
||||||
use rustc_index::bit_set::HybridBitSet;
|
use rustc_index::bit_set::HybridBitSet;
|
||||||
use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
|
use rustc_middle::mir::visit::{MutVisitor, PlaceContext, Visitor};
|
||||||
use rustc_middle::mir::{self, BasicBlock, Local, Location};
|
use rustc_middle::mir::{self, BasicBlock, Local, Location};
|
||||||
|
@ -61,6 +62,9 @@ impl<'tcx> MirPass<'tcx> for RenameReturnPlace {
|
||||||
body.local_decls.pick2_mut(returned_local, mir::RETURN_PLACE);
|
body.local_decls.pick2_mut(returned_local, mir::RETURN_PLACE);
|
||||||
debug_assert_eq!(ret_decl.ty, renamed_decl.ty);
|
debug_assert_eq!(ret_decl.ty, renamed_decl.ty);
|
||||||
ret_decl.clone_from(renamed_decl);
|
ret_decl.clone_from(renamed_decl);
|
||||||
|
|
||||||
|
// The return place is always mutable.
|
||||||
|
ret_decl.mutability = Mutability::Mut;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue