Dangling pointers point to everything and nothing
Co-authored-by: Ralf Jung <post@ralfj.de>
This commit is contained in:
parent
e5e4a851c4
commit
8968c8a103
|
@ -595,8 +595,7 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
|
|||
// Locals with StorageDead are definitely not part of the final constant value, and
|
||||
// it is thus inherently safe to permit such locals to have their
|
||||
// address taken as we can't end up with a reference to them in the
|
||||
// final value without creating a dangling pointer, which will cause
|
||||
// errors during validation.
|
||||
// final value.
|
||||
// Note: This is only sound if every local that has a `StorageDead` has a
|
||||
// `StorageDead` in every control flow path leading to a `return` terminator.
|
||||
if self.local_has_storage_dead(place.local) {
|
||||
|
|
Loading…
Reference in a new issue