diff options
| author | b-naber <bn263@gmx.de> | 2022-04-12 18:14:28 +0200 |
|---|---|---|
| committer | b-naber <bn263@gmx.de> | 2022-05-16 15:58:15 +0200 |
| commit | 96b36d6eb21daaca2c2d04fd8d7c27bef5eb90c6 (patch) | |
| tree | 72d103dc5986ab6608c5976422d14002a2cb6020 /compiler/rustc_const_eval/src/interpret | |
| parent | 56d540e0571ac1b0633ce10644224c495aaf42a0 (diff) | |
| download | rust-96b36d6eb21daaca2c2d04fd8d7c27bef5eb90c6.tar.gz rust-96b36d6eb21daaca2c2d04fd8d7c27bef5eb90c6.zip | |
use GlobalId in eval_to_valtree query and introduce query for valtree_to_const_val
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret')
| -rw-r--r-- | compiler/rustc_const_eval/src/interpret/place.rs | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index 95d6f431391..62f9c8f990d 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -115,12 +115,6 @@ impl<'tcx, Tag: Provenance> std::ops::Deref for MPlaceTy<'tcx, Tag> { } } -impl<'tcx, Tag: Provenance> std::ops::DerefMut for MPlaceTy<'tcx, Tag> { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.mplace - } -} - impl<'tcx, Tag: Provenance> From<MPlaceTy<'tcx, Tag>> for PlaceTy<'tcx, Tag> { #[inline(always)] fn from(mplace: MPlaceTy<'tcx, Tag>) -> Self { @@ -197,6 +191,18 @@ impl<'tcx, Tag: Provenance> MPlaceTy<'tcx, Tag> { } #[inline] + pub fn from_aligned_ptr_with_meta( + ptr: Pointer<Option<Tag>>, + layout: TyAndLayout<'tcx>, + meta: MemPlaceMeta<Tag>, + ) -> Self { + let mut mplace = MemPlace::from_ptr(ptr, layout.align.abi); + mplace.meta = meta; + + MPlaceTy { mplace, layout } + } + + #[inline] pub(crate) fn len(&self, cx: &impl HasDataLayout) -> InterpResult<'tcx, u64> { if self.layout.is_unsized() { // We need to consult `meta` metadata @@ -495,7 +501,7 @@ where /// Project into an mplace #[instrument(skip(self), level = "debug")] - pub(crate) fn mplace_projection( + pub(super) fn mplace_projection( &self, base: &MPlaceTy<'tcx, M::PointerTag>, proj_elem: mir::PlaceElem<'tcx>, |
