1
Fork 0

miri: do not apply aliasing restrictions to Box with custom allocator

This commit is contained in:
Ralf Jung 2024-03-09 13:05:13 +01:00
parent 1b427b3bf7
commit e632e3f9a5
12 changed files with 250 additions and 35 deletions

View file

@ -2008,13 +2008,10 @@ impl<'tcx> Ty<'tcx> {
// Single-argument Box is always global. (for "minicore" tests)
return true;
};
if let Some(alloc_adt) = alloc.expect_ty().ty_adt_def() {
alloc.expect_ty().ty_adt_def().is_some_and(|alloc_adt| {
let global_alloc = tcx.require_lang_item(LangItem::GlobalAlloc, None);
alloc_adt.did() == global_alloc
} else {
// Allocator is not an ADT...
false
}
})
}
_ => false,
}