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>
pub fn new() -> Self
Sourcepub fn from_presorted_ptrs(r: Vec<(Size, Prov)>) -> Self
pub fn from_presorted_ptrs(r: Vec<(Size, Prov)>) -> Self
The caller must guarantee that the given provenance list is already sorted by address and contain no duplicates.
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>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<Tcx, T> DepNodeParams<Tcx> for T
impl<Tcx, T> DepNodeParams<Tcx> for T
default fn fingerprint_style() -> FingerprintStyle
§default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_fingerprint(&self, tcx: Tcx) -> Fingerprint
default fn to_debug_str(&self, _: Tcx) -> String
§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<T> Pointable for T
impl<T> Pointable for T
§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>,
§impl<I, T> UpcastFrom<I, T> for T
impl<I, T> UpcastFrom<I, T> for T
fn upcast_from(from: T, _tcx: I) -> T
§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