mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 01:34:21 +00:00
reject deallocation of read-only allocations
This commit is contained in:
parent
6e92fb4098
commit
3bcba11c35
@ -321,6 +321,9 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if alloc.mutability == Mutability::Not {
|
||||||
|
throw_ub_format!("deallocating immutable allocation {}", ptr.alloc_id);
|
||||||
|
}
|
||||||
if alloc_kind != kind {
|
if alloc_kind != kind {
|
||||||
throw_ub_format!(
|
throw_ub_format!(
|
||||||
"deallocating {}, which is {} memory, using {} deallocation operation",
|
"deallocating {}, which is {} memory, using {} deallocation operation",
|
||||||
|
Loading…
Reference in New Issue
Block a user