Struct rustc_middle::mir::interpret::allocation::provenance_map::ProvenanceMap
source · pub struct ProvenanceMap<Prov = AllocId> {
ptrs: SortedMap<Size, Prov>,
bytes: Option<Box<SortedMap<Size, Prov>>>,
}
Expand description
Stores the provenance information of pointers stored in memory.
Fields§
§ptrs: SortedMap<Size, Prov>
Provenance in this map applies from the given offset for an entire pointer-size worth of bytes. Two entires in this map are always at least a pointer size apart.
bytes: Option<Box<SortedMap<Size, Prov>>>
Provenance in this map only applies to the given single byte.
This map is disjoint from the previous. It will always be empty when
Prov::OFFSET_IS_ADDR
is false.
Implementations§
source§impl<Prov> ProvenanceMap<Prov>
impl<Prov> ProvenanceMap<Prov>
source§impl ProvenanceMap
impl ProvenanceMap
source§impl<Prov: Provenance> ProvenanceMap<Prov>
impl<Prov: Provenance> ProvenanceMap<Prov>
sourcefn range_get_ptrs(
&self,
range: AllocRange,
cx: &impl HasDataLayout
) -> &[(Size, Prov)]
fn range_get_ptrs(
&self,
range: AllocRange,
cx: &impl HasDataLayout
) -> &[(Size, Prov)]
Returns all ptr-sized provenance in the given range.
If the range has length 0, returns provenance that crosses the edge between start-1
and
start
.
sourcefn range_get_bytes(&self, range: AllocRange) -> &[(Size, Prov)]
fn range_get_bytes(&self, range: AllocRange) -> &[(Size, Prov)]
Returns all byte-wise provenance in the given range.
sourcepub fn get(&self, offset: Size, cx: &impl HasDataLayout) -> Option<Prov>
pub fn get(&self, offset: Size, cx: &impl HasDataLayout) -> Option<Prov>
Get the provenance of a single byte.
sourcepub fn get_ptr(&self, offset: Size) -> Option<Prov>
pub fn get_ptr(&self, offset: Size) -> Option<Prov>
Check if here is ptr-sized provenance at the given index. Does not mean anything for bytewise provenance! But can be useful as an optimization.
sourcepub fn range_empty(&self, range: AllocRange, cx: &impl HasDataLayout) -> bool
pub fn range_empty(&self, range: AllocRange, cx: &impl HasDataLayout) -> bool
Returns whether this allocation has provenance overlapping with the given range.
Note: this function exists to allow range_get_provenance
to be private, in order to somewhat
limit access to provenance outside of the Allocation
abstraction.
sourcepub fn provenances(&self) -> impl Iterator<Item = Prov> + '_
pub fn provenances(&self) -> impl Iterator<Item = Prov> + '_
Yields all the provenances stored in this map.
pub fn insert_ptr(&mut self, offset: Size, prov: Prov, cx: &impl HasDataLayout)
sourcepub fn clear(&mut self, range: AllocRange, cx: &impl HasDataLayout) -> AllocResult
pub fn clear(&mut self, range: AllocRange, cx: &impl HasDataLayout) -> AllocResult
Removes all provenance inside the given range. If there is provenance overlapping with the edges, might result in an error.
source§impl<Prov: Provenance> ProvenanceMap<Prov>
impl<Prov: Provenance> ProvenanceMap<Prov>
pub fn prepare_copy(
&self,
src: AllocRange,
dest: Size,
count: u64,
cx: &impl HasDataLayout
) -> AllocResult<ProvenanceCopy<Prov>>
sourcepub fn apply_copy(&mut self, copy: ProvenanceCopy<Prov>)
pub fn apply_copy(&mut self, copy: ProvenanceCopy<Prov>)
Applies a provenance copy.
The affected range, as defined in the parameters to prepare_copy
is expected
to be clear of provenance.
Trait Implementations§
source§impl<Prov: Clone> Clone for ProvenanceMap<Prov>
impl<Prov: Clone> Clone for ProvenanceMap<Prov>
source§fn clone(&self) -> ProvenanceMap<Prov>
fn clone(&self) -> ProvenanceMap<Prov>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl<Prov: Debug> Debug for ProvenanceMap<Prov>
impl<Prov: Debug> Debug for ProvenanceMap<Prov>
source§impl<D: Decoder, Prov: Provenance + Decodable<D>> Decodable<D> for ProvenanceMap<Prov>
impl<D: Decoder, Prov: Provenance + Decodable<D>> Decodable<D> for ProvenanceMap<Prov>
source§impl<S: Encoder, Prov: Provenance + Encodable<S>> Encodable<S> for ProvenanceMap<Prov>
impl<S: Encoder, Prov: Provenance + Encodable<S>> Encodable<S> for ProvenanceMap<Prov>
source§impl<Prov: Hash> Hash for ProvenanceMap<Prov>
impl<Prov: Hash> Hash for ProvenanceMap<Prov>
source§impl<'__ctx, Prov> HashStable<StableHashingContext<'__ctx>> for ProvenanceMap<Prov>where
Prov: HashStable<StableHashingContext<'__ctx>>,
impl<'__ctx, Prov> HashStable<StableHashingContext<'__ctx>> for ProvenanceMap<Prov>where
Prov: HashStable<StableHashingContext<'__ctx>>,
fn hash_stable(
&self,
__hcx: &mut StableHashingContext<'__ctx>,
__hasher: &mut StableHasher
)
source§impl<Prov: PartialEq> PartialEq<ProvenanceMap<Prov>> for ProvenanceMap<Prov>
impl<Prov: PartialEq> PartialEq<ProvenanceMap<Prov>> for ProvenanceMap<Prov>
source§fn eq(&self, other: &ProvenanceMap<Prov>) -> bool
fn eq(&self, other: &ProvenanceMap<Prov>) -> bool
impl<Prov: Eq> Eq for ProvenanceMap<Prov>
impl<Prov> StructuralEq for ProvenanceMap<Prov>
impl<Prov> StructuralPartialEq for ProvenanceMap<Prov>
Auto Trait Implementations§
impl<Prov> RefUnwindSafe for ProvenanceMap<Prov>where
Prov: RefUnwindSafe,
impl<Prov> Send for ProvenanceMap<Prov>where
Prov: Send,
impl<Prov> Sync for ProvenanceMap<Prov>where
Prov: Sync,
impl<Prov> Unpin for ProvenanceMap<Prov>where
Prov: Unpin,
impl<Prov> UnwindSafe for ProvenanceMap<Prov>where
Prov: UnwindSafe,
Blanket Implementations§
source§impl<Tcx, T> DepNodeParams<Tcx> for Twhere
Tcx: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
impl<Tcx, T> DepNodeParams<Tcx> for Twhere
Tcx: DepContext,
T: for<'a> HashStable<StableHashingContext<'a>> + Debug,
default fn fingerprint_style() -> FingerprintStyle
source§default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_debug_str(&self, _: Tcx) -> String
source§default fn recover(
_: Tcx,
_: &DepNode<<Tcx as DepContext>::DepKind>
) -> Option<T>
default fn recover(
_: Tcx,
_: &DepNode<<Tcx as DepContext>::DepKind>
) -> Option<T>
DepNode
,
something which is needed when forcing DepNode
s during red-green
evaluation. The query system will only call this method if
fingerprint_style()
is not FingerprintStyle::Opaque
.
It is always valid to return None
here, in which case incremental
compilation will treat the query as having changed instead of forcing it. Read moresource§impl<T, R> InternIteratorElement<T, R> for T
impl<T, R> InternIteratorElement<T, R> for T
type Output = R
fn intern_with<I, F>(iter: I, f: F) -> <T as InternIteratorElement<T, R>>::Outputwhere
I: Iterator<Item = T>,
F: FnOnce(&[T]) -> R,
source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
source§impl<'tcx, T> ToPredicate<'tcx, T> for T
impl<'tcx, T> ToPredicate<'tcx, T> for T
fn to_predicate(self, _tcx: TyCtxt<'tcx>) -> T
source§impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
impl<Tcx, T> Value<Tcx> for Twhere
Tcx: DepContext,
default fn from_cycle_error(tcx: Tcx, _: &[QueryInfo]) -> T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 32 bytes