pub struct MaybeRelSourceLoc(/* private fields */);Expand description
A source location that is either a RelSourceLoc or SourceLoc.
This is used to represent a source location in the MachBuffer
that is initially relative to some base and is later relocated. We
do this to permit better code caching during incremental
compilation: the MachBuffer records the first SourceLoc it is
given as a base, and if the same function IR is later compiled but
with a different starting SourceLoc, we can reuse the cached
compilation result and just relocate (offset) the SourceLocs.
This relocation is an in-place update pass, so we want a “union”
type, essentially, but we don’t want to pay the overhead of a true
enum (8 bytes rather than 4 in a large array), so we bitpack
this representation.
Implementations§
Source§impl MaybeRelSourceLoc
impl MaybeRelSourceLoc
Sourcepub fn rel(loc: RelSourceLoc) -> Self
pub fn rel(loc: RelSourceLoc) -> Self
Create a relative SourceLoc.
Sourcepub fn as_rel(&self) -> RelSourceLoc
pub fn as_rel(&self) -> RelSourceLoc
Trait Implementations§
Source§impl Clone for MaybeRelSourceLoc
impl Clone for MaybeRelSourceLoc
Source§fn clone(&self) -> MaybeRelSourceLoc
fn clone(&self) -> MaybeRelSourceLoc
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for MaybeRelSourceLoc
Source§impl Debug for MaybeRelSourceLoc
impl Debug for MaybeRelSourceLoc
Source§impl<'de> Deserialize<'de> for MaybeRelSourceLoc
Available on crate feature enable-serde only.
impl<'de> Deserialize<'de> for MaybeRelSourceLoc
Available on crate feature
enable-serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for MaybeRelSourceLoc
Source§impl Hash for MaybeRelSourceLoc
impl Hash for MaybeRelSourceLoc
Source§impl PartialEq for MaybeRelSourceLoc
impl PartialEq for MaybeRelSourceLoc
Source§impl Serialize for MaybeRelSourceLoc
Available on crate feature enable-serde only.
impl Serialize for MaybeRelSourceLoc
Available on crate feature
enable-serde only.impl StructuralPartialEq for MaybeRelSourceLoc
Auto Trait Implementations§
impl Freeze for MaybeRelSourceLoc
impl RefUnwindSafe for MaybeRelSourceLoc
impl Send for MaybeRelSourceLoc
impl Sync for MaybeRelSourceLoc
impl Unpin for MaybeRelSourceLoc
impl UnsafeUnpin for MaybeRelSourceLoc
impl UnwindSafe for MaybeRelSourceLoc
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.