Configure saved panic locations based on location-detail flag
This commit is contained in:
parent
a9a1393cbf
commit
e1d94b8fd1
1 changed files with 11 additions and 4 deletions
|
@ -80,10 +80,17 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
|
||||||
line: u32,
|
line: u32,
|
||||||
col: u32,
|
col: u32,
|
||||||
) -> MPlaceTy<'tcx, M::PointerTag> {
|
) -> MPlaceTy<'tcx, M::PointerTag> {
|
||||||
let file =
|
let loc_details = &self.tcx.sess.opts.debugging_opts.location_detail;
|
||||||
self.allocate_str(&filename.as_str(), MemoryKind::CallerLocation, Mutability::Not);
|
let file = if loc_details.file {
|
||||||
let line = Scalar::from_u32(line);
|
self.allocate_str(&filename.as_str(), MemoryKind::CallerLocation, Mutability::Not)
|
||||||
let col = Scalar::from_u32(col);
|
} else {
|
||||||
|
// FIXME: This creates a new allocation each time. It might be preferable to
|
||||||
|
// perform this allocation only once, and re-use the `MPlaceTy`.
|
||||||
|
// See https://github.com/rust-lang/rust/pull/89920#discussion_r730012398
|
||||||
|
self.allocate_str("<redacted>", MemoryKind::CallerLocation, Mutability::Not)
|
||||||
|
};
|
||||||
|
let line = if loc_details.line { Scalar::from_u32(line) } else { Scalar::from_u32(0) };
|
||||||
|
let col = if loc_details.column { Scalar::from_u32(col) } else { Scalar::from_u32(0) };
|
||||||
|
|
||||||
// Allocate memory for `CallerLocation` struct.
|
// Allocate memory for `CallerLocation` struct.
|
||||||
let loc_ty = self
|
let loc_ty = self
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue