diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-03-23 03:05:34 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-23 03:05:34 +0100 |
| commit | 2f24923ab3f38e33a2ad98618852e0089d63ba7d (patch) | |
| tree | 052b5e1141316603d482e0cdf8a9537305d41ca4 /compiler | |
| parent | e1f2d354a7d6987e50719c24473ed9ae33f59392 (diff) | |
| parent | 8a1f928b8e1969b88de614602bd5d73f6a2b358e (diff) | |
| download | rust-2f24923ab3f38e33a2ad98618852e0089d63ba7d.tar.gz rust-2f24923ab3f38e33a2ad98618852e0089d63ba7d.zip | |
Rollup merge of #95222 - RalfJung:validity, r=Dylan-DPC
interpret/validity: improve clarity I was confused by my own (ancient) comment in `validity.rs` so I figured I'd clarify. (And I don't think ZST-ness is relevant at all inside that branch, no idea where that comment comes from.) Also `extend` seems more clear than `clone_from`.
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/validity.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/validity.rs b/compiler/rustc_const_eval/src/interpret/validity.rs index 8fad5e63baf..8bdafa87623 100644 --- a/compiler/rustc_const_eval/src/interpret/validity.rs +++ b/compiler/rustc_const_eval/src/interpret/validity.rs @@ -432,9 +432,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' if let Some(ref mut ref_tracking) = self.ref_tracking { // Proceed recursively even for ZST, no reason to skip them! // `!` is a ZST and we want to validate it. - // Skip validation entirely for some external statics if let Ok((alloc_id, _offset, _ptr)) = self.ecx.memory.ptr_try_get_alloc(place.ptr) { - // not a ZST + // Special handling for pointers to statics (irrespective of their type). let alloc_kind = self.ecx.tcx.get_global_alloc(alloc_id); if let Some(GlobalAlloc::Static(did)) = alloc_kind { assert!(!self.ecx.tcx.is_thread_local_static(did)); @@ -469,7 +468,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' // We need to clone the path anyway, make sure it gets created // with enough space for the additional `Deref`. let mut new_path = Vec::with_capacity(path.len() + 1); - new_path.clone_from(path); + new_path.extend(path); new_path.push(PathElem::Deref); new_path }); |
