File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
compiler/rustc_const_eval/src/interpret Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -421,13 +421,17 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
421
421
/// Called on places used for in-place function argument and return value handling.
422
422
///
423
423
/// These places need to be protected to make sure the program cannot tell whether the
424
- /// argument/return value was actually copied or passed in-place..
424
+ /// argument/return value was actually copied or passed in-place.
425
425
fn protect_in_place_function_argument (
426
426
ecx : & mut InterpCx < ' mir , ' tcx , Self > ,
427
427
place : & PlaceTy < ' tcx , Self :: Provenance > ,
428
428
) -> InterpResult < ' tcx > {
429
429
// Without an aliasing model, all we can do is put `Uninit` into the place.
430
- ecx. write_uninit ( place)
430
+ // This can only be violated with custom MIR though so we avoid the perf hit.
431
+ if ecx. tcx . sess . opts . unstable_opts . extra_const_ub_checks {
432
+ ecx. write_uninit ( place) ?;
433
+ }
434
+ Ok ( ( ) )
431
435
}
432
436
433
437
/// Called immediately before a new stack frame gets pushed.
You can’t perform that action at this time.
0 commit comments