Skip to content

Commit 3ddc027

Browse files
committed
validation: avoid some intermediate allocations
1 parent f284f8b commit 3ddc027

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustc_mir/interpret/validity.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ macro_rules! try_validation {
6060
Ok(x) => x,
6161
Err(_) => throw_validation_failure!($what, $where),
6262
}
63-
}}
63+
}};
6464
}
6565

6666
/// We want to show a nice path to the invalid field for diagnostics,
@@ -428,7 +428,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
428428
err_unsup!(InvalidNullPointerUsage) =>
429429
throw_validation_failure!("NULL reference", self.path),
430430
err_unsup!(AlignmentCheckFailed { required, has }) =>
431-
throw_validation_failure!(format!("unaligned reference \
431+
throw_validation_failure!(format_args!("unaligned reference \
432432
(required {} byte alignment but found {})",
433433
required.bytes(), has.bytes()), self.path),
434434
err_unsup!(ReadBytesAsPointer) =>
@@ -519,7 +519,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
519519
let value = try_validation!(value.not_undef(),
520520
value,
521521
self.path,
522-
format!(
522+
format_args!(
523523
"something {}",
524524
wrapping_range_format(&layout.valid_range, max_hi),
525525
)
@@ -532,7 +532,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
532532
throw_validation_failure!(
533533
"a potentially NULL pointer",
534534
self.path,
535-
format!(
535+
format_args!(
536536
"something that cannot possibly fail to be {}",
537537
wrapping_range_format(&layout.valid_range, max_hi)
538538
)
@@ -545,7 +545,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
545545
throw_validation_failure!(
546546
"a pointer",
547547
self.path,
548-
format!(
548+
format_args!(
549549
"something that cannot possibly fail to be {}",
550550
wrapping_range_format(&layout.valid_range, max_hi)
551551
)
@@ -562,7 +562,7 @@ impl<'rt, 'mir, 'tcx, M: Machine<'mir, 'tcx>> ValueVisitor<'mir, 'tcx, M>
562562
throw_validation_failure!(
563563
bits,
564564
self.path,
565-
format!("something {}", wrapping_range_format(&layout.valid_range, max_hi))
565+
format_args!("something {}", wrapping_range_format(&layout.valid_range, max_hi))
566566
)
567567
}
568568
}

0 commit comments

Comments
 (0)