pub struct ProvenanceMap<Prov = CtfeProvenance> {
ptrs: SortedMap<Size, Prov>,
bytes: Option<Box<SortedMap<Size, (Prov, u8)>>>,
}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 entries in this map are always at least a pointer size apart.
bytes: Option<Box<SortedMap<Size, (Prov, u8)>>>This stores byte-sized provenance fragments.
The u8 indicates the position of this byte inside its original pointer.
If the bytes are re-assembled in their original order, the pointer can be used again.
Wildcard provenance is allowed to have index 0 everywhere.
Implementations§
Source§impl<Prov> ProvenanceMap<Prov>
impl<Prov> ProvenanceMap<Prov>
Source§impl ProvenanceMap
impl ProvenanceMap
Sourcepub fn ptrs(&self) -> &SortedMap<Size, CtfeProvenance>
pub fn ptrs(&self) -> &SortedMap<Size, CtfeProvenance>
Give access to the ptr-sized provenances (which can also be thought of as relocations, and indeed that is how codegen treats them).
Only use on interned allocations, as other allocations may have per-byte provenance!
Source§impl<Prov: Provenance> ProvenanceMap<Prov>
impl<Prov: Provenance> ProvenanceMap<Prov>
fn adjusted_range_ptrs( range: AllocRange, cx: &impl HasDataLayout, ) -> Range<Size>
Sourcepub(super) fn range_ptrs_get(
&self,
range: AllocRange,
cx: &impl HasDataLayout,
) -> &[(Size, Prov)]
pub(super) fn range_ptrs_get( &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_ptrs_is_empty(
&self,
range: AllocRange,
cx: &impl HasDataLayout,
) -> bool
fn range_ptrs_is_empty( &self, range: AllocRange, cx: &impl HasDataLayout, ) -> bool
pm.range_ptrs_is_empty(r, cx) == pm.range_ptrs_get(r, cx).is_empty(), but is faster.
Sourcefn range_bytes_get(&self, range: AllocRange) -> &[(Size, (Prov, u8))]
fn range_bytes_get(&self, range: AllocRange) -> &[(Size, (Prov, u8))]
Returns all byte-wise provenance in the given range.
Sourcefn range_bytes_is_empty(&self, range: AllocRange) -> bool
fn range_bytes_is_empty(&self, range: AllocRange) -> bool
Same as range_bytes_get(range).is_empty(), but faster.
Sourcepub fn get_byte(
&self,
offset: Size,
cx: &impl HasDataLayout,
) -> Option<(Prov, u8)>
pub fn get_byte( &self, offset: Size, cx: &impl HasDataLayout, ) -> Option<(Prov, u8)>
Get the provenance of a single byte.
Sourcepub fn get_range(
&self,
cx: &impl HasDataLayout,
range: AllocRange,
) -> impl Iterator<Item = Prov>
pub fn get_range( &self, cx: &impl HasDataLayout, range: AllocRange, ) -> impl Iterator<Item = Prov>
Gets the provenances of all bytes (including from pointers) in a range.
Sourcepub fn merge_bytes(&mut self, cx: &impl HasDataLayout) -> bool
pub fn merge_bytes(&mut self, cx: &impl HasDataLayout) -> bool
Attempt to merge per-byte provenance back into ptr chunks, if the right fragments
sit next to each other. Return false is that is not possible due to partial pointers.
Sourcepub fn get_ptr(&self, offset: Size) -> Option<Prov>
pub fn get_ptr(&self, offset: Size) -> Option<Prov>
Check if there 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)
pub fn clear(&mut self, range: AllocRange, cx: &impl HasDataLayout)
Removes all provenance inside the given range. If there is provenance overlapping with the edges, might result in an error.
Sourcepub fn write_wildcards(&mut self, cx: &impl HasDataLayout, range: AllocRange)
pub fn write_wildcards(&mut self, cx: &impl HasDataLayout, range: AllocRange)
Overwrites all provenance in the given range with wildcard provenance. Pointers partially overwritten will have their provenances preserved bytewise on their remaining bytes.
Provided for usage in Miri and panics otherwise.
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 for ProvenanceMap<Prov>
impl<Prov: PartialEq> PartialEq for ProvenanceMap<Prov>
impl<Prov: Eq> Eq for ProvenanceMap<Prov>
impl<Prov> StructuralPartialEq for ProvenanceMap<Prov>
Auto Trait Implementations§
impl<Prov> DynSend for ProvenanceMap<Prov>where
Prov: DynSend,
impl<Prov> DynSync for ProvenanceMap<Prov>where
Prov: DynSync,
impl<Prov> Freeze for ProvenanceMap<Prov>
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<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
Source§impl<Tcx, T> DepNodeParams<Tcx> for T
impl<Tcx, T> DepNodeParams<Tcx> for T
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: Tcx) -> String
Source§default fn recover(_: Tcx, _: &DepNode) -> Option<T>
default fn recover(_: Tcx, _: &DepNode) -> Option<T>
DepNode,
something which is needed when forcing DepNodes 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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<P> IntoQueryParam<P> for P
impl<P> IntoQueryParam<P> for P
fn into_query_param(self) -> P
Source§impl<T> MaybeResult<T> for T
impl<T> MaybeResult<T> for T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
impl<I, T, U> Upcast<I, U> for Twhere
U: UpcastFrom<I, T>,
Source§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> 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, cycle_error: &CycleError, _guar: ErrorGuaranteed, ) -> T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
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