Skip to content

Commit af59eec

Browse files
committed
Move validation into eval_body_using_ecx
1 parent 66a46bb commit af59eec

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

compiler/rustc_const_eval/src/const_eval/eval_queries.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ fn eval_body_using_ecx<'mir, 'tcx>(
8484
// Intern the result
8585
intern_const_alloc_recursive(ecx, intern_kind, &ret)?;
8686

87+
// Since evaluation had no errors, validate the resulting constant.
88+
const_validate_mplace(&ecx, &ret, cid)?;
89+
8790
Ok(ret)
8891
}
8992

@@ -382,12 +385,7 @@ fn eval_in_interpreter<'tcx, R: InterpretationResult<'tcx>>(
382385
},
383386
))
384387
}
385-
Ok(mplace) => {
386-
// Since evaluation had no errors, validate the resulting constant.
387-
const_validate_mplace(&ecx, &mplace, cid)?;
388-
389-
Ok(R::make_result(mplace, ecx))
390-
}
388+
Ok(mplace) => Ok(R::make_result(mplace, ecx)),
391389
}
392390
}
393391

0 commit comments

Comments
 (0)