reword comment
This commit is contained in:
parent
73ce868c7e
commit
2ab85e4178
@ -178,13 +178,16 @@ pub fn intern_const_alloc_recursive<
|
|||||||
// promoteds as immutable.
|
// promoteds as immutable.
|
||||||
found_bad_mutable_pointer = true;
|
found_bad_mutable_pointer = true;
|
||||||
}
|
}
|
||||||
// It is tempting to intern as immutable if `prov.immutable()`. However, there
|
// We always intern with `inner_mutability`, and furthermore we ensured above that if
|
||||||
// might be multiple pointers to the same allocation, and if *at least one* of
|
// that is "immutable", then there are *no* mutable pointers anywhere in the newly
|
||||||
// them is mutable, the allocation must be interned mutably. We will intern the
|
// interned memory -- justifying that we can indeed intern immutably. However this also
|
||||||
// allocation when we encounter the first pointer. Therefore we always intern
|
// means we can *not* easily intern immutably here if `prov.immutable()` is true and
|
||||||
// with `inner_mutability`, and furthermore we ensured above that if that is
|
// `inner_mutability` is `Mut`: there might be other pointers to that allocation, and
|
||||||
// "immutable", then there are *no* mutable pointers anywhere in the newly
|
// we'd have to somehow check that they are *all* immutable before deciding that this
|
||||||
// interned memory.
|
// allocation can be made immutable. In the future we could consider analyzing all
|
||||||
|
// pointers before deciding which allocations can be made immutable; but for now we are
|
||||||
|
// okay with losing some potential for immutability here. This can anyway only affect
|
||||||
|
// `static mut`.
|
||||||
todo.push((alloc_id, inner_mutability));
|
todo.push((alloc_id, inner_mutability));
|
||||||
})
|
})
|
||||||
.map_err(|()| {
|
.map_err(|()| {
|
||||||
|
Loading…
Reference in New Issue
Block a user