add comment and bless some tests

This commit is contained in:
Vishnunarayan K I
2020-12-02 17:19:11 +05:30
parent a6c4cbd46a
commit 1b7fe09025
11 changed files with 242 additions and 140 deletions

View File

@@ -38,7 +38,11 @@ impl<'mir, 'tcx> InterpCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>> {
if instance.def.requires_caller_location(self.tcx()) {
return Ok(false);
}
// only memoize instrinsics
// Only memoize instrinsics. This was added in #79594 while adding the `const_allocate` intrinsic.
// We only memoize intrinsics because it would be unsound to memoize functions
// which might interact with the heap.
// Additionally, const_allocate intrinsic is impure and thus should not be memoized;
// it will not be memoized because it has non-ZST args
if !matches!(instance.def, InstanceDef::Intrinsic(_)) {
return Ok(false);
}