mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +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 {
|
||||
throw_ub_format!(
|
||||
"deallocating {}, which is {} memory, using {} deallocation operation",
|
||||
|
Loading…
Reference in New Issue
Block a user