Expand description
This module contains some shared code for encoding and decoding various
things from the ty module, and in particular implements support for
“shorthands” which allow to have pointers back into the already encoded
stream instead of re-encoding the same thing twice.
The functionality in here is shared between persisting to crate metadata and persisting to incr. comp. caches.
Re-exports§
use std::hash::Hash;🔒use std::hash::Hash;🔒use std::intrinsics;🔒Experimental use std::marker::DiscriminantKind;🔒Experimental use rustc_data_structures::fx::FxHashMap;🔒use rustc_serialize::Decodable;🔒use rustc_serialize::Encodable;🔒use rustc_span::SpanDecoder;🔒use rustc_span::SpanEncoder;🔒pub use self::ref_decodable::RefDecodable;use crate::infer::canonical::CanonicalVarKind;🔒use crate::infer::canonical::CanonicalVarKinds;🔒use crate::mir;🔒use crate::mir::interpret::AllocId;🔒use crate::mir::interpret::ConstAllocation;🔒use crate::mir::interpret::CtfeProvenance;🔒use crate::ty;🔒use crate::ty::AdtDef;🔒use crate::ty::GenericArgs;🔒use crate::ty::Ty;🔒use crate::ty::TyCtxt;🔒
Modules§
Macros§
- forward_
all_ decoder_ methods_ to - Declares implementations of all
Decodermethods, each of which forwards to a method of the same name on some underlying decoder, typically a field of typeMemDecoder.
Constants§
- SHORTHAND_
OFFSET - The shorthand encoding uses an enum’s variant index
usizeand is offset by this value so it never matches a real variant. This offset is also chosen so that the first byte is never < 0x80.
Traits§
Functions§
- encode_
with_ shorthand - Encode the given value or a previously cached shorthand.