pub struct ProvenanceMap<Prov = CtfeProvenance> {
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 entries 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
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 exposed with CtfeProvenance
provenance, since it panics if there is bytewise provenance.
source§impl<Prov: Provenance> ProvenanceMap<Prov>
impl<Prov: Provenance> ProvenanceMap<Prov>
sourcepub(super) fn range_get_ptrs(
&self,
range: AllocRange,
cx: &impl HasDataLayout,
) -> &[(Size, Prov)]
pub(super) 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 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> 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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) -> String
source§default fn recover(_: Tcx, _: &DepNode) -> Option<T>
default fn recover(_: Tcx, _: &DepNode) -> 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.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§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> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
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<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<'a, T> Captures<'a> for Twhere
T: ?Sized,
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for 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