Skip to main content

DedupHashEncoder

Struct DedupHashEncoder 

Source
pub(crate) struct DedupHashEncoder(pub(crate) StableHasher);
Expand description

Hasher used to determine if two diagnostics are the same and should be deduplicated. Used by DiagCtxtInner::emitted_diagnostics. It’s a stable hash with one special behaviour: parents of spans within the diagnostics are ignored so that incremental and non-incremental compilation get the same behaviour.

Although this has nothing to do with encoding data to/from file, it is implemented on top of Encoder/SpanEncoder because they provide traversals of all the relevant types used within diagnostics. There is no corresponding decoder.

Tuple Fields§

§0: StableHasher

Trait Implementations§

Source§

impl Encoder for DedupHashEncoder

Source§

fn emit_usize(&mut self, value: usize)

Source§

fn emit_u128(&mut self, value: u128)

Source§

fn emit_u64(&mut self, value: u64)

Source§

fn emit_u32(&mut self, value: u32)

Source§

fn emit_u16(&mut self, value: u16)

Source§

fn emit_u8(&mut self, value: u8)

Source§

fn emit_isize(&mut self, value: isize)

Source§

fn emit_i128(&mut self, value: i128)

Source§

fn emit_i64(&mut self, value: i64)

Source§

fn emit_i32(&mut self, value: i32)

Source§

fn emit_i16(&mut self, value: i16)

Source§

fn emit_raw_bytes(&mut self, value: &[u8])

Source§

fn emit_i8(&mut self, v: i8)

Source§

fn emit_bool(&mut self, v: bool)

Source§

fn emit_char(&mut self, v: char)

Source§

fn emit_str(&mut self, v: &str)

Source§

fn emit_byte_str(&mut self, v: &[u8])

Source§

impl SpanEncoder for DedupHashEncoder

Source§

fn encode_span(&mut self, span: Span)

Source§

fn encode_symbol(&mut self, value: Symbol)

Source§

fn encode_byte_symbol(&mut self, value: ByteSymbol)

Source§

fn encode_expn_id(&mut self, value: ExpnId)

Source§

fn encode_syntax_context(&mut self, value: SyntaxContext)

Source§

fn encode_crate_num(&mut self, value: CrateNum)

As a local identifier, a CrateNum is only meaningful within its context, e.g. within a tcx. Therefore, make sure to include the context when encode a CrateNum.
Source§

fn encode_def_index(&mut self, value: DefIndex)

Source§

fn encode_def_id(&mut self, value: DefId)

Source§

fn encode_local_def_id(&mut self, def_id: LocalDefId)

Source§

fn encode_def_key( &mut self, parent: Option<DefIndex>, disambiguated_data: impl Encodable<Self>, )
where Self: Sized,

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Aligned for T

Source§

const ALIGN: Alignment

Alignment of Self.
Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more

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: 120 bytes