1use std::marker::PhantomData;
2use std::mem::size_of;
3use std::num::NonZero;
4use std::rc::Rc;
56use decoder::LazyDecoder;
7pub(crate) use decoder::{CrateMetadata, CrateNumMap, MetadataBlob, TargetModifiers};
8use def_path_hash_map::DefPathHashMapRef;
9use encoder::EncodeContext;
10pub use encoder::{EncodedMetadata, encode_metadata, rendered_const};
11pub(crate) use parameterized::ParameterizedOverTcx;
12use rustc_abi::{FieldIdx, ReprOptions, VariantIdx};
13use rustc_astas ast;
14use rustc_attr_ir::lang_items::LangItem;
15use rustc_attr_ir::{
16Attribute, ConstStability, DefaultBodyStability, Deprecation, Stability, StrippedCfgItem,
17};
18use rustc_crate_store::{CrateDepKind, ForeignModule, LinkagePreference, NativeLib};
19use rustc_data_structures::fingerprint::Fingerprint;
20use rustc_data_structures::fx::FxHashMap;
21use rustc_data_structures::svh::Svh;
22use rustc_hiras hir;
23use rustc_hir::PreciseCapturingArgKind;
24use rustc_hir::def::{CtorKind, DefKind, MacroKinds};
25use rustc_hir::def_id::{
26CRATE_DEF_INDEX, CrateNum, DefId, DefIdMap, DefIndex, DefPathHash, LOCAL_CRATE, LocalDefId,
27StableCrateId,
28};
29use rustc_hir::definitions::DefKey;
30use rustc_index::bit_set::DenseBitSet;
31use rustc_index::{Idx, IndexVec};
32use rustc_macros::{
33BlobDecodable, Decodable, Encodable, LazyDecodable, MetadataEncodable, TyDecodable, TyEncodable,
34};
35use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrs;
36use rustc_middle::middle::debugger_visualizer::DebuggerVisualizerFile;
37use rustc_middle::middle::deduced_param_attrs::DeducedParamAttrs;
38use rustc_middle::middle::exported_symbols::{ExportedSymbol, SymbolExportInfo};
39use rustc_middle::middle::lib_features::FeatureStability;
40use rustc_middle::middle::resolve::{AmbigModChild, DocLinkResMap, ModChild};
41use rustc_middle::middle::resolve_bound_vars::ObjectLifetimeDefault;
42use rustc_middle::mir;
43use rustc_middle::mir::ConstValue;
44use rustc_middle::ty::fast_reject::SimplifiedType;
45use rustc_middle::ty::{self, Ty, TyCtxt};
46use rustc_middle::util::Providers;
47use rustc_serialize::opaque::FileEncoder;
48use rustc_session::config::mitigation_coverage::DeniedPartialMitigation;
49use rustc_session::config::{SymbolManglingVersion, TargetModifier};
50use rustc_span::edition::Edition;
51use rustc_span::hygiene::{DecodedSyntaxContext, ExpnIndex, MacroKind, SyntaxContextKey};
52use rustc_span::{self, ExpnData, ExpnHash, ExpnId, Ident, Span, Symbol};
53use rustc_target::spec::{PanicStrategy, TargetTuple};
54use table::TableBuilder;
5556use crate::eii::EiiMapEncodedKeyValue;
57use crate::rmeta::parameterized::EncodeFrom;
58use crate::rmeta::remapped_def_id::RemappedRawDefId;
5960mod decoder;
61mod def_path_hash_map;
62mod encoder;
63mod parameterized;
64mod table;
6566pub(crate) fn rustc_version(cfg_version: &'static str) -> String {
67::alloc::__export::must_use({
::alloc::fmt::format(format_args!("rustc {0}", cfg_version))
})format!("rustc {cfg_version}")68}
6970/// Metadata encoding version.
71/// N.B., increment this if you change the format of metadata such that
72/// the rustc version can't be found to compare with `rustc_version()`.
73const METADATA_VERSION: u8 = 11;
7475/// Metadata header which includes `METADATA_VERSION`.
76///
77/// This header is followed by the `CrateRoot` and `CrateRootUnhashed` positions
78/// which represent the hashed and unhashed metadata contents respectively, the
79/// crate hash (SVH), and the rustc version string. See the offset constants
80/// below for the exact layout.
81pub const METADATA_HEADER: &[u8] = &[b'r', b'u', b's', b't', 0, 0, 0, METADATA_VERSION];
8283/// Fixed-size fields encoded immediately after `METADATA_HEADER`, in order:
84/// `CrateRoot` position (u64), `CrateRootUnhashed` position (u64), crate hash
85/// (`Fingerprint`/SVH), then the variable-length rustc version string.
86const ROOT_POS_OFFSET: usize = METADATA_HEADER.len();
87const ROOT_POS_LEN: usize = size_of::<u64>();
88const UNHASHED_POS_OFFSET: usize = ROOT_POS_OFFSET + ROOT_POS_LEN;
89const UNHASHED_POS_LEN: usize = size_of::<u64>();
90const CRATE_HASH_OFFSET: usize = UNHASHED_POS_OFFSET + UNHASHED_POS_LEN;
91const CRATE_HASH_LEN: usize = size_of::<Fingerprint>();
92const VERSION_OFFSET: usize = CRATE_HASH_OFFSET + CRATE_HASH_LEN;
9394/// A value of type T referred to by its absolute position
95/// in the metadata, and which can be decoded lazily.
96///
97/// Metadata is effective a tree, encoded in post-order,
98/// and with the root's position written next to the header.
99/// That means every single `LazyValue` points to some previous
100/// location in the metadata and is part of a larger node.
101///
102/// The first `LazyValue` in a node is encoded as the backwards
103/// distance from the position where the containing node
104/// starts and where the `LazyValue` points to, while the rest
105/// use the forward distance from the previous `LazyValue`.
106/// Distances start at 1, as 0-byte nodes are invalid.
107/// Also invalid are nodes being referred in a different
108/// order than they were encoded in.
109#[must_use]
110struct LazyValue<T> {
111 position: NonZero<usize>,
112 _marker: PhantomData<fn() -> T>,
113}
114115impl<T> LazyValue<T> {
116fn from_position(position: NonZero<usize>) -> LazyValue<T> {
117LazyValue { position, _marker: PhantomData }
118 }
119}
120121/// A list of lazily-decoded values.
122///
123/// Unlike `LazyValue<Vec<T>>`, the length is encoded next to the
124/// position, not at the position, which means that the length
125/// doesn't need to be known before encoding all the elements.
126///
127/// If the length is 0, no position is encoded, but otherwise,
128/// the encoding is that of `LazyArray`, with the distinction that
129/// the minimal distance the length of the sequence, i.e.
130/// it's assumed there's no 0-byte element in the sequence.
131struct LazyArray<T> {
132 position: NonZero<usize>,
133 num_elems: usize,
134 _marker: PhantomData<fn() -> T>,
135}
136137impl<T> Defaultfor LazyArray<T> {
138fn default() -> LazyArray<T> {
139LazyArray::from_position_and_num_elems(NonZero::new(1).unwrap(), 0)
140 }
141}
142143impl<T> LazyArray<T> {
144fn from_position_and_num_elems(position: NonZero<usize>, num_elems: usize) -> LazyArray<T> {
145LazyArray { position, num_elems, _marker: PhantomData }
146 }
147}
148149/// A list of lazily-decoded values, with the added capability of random access.
150///
151/// Random-access table (i.e. offering constant-time `get`/`set`), similar to
152/// `LazyArray<T>`, but without requiring encoding or decoding all the values
153/// eagerly and in-order.
154///
155/// `IdxEncode` - is a type of index that is used to write to the table,
156/// `IdxDecode` - is a type of index that is used to read from the table.
157struct LazyTable<IdxEncode, IdxDecode, T> {
158 position: NonZero<usize>,
159/// The encoded size of the elements of a table is selected at runtime to drop
160 /// trailing zeroes. This is the number of bytes used for each table element.
161width: usize,
162/// How many elements are in the table.
163len: usize,
164 _marker: PhantomData<fn(IdxEncode, IdxDecode) -> T>,
165}
166167impl<Ie, Id, T> LazyTable<Ie, Id, T> {
168fn from_position_and_encoded_size(
169 position: NonZero<usize>,
170 width: usize,
171 len: usize,
172 ) -> LazyTable<Ie, Id, T> {
173LazyTable { position, width, len, _marker: PhantomData }
174 }
175}
176177impl<T> Copyfor LazyValue<T> {}
178impl<T> Clonefor LazyValue<T> {
179fn clone(&self) -> Self {
180*self181 }
182}
183184impl<T> Copyfor LazyArray<T> {}
185impl<T> Clonefor LazyArray<T> {
186fn clone(&self) -> Self {
187*self188 }
189}
190191impl<Ie, Id, T> Copyfor LazyTable<Ie, Id, T> {}
192impl<Ie, Id, T> Clonefor LazyTable<Ie, Id, T> {
193fn clone(&self) -> Self {
194*self195 }
196}
197198/// Encoding / decoding state for `Lazy`s (`LazyValue`, `LazyArray`, and `LazyTable`).
199#[derive(#[automatically_derived]impl ::core::marker::Copy for LazyState { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for LazyState {
}
#[automatically_derived]impl ::core::clone::Clone for LazyState {
#[inline]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<NonZero<usize>>;
let _: ::core::clone::AssertParamIsClone<NonZero<usize>>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for LazyState
{
}
#[automatically_derived]impl ::core::cmp::PartialEq for LazyState {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other) &&
match (self, other) {
(Self::NodeStart(__self_0), Self::NodeStart(__arg1_0)) =>
__self_0 == __arg1_0,
(Self::Previous(__self_0), Self::Previous(__arg1_0)) =>
__self_0 == __arg1_0,
_ => true,
}
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for LazyState {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<NonZero<usize>>;
let _: ::core::cmp::AssertParamIsEq<NonZero<usize>>;
}
}Eq, #[automatically_derived]impl ::core::fmt::Debug for LazyState {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
match self {
Self::NoNode => ::core::fmt::Formatter::write_str(f, "NoNode"),
Self::NodeStart(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"NodeStart", &__self_0),
Self::Previous(__self_0) =>
::core::fmt::Formatter::debug_tuple_field1_finish(f,
"Previous", &__self_0),
}
}
}Debug)]
200enum LazyState {
201/// Outside of a metadata node.
202NoNode,
203204/// Inside a metadata node, and before any `Lazy`s.
205 /// The position is that of the node itself.
206NodeStart(NonZero<usize>),
207208/// Inside a metadata node, with a previous `Lazy`s.
209 /// The position is where that previous `Lazy` would start.
210Previous(NonZero<usize>),
211}
212213type SyntaxContextTable =
214LazyTable<RemappedSyntaxContext, DecodedSyntaxContext, Option<LazyValue<SyntaxContextKey>>>;
215type ExpnDataTable = LazyTable<RemappedLocalExpnIndex, ExpnIndex, Option<LazyValue<ExpnData>>>;
216type ExpnHashTable = LazyTable<RemappedLocalExpnIndex, ExpnIndex, Option<LazyValue<ExpnHash>>>;
217218#[derive(const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
ProcMacroData {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let ProcMacroData {
proc_macro_decls_static: ref __binding_0,
stability: ref __binding_1,
macros: ref __binding_2,
proc_macro_quoted_spans: ref __binding_3 } = *self;
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_2, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_3, __encoder);
}
}
};MetadataEncodable, const _: () =
{
impl<__D: LazyDecoder> ::rustc_serialize::Decodable<__D> for
ProcMacroData {
fn decode(__decoder: &mut __D) -> Self {
ProcMacroData {
proc_macro_decls_static: ::rustc_serialize::Decodable::decode(__decoder),
stability: ::rustc_serialize::Decodable::decode(__decoder),
macros: ::rustc_serialize::Decodable::decode(__decoder),
proc_macro_quoted_spans: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};LazyDecodable)]
219pub(crate) struct ProcMacroData {
220 proc_macro_decls_static: LazyValue<LocalDefId>,
221 stability: Option<Stability>,
222 macros: LazyArray<(LocalDefId, LazyValue<ProcMacroKind>)>,
223 proc_macro_quoted_spans: LazyTable<usize, usize, Option<LazyValue<Span>>>,
224}
225226#[derive(const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
ProcMacroKind {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let disc =
match *self {
ProcMacroKind::CustomDerive {
trait_name: ref __binding_0, attributes: ref __binding_1 }
=> {
0usize
}
ProcMacroKind::Attr { name: ref __binding_0 } => { 1usize }
ProcMacroKind::Bang { name: ref __binding_0 } => { 2usize }
};
::rustc_serialize::Encoder::emit_u8(__encoder, disc as u8);
match *self {
ProcMacroKind::CustomDerive {
trait_name: ref __binding_0, attributes: ref __binding_1 }
=> {
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
}
ProcMacroKind::Attr { name: ref __binding_0 } => {
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
}
ProcMacroKind::Bang { name: ref __binding_0 } => {
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
}
}
}
}
};MetadataEncodable, const _: () =
{
impl<__D: LazyDecoder> ::rustc_serialize::Decodable<__D> for
ProcMacroKind {
fn decode(__decoder: &mut __D) -> Self {
match ::rustc_serialize::Decoder::read_u8(__decoder) as usize
{
0usize => {
ProcMacroKind::CustomDerive {
trait_name: ::rustc_serialize::Decodable::decode(__decoder),
attributes: ::rustc_serialize::Decodable::decode(__decoder),
}
}
1usize => {
ProcMacroKind::Attr {
name: ::rustc_serialize::Decodable::decode(__decoder),
}
}
2usize => {
ProcMacroKind::Bang {
name: ::rustc_serialize::Decodable::decode(__decoder),
}
}
n => {
::core::panicking::panic_fmt(format_args!("invalid enum variant tag while decoding `ProcMacroKind`, expected 0..3, actual {0}",
n));
}
}
}
}
};LazyDecodable)]
227pub enum ProcMacroKind {
228 CustomDerive { trait_name: String, attributes: Vec<String> },
229 Attr { name: String },
230 Bang { name: String },
231}
232233/// Serialized crate metadata.
234///
235/// This contains just enough information to determine if we should load the `CrateRoot` or not.
236/// Prefer [`CrateRoot`] whenever possible to avoid ICEs when using `omit-git-hash` locally.
237/// See #76720 for more details.
238///
239/// If you do modify this struct, also bump the [`METADATA_VERSION`] constant.
240#[derive(const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
CrateHeader {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let CrateHeader {
triple: ref __binding_0,
name: ref __binding_1,
is_proc_macro_crate: ref __binding_2,
is_stub: ref __binding_3 } = *self;
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_2, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_3, __encoder);
}
}
};MetadataEncodable, const _: () =
{
impl<__D: ::rustc_span::BlobDecoder> ::rustc_serialize::Decodable<__D>
for CrateHeader {
fn decode(__decoder: &mut __D) -> Self {
CrateHeader {
triple: ::rustc_serialize::Decodable::decode(__decoder),
name: ::rustc_serialize::Decodable::decode(__decoder),
is_proc_macro_crate: ::rustc_serialize::Decodable::decode(__decoder),
is_stub: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};BlobDecodable)]
241pub(crate) struct CrateHeader {
242pub(crate) triple: TargetTuple,
243pub(crate) name: Symbol,
244/// Whether this is the header for a proc-macro crate.
245 ///
246 /// This is separate from [`ProcMacroData`] to avoid having to update [`METADATA_VERSION`] every
247 /// time ProcMacroData changes.
248pub(crate) is_proc_macro_crate: bool,
249/// Whether this crate metadata section is just a stub.
250 /// Stubs do not contain the full metadata (it will be typically stored
251 /// in a separate rmeta file).
252 ///
253 /// This is used inside rlibs and dylibs when using `-Cembed-metadata=no`.
254pub(crate) is_stub: bool,
255}
256257/// Serialized `.rmeta` data for a crate.
258///
259/// When compiling a proc-macro crate, we encode many of
260/// the `LazyArray<T>` fields as `Lazy::empty()`. This serves two purposes:
261///
262/// 1. We avoid performing unnecessary work. Proc-macro crates can only
263/// export proc-macros functions, which are compiled into a shared library.
264/// As a result, a large amount of the information we normally store
265/// (e.g. optimized MIR) is unneeded by downstream crates.
266/// 2. We avoid serializing invalid `CrateNum`s. When we deserialize
267/// a proc-macro crate, we don't load any of its dependencies (since we
268/// just need to invoke a native function from the shared library).
269/// This means that any foreign `CrateNum`s that we serialize cannot be
270/// deserialized, since we will not know how to map them into the current
271/// compilation session. If we were to serialize a proc-macro crate like
272/// a normal crate, much of what we serialized would be unusable in addition
273/// to being unused.
274#[derive(const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
CrateRoot {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let CrateRoot {
header: ref __binding_0,
stable_crate_id: ref __binding_1,
required_panic_strategy: ref __binding_2,
panic_in_drop_strategy: ref __binding_3,
edition: ref __binding_4,
has_global_allocator: ref __binding_5,
has_alloc_error_handler: ref __binding_6,
has_panic_handler: ref __binding_7,
has_default_lib_allocator: ref __binding_8,
externally_implementable_items: ref __binding_9,
crate_deps: ref __binding_10,
dylib_dependency_formats: ref __binding_11,
lib_features: ref __binding_12,
stability_implications: ref __binding_13,
lang_items: ref __binding_14,
lang_items_missing: ref __binding_15,
stripped_cfg_items: ref __binding_16,
diagnostic_items: ref __binding_17,
canonical_symbols: ref __binding_18,
fake_doc_items: ref __binding_19,
native_libraries: ref __binding_20,
foreign_modules: ref __binding_21,
traits: ref __binding_22,
impls: ref __binding_23,
incoherent_impls: ref __binding_24,
interpret_alloc_index: ref __binding_25,
proc_macro_data: ref __binding_26,
tables: ref __binding_27,
debugger_visualizers: ref __binding_28,
exportable_items: ref __binding_29,
stable_order_of_exportable_impls: ref __binding_30,
exported_non_generic_symbols: ref __binding_31,
exported_generic_symbols: ref __binding_32,
syntax_contexts: ref __binding_33,
expn_data: ref __binding_34,
expn_hashes: ref __binding_35,
def_path_hash_map: ref __binding_36,
source_map: ref __binding_37,
target_modifiers: ref __binding_38,
denied_partial_mitigations: ref __binding_39,
compiler_builtins: ref __binding_40,
needs_allocator: ref __binding_41,
needs_panic_runtime: ref __binding_42,
no_builtins: ref __binding_43,
panic_runtime: ref __binding_44,
profiler_runtime: ref __binding_45,
symbol_mangling_version: ref __binding_46,
specialization_enabled_in: ref __binding_47 } = *self;
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_2, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_3, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_4, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_5, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_6, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_7, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_8, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_9, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_10, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_11, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_12, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_13, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_14, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_15, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_16, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_17, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_18, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_19, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_20, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_21, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_22, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_23, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_24, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_25, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_26, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_27, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_28, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_29, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_30, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_31, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_32, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_33, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_34, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_35, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_36, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_37, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_38, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_39, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_40, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_41, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_42, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_43, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_44, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_45, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_46, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_47, __encoder);
}
}
};MetadataEncodable, const _: () =
{
impl<__D: LazyDecoder> ::rustc_serialize::Decodable<__D> for CrateRoot
{
fn decode(__decoder: &mut __D) -> Self {
CrateRoot {
header: ::rustc_serialize::Decodable::decode(__decoder),
stable_crate_id: ::rustc_serialize::Decodable::decode(__decoder),
required_panic_strategy: ::rustc_serialize::Decodable::decode(__decoder),
panic_in_drop_strategy: ::rustc_serialize::Decodable::decode(__decoder),
edition: ::rustc_serialize::Decodable::decode(__decoder),
has_global_allocator: ::rustc_serialize::Decodable::decode(__decoder),
has_alloc_error_handler: ::rustc_serialize::Decodable::decode(__decoder),
has_panic_handler: ::rustc_serialize::Decodable::decode(__decoder),
has_default_lib_allocator: ::rustc_serialize::Decodable::decode(__decoder),
externally_implementable_items: ::rustc_serialize::Decodable::decode(__decoder),
crate_deps: ::rustc_serialize::Decodable::decode(__decoder),
dylib_dependency_formats: ::rustc_serialize::Decodable::decode(__decoder),
lib_features: ::rustc_serialize::Decodable::decode(__decoder),
stability_implications: ::rustc_serialize::Decodable::decode(__decoder),
lang_items: ::rustc_serialize::Decodable::decode(__decoder),
lang_items_missing: ::rustc_serialize::Decodable::decode(__decoder),
stripped_cfg_items: ::rustc_serialize::Decodable::decode(__decoder),
diagnostic_items: ::rustc_serialize::Decodable::decode(__decoder),
canonical_symbols: ::rustc_serialize::Decodable::decode(__decoder),
fake_doc_items: ::rustc_serialize::Decodable::decode(__decoder),
native_libraries: ::rustc_serialize::Decodable::decode(__decoder),
foreign_modules: ::rustc_serialize::Decodable::decode(__decoder),
traits: ::rustc_serialize::Decodable::decode(__decoder),
impls: ::rustc_serialize::Decodable::decode(__decoder),
incoherent_impls: ::rustc_serialize::Decodable::decode(__decoder),
interpret_alloc_index: ::rustc_serialize::Decodable::decode(__decoder),
proc_macro_data: ::rustc_serialize::Decodable::decode(__decoder),
tables: ::rustc_serialize::Decodable::decode(__decoder),
debugger_visualizers: ::rustc_serialize::Decodable::decode(__decoder),
exportable_items: ::rustc_serialize::Decodable::decode(__decoder),
stable_order_of_exportable_impls: ::rustc_serialize::Decodable::decode(__decoder),
exported_non_generic_symbols: ::rustc_serialize::Decodable::decode(__decoder),
exported_generic_symbols: ::rustc_serialize::Decodable::decode(__decoder),
syntax_contexts: ::rustc_serialize::Decodable::decode(__decoder),
expn_data: ::rustc_serialize::Decodable::decode(__decoder),
expn_hashes: ::rustc_serialize::Decodable::decode(__decoder),
def_path_hash_map: ::rustc_serialize::Decodable::decode(__decoder),
source_map: ::rustc_serialize::Decodable::decode(__decoder),
target_modifiers: ::rustc_serialize::Decodable::decode(__decoder),
denied_partial_mitigations: ::rustc_serialize::Decodable::decode(__decoder),
compiler_builtins: ::rustc_serialize::Decodable::decode(__decoder),
needs_allocator: ::rustc_serialize::Decodable::decode(__decoder),
needs_panic_runtime: ::rustc_serialize::Decodable::decode(__decoder),
no_builtins: ::rustc_serialize::Decodable::decode(__decoder),
panic_runtime: ::rustc_serialize::Decodable::decode(__decoder),
profiler_runtime: ::rustc_serialize::Decodable::decode(__decoder),
symbol_mangling_version: ::rustc_serialize::Decodable::decode(__decoder),
specialization_enabled_in: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};LazyDecodable)]
275pub(crate) struct CrateRoot {
276/// A header used to detect if this is the right crate to load.
277header: CrateHeader,
278279 stable_crate_id: StableCrateId,
280 required_panic_strategy: Option<PanicStrategy>,
281 panic_in_drop_strategy: PanicStrategy,
282 edition: Edition,
283 has_global_allocator: bool,
284 has_alloc_error_handler: bool,
285 has_panic_handler: bool,
286 has_default_lib_allocator: bool,
287 externally_implementable_items: LazyArray<EiiMapEncodedKeyValue>,
288289 crate_deps: LazyArray<CrateDep>,
290 dylib_dependency_formats: LazyArray<Option<LinkagePreference>>,
291 lib_features: LazyArray<(Symbol, FeatureStability)>,
292 stability_implications: LazyArray<(Symbol, Symbol)>,
293 lang_items: LazyArray<(LocalDefId, LangItem)>,
294 lang_items_missing: LazyArray<LangItem>,
295 stripped_cfg_items: LazyArray<StrippedCfgItem<LocalDefId>>,
296 diagnostic_items: LazyArray<(Symbol, LocalDefId)>,
297 canonical_symbols: LazyArray<(Symbol, LocalDefId)>,
298 fake_doc_items: LazyArray<LocalDefId>,
299 native_libraries: LazyArray<NativeLib>,
300 foreign_modules: LazyArray<ForeignModule>,
301 traits: LazyArray<LocalDefId>,
302 impls: LazyArray<TraitImpls>,
303 incoherent_impls: LazyArray<IncoherentImpls>,
304 interpret_alloc_index: LazyArray<u64>,
305 proc_macro_data: Option<ProcMacroData>,
306307 tables: LazyTables,
308 debugger_visualizers: LazyArray<DebuggerVisualizerFile>,
309310 exportable_items: LazyArray<LocalDefId>,
311 stable_order_of_exportable_impls: LazyArray<(LocalDefId, usize)>,
312 exported_non_generic_symbols: LazyArray<(ExportedSymbol<'static>, SymbolExportInfo)>,
313 exported_generic_symbols: LazyArray<(ExportedSymbol<'static>, SymbolExportInfo)>,
314315 syntax_contexts: SyntaxContextTable,
316 expn_data: ExpnDataTable,
317 expn_hashes: ExpnHashTable,
318319 def_path_hash_map: LazyValue<DefPathHashMapRef<'static>>,
320321 source_map: LazyTable<u32, u32, Option<LazyValue<rustc_span::SourceFile>>>,
322 target_modifiers: LazyArray<TargetModifier>,
323 denied_partial_mitigations: LazyArray<DeniedPartialMitigation>,
324325 compiler_builtins: bool,
326 needs_allocator: bool,
327 needs_panic_runtime: bool,
328 no_builtins: bool,
329 panic_runtime: bool,
330 profiler_runtime: bool,
331 symbol_mangling_version: SymbolManglingVersion,
332333 specialization_enabled_in: bool,
334}
335336/// A separate struct for extra metadata that must be encoded *after*
337/// the main crate hash is finalized.
338#[derive(const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
CrateRootUnhashed {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let CrateRootUnhashed {
extra_filename: ref __binding_0,
dep_extra_filenames: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
}
}
};MetadataEncodable, const _: () =
{
impl<__D: LazyDecoder> ::rustc_serialize::Decodable<__D> for
CrateRootUnhashed {
fn decode(__decoder: &mut __D) -> Self {
CrateRootUnhashed {
extra_filename: ::rustc_serialize::Decodable::decode(__decoder),
dep_extra_filenames: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};LazyDecodable)]
339pub(crate) struct CrateRootUnhashed {
340 extra_filename: String,
341342/// The `-C extra-filename` of each dependency, indexed by the `CrateNum` they had in *this*
343 /// crate's encoding. The `LOCAL_CRATE` slot is unused filler so that dependency `CrateNum`s
344 /// can index this directly; this crate's own value is `extra_filename` above.
345dep_extra_filenames: IndexVec<CrateNum, String>,
346}
347348#[automatically_derived]impl ::core::marker::Copy for RemappedSyntaxContext {
}
impl RemappedSyntaxContext {
#[doc = r" Maximum value the index can take, as a `u32`."]
pub(super) const MAX_AS_U32: u32 = 0x1FFF_FFFF;
#[doc = r" Maximum value the index can take."]
pub(super) const MAX: Self = Self::from_u32(0x1FFF_FFFF);
#[doc = r" Zero value of the index."]
pub(super) const ZERO: Self = Self::from_u32(0);
#[doc = r" Creates a new index from a given `usize`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub(super) const fn from_usize(value: usize) -> Self {
if !(value <= (0x1FFF_FFFF as usize)) {
::core::panicking::panic("assertion failed: value <= (0x1FFF_FFFF as usize)")
};
unsafe { Self::from_u32_unchecked(value as u32) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub(super) const fn from_u32(value: u32) -> Self {
if !(value <= 0x1FFF_FFFF) {
::core::panicking::panic("assertion failed: value <= 0x1FFF_FFFF")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u16`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub(super) const fn from_u16(value: u16) -> Self {
let value = value as u32;
if !(value <= 0x1FFF_FFFF) {
::core::panicking::panic("assertion failed: value <= 0x1FFF_FFFF")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc =
r" The provided value must be less than or equal to the maximum value for the newtype."]
#[doc =
r" Providing a value outside this range is undefined due to layout restrictions."]
#[doc = r""]
#[doc = r" Prefer using `from_u32`."]
#[inline]
pub(super) const unsafe fn from_u32_unchecked(value: u32) -> Self {
Self {
private_use_as_methods_instead: unsafe {
std::mem::transmute(value)
},
}
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub(super) const fn index(self) -> usize { self.as_usize() }
#[doc = r" Extracts the value of this index as a `u32`."]
#[inline]
pub(super) const fn as_u32(self) -> u32 {
unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub(super) const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for RemappedSyntaxContext {
type Output = Self;
#[inline]
fn add(self, other: usize) -> Self {
Self::from_usize(self.index() + other)
}
}
impl std::ops::AddAssign<usize> for RemappedSyntaxContext {
#[inline]
fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for RemappedSyntaxContext {
#[inline]
fn new(value: usize) -> Self { Self::from_usize(value) }
#[inline]
fn index(self) -> usize { self.as_usize() }
}
impl std::default::Default for RemappedSyntaxContext {
#[inline]
fn default() -> Self { Self::ZERO }
}
impl From<RemappedSyntaxContext> for u32 {
#[inline]
fn from(v: RemappedSyntaxContext) -> u32 { v.as_u32() }
}
impl From<RemappedSyntaxContext> for usize {
#[inline]
fn from(v: RemappedSyntaxContext) -> usize { v.as_usize() }
}
impl From<usize> for RemappedSyntaxContext {
#[inline]
fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for RemappedSyntaxContext {
#[inline]
fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for RemappedSyntaxContext {}
impl ::std::cmp::PartialEq for RemappedSyntaxContext {
fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for RemappedSyntaxContext {}
impl ::std::hash::Hash for RemappedSyntaxContext {
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
self.as_u32().hash(state)
}
}
impl ::std::fmt::Debug for RemappedSyntaxContext {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("{0}", self.as_u32()))
}
}rustc_index::newtype_index! {
349#[max = 0x1FFF_FFFF] // `u32::MAX` >> 3, as `SyntaxContext` should be fit in 29 bits (see `span_encoding`).
350#[default]
351pub(super) struct RemappedSyntaxContext {}
352}353354#[automatically_derived]impl ::core::marker::Copy for RemappedLocalExpnIndex {
}
impl RemappedLocalExpnIndex {
#[doc = r" Maximum value the index can take, as a `u32`."]
pub(super) const MAX_AS_U32: u32 = 0xFFFF_FF00;
#[doc = r" Maximum value the index can take."]
pub(super) const MAX: Self = Self::from_u32(0xFFFF_FF00);
#[doc = r" Zero value of the index."]
pub(super) const ZERO: Self = Self::from_u32(0);
#[doc = r" Creates a new index from a given `usize`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub(super) const fn from_usize(value: usize) -> Self {
if !(value <= (0xFFFF_FF00 as usize)) {
::core::panicking::panic("assertion failed: value <= (0xFFFF_FF00 as usize)")
};
unsafe { Self::from_u32_unchecked(value as u32) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub(super) const fn from_u32(value: u32) -> Self {
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u16`."]
#[doc = r""]
#[doc = r" # Panics"]
#[doc = r""]
#[doc = r" Will panic if `value` exceeds `MAX`."]
#[inline]
pub(super) const fn from_u16(value: u16) -> Self {
let value = value as u32;
if !(value <= 0xFFFF_FF00) {
::core::panicking::panic("assertion failed: value <= 0xFFFF_FF00")
};
unsafe { Self::from_u32_unchecked(value) }
}
#[doc = r" Creates a new index from a given `u32`."]
#[doc = r""]
#[doc = r" # Safety"]
#[doc = r""]
#[doc =
r" The provided value must be less than or equal to the maximum value for the newtype."]
#[doc =
r" Providing a value outside this range is undefined due to layout restrictions."]
#[doc = r""]
#[doc = r" Prefer using `from_u32`."]
#[inline]
pub(super) const unsafe fn from_u32_unchecked(value: u32) -> Self {
Self {
private_use_as_methods_instead: unsafe {
std::mem::transmute(value)
},
}
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub(super) const fn index(self) -> usize { self.as_usize() }
#[doc = r" Extracts the value of this index as a `u32`."]
#[inline]
pub(super) const fn as_u32(self) -> u32 {
unsafe { std::mem::transmute(self.private_use_as_methods_instead) }
}
#[doc = r" Extracts the value of this index as a `usize`."]
#[inline]
pub(super) const fn as_usize(self) -> usize { self.as_u32() as usize }
}
impl std::ops::Add<usize> for RemappedLocalExpnIndex {
type Output = Self;
#[inline]
fn add(self, other: usize) -> Self {
Self::from_usize(self.index() + other)
}
}
impl std::ops::AddAssign<usize> for RemappedLocalExpnIndex {
#[inline]
fn add_assign(&mut self, other: usize) { *self = *self + other; }
}
impl rustc_index::Idx for RemappedLocalExpnIndex {
#[inline]
fn new(value: usize) -> Self { Self::from_usize(value) }
#[inline]
fn index(self) -> usize { self.as_usize() }
}
impl std::default::Default for RemappedLocalExpnIndex {
#[inline]
fn default() -> Self { Self::ZERO }
}
impl From<RemappedLocalExpnIndex> for u32 {
#[inline]
fn from(v: RemappedLocalExpnIndex) -> u32 { v.as_u32() }
}
impl From<RemappedLocalExpnIndex> for usize {
#[inline]
fn from(v: RemappedLocalExpnIndex) -> usize { v.as_usize() }
}
impl From<usize> for RemappedLocalExpnIndex {
#[inline]
fn from(value: usize) -> Self { Self::from_usize(value) }
}
impl From<u32> for RemappedLocalExpnIndex {
#[inline]
fn from(value: u32) -> Self { Self::from_u32(value) }
}
impl ::std::cmp::Eq for RemappedLocalExpnIndex {}
impl ::std::cmp::PartialEq for RemappedLocalExpnIndex {
fn eq(&self, other: &Self) -> bool { self.as_u32().eq(&other.as_u32()) }
}
impl ::std::marker::StructuralPartialEq for RemappedLocalExpnIndex {}
impl ::std::hash::Hash for RemappedLocalExpnIndex {
fn hash<H: ::std::hash::Hasher>(&self, state: &mut H) {
self.as_u32().hash(state)
}
}
impl ::std::fmt::Debug for RemappedLocalExpnIndex {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
fmt.write_fmt(format_args!("{0}", self.as_u32()))
}
}rustc_index::newtype_index! {
355#[default]
356pub(super) struct RemappedLocalExpnIndex {}
357}358359#[derive(#[automatically_derived]impl ::core::default::Default for LocalDefsRemapping {
#[inline]
fn default() -> Self {
LocalDefsRemapping {
first_non_det_index: ::core::default::Default::default(),
remapping: ::core::default::Default::default(),
sorted_non_det_ids: ::core::default::Default::default(),
}
}
}Default)]
360pub(crate) struct LocalDefsRemapping {
361/// See `Definitions::first_non_det_index`, it is just cached version of it.
362pub first_non_det_index: u32,
363364/// The map where for each non-det local def id the remapped def index
365 /// is stored. It can be accessed by
366 /// `remapping[id.local_def_index - first_non_det_index]`, the caller should
367 /// ensure that `id.local_def_index >= first_non_det_index`.
368pub remapping: Vec<DefIndex>,
369370/// The ordered list of NON-remapped non-det local def ids. This
371 /// list is used when we need to iterate over all local defs in a
372 /// stable order.
373pub sorted_non_det_ids: Rc<[LocalDefId]>,
374}
375376#[derive(#[automatically_derived]impl ::core::fmt::Debug for RemappedLocalDefId {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::debug_struct_field1_finish(f,
"RemappedLocalDefId", "index", &&self.index)
}
}Debug, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
RemappedLocalDefId {
}
#[automatically_derived]impl ::core::cmp::PartialEq for RemappedLocalDefId {
#[inline]
fn eq(&self, other: &Self) -> bool { self.index == other.index }
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for RemappedLocalDefId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<DefIndex>;
}
}Eq, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for RemappedLocalDefId {
}
#[automatically_derived]impl ::core::clone::Clone for RemappedLocalDefId {
#[inline]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<DefIndex>;
*self
}
}Clone, #[automatically_derived]impl ::core::marker::Copy for RemappedLocalDefId { }Copy, #[automatically_derived]impl ::core::hash::Hash for RemappedLocalDefId {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.index, state)
}
}Hash)]
377pub(crate) struct RemappedLocalDefId {
378pub index: DefIndex,
379}
380381impl Idxfor RemappedLocalDefId {
382#[inline]
383fn new(idx: usize) -> Self {
384RemappedLocalDefId { index: DefIndex::from_usize(idx) }
385 }
386387#[inline]
388fn index(self) -> usize {
389self.index.as_usize()
390 }
391}
392393impl LocalDefsRemapping {
394/// This method should be used whenever the `LocalDefId` is encoded, as it remaps
395 /// it's `local_def_index` for deterministic metadata encoding, this
396 /// remapping needs to be applied to all `LocalDefId`s during metadata encoding.
397 /// Note that when implementing custom structs that represent `LocalDefId` the
398 /// remapping should also be applied (see `RawDefId`).
399#[inline]
400fn map_local_def_id(&self, local_def_id: LocalDefId) -> RemappedLocalDefId {
401RemappedLocalDefId { index: self.map_index(local_def_id.local_def_index) }
402 }
403404/// Remaps `DefId` only if it local for deterministic metadata encoding. External
405 /// def ids are not needed to be remapped as they are already deterministic.
406 /// Whenever a `DefId` is encoded this method should be called.
407 /// Note that when implementing custom structs that represent `DefId` the
408 /// remapping should also be applied (see `RawDefId`).
409#[inline]
410fn map_def_id(&self, def_id: DefId) -> DefId {
411if def_id.is_local() {
412DefId { krate: LOCAL_CRATE, index: self.map_index(def_id.index) }
413 } else {
414def_id415 }
416 }
417418/// Shared part of `map_local_def_id` and `map_def_id` which remaps a def index.
419 /// Given only def index we do not know whether it belongs to local or external
420 /// def id, so this method should not be called on `DefIndex`es whose origin is unknown.
421 /// Prefer to use above-mentioned methods instead or use it when it is clear that
422 /// `DefIndex` is local.
423#[inline]
424fn map_index(&self, def_index: DefIndex) -> DefIndex {
425let index = def_index.as_u32();
426427if index < self.first_non_det_index {
428def_index429 } else {
430let shifted_idx = index - self.first_non_det_index;
431self.remapping[shifted_idxas usize]
432 }
433 }
434435fn iter_sorted_local_ids(&self) -> impl Iterator<Item = LocalDefId> + use<> {
436let first_non_det_index = self.first_non_det_index;
437let non_det_part = Rc::clone(&self.sorted_non_det_ids);
438439gen move {
440for i in 0..first_non_det_index {
441yield LocalDefId { local_def_index: DefIndex::from_u32(i) }
442 }
443444let len = non_det_part.len();
445for i in 0..len {
446yield non_det_part[i]
447 }
448 }
449 }
450451fn new(tcx: TyCtxt<'_>) -> LocalDefsRemapping {
452let defs = tcx.definitions();
453454let mut non_det_ids = ::alloc::vec::Vec::new()vec![];
455let start = defs.first_non_det_index().as_usize();
456let num_defs = defs.num_definitions();
457458for idx in start..num_defs {
459let def_id_level = |mut id| {
460let mut level = 0;
461while let Some(parent) = tcx.opt_local_parent(id) {
462 level += 1;
463 id = parent;
464 }
465466 level
467 };
468469let def_id = LocalDefId { local_def_index: idx.into() };
470 non_det_ids.push((
471 def_id,
472 def_id_level(def_id),
473 defs.def_path_hash(def_id).local_hash(),
474 ));
475 }
476477// Sort by level first in order to satisfy the invariant that child def id
478 // always has a higher def index than its parent (see `def_id_partial_cmp`),
479 // in context of one level sort by stable hash. Ids from higher level will
480 // get higher remapped def index.
481non_det_ids.sort_by_key(|(_, level, hash)| (*level, *hash));
482483let mut remapping = ::alloc::vec::from_elem(CRATE_DEF_INDEX, non_det_ids.len())vec![CRATE_DEF_INDEX; non_det_ids.len()];
484for (idx, (id, ..)) in non_det_ids.into_iter().enumerate() {
485 remapping[id.local_def_index.as_usize() - start] = DefIndex::from_usize(start + idx);
486 }
487488let mut sorted_non_det_ids = (start..num_defs)
489 .into_iter()
490 .map(|idx| LocalDefId { local_def_index: DefIndex::from(idx) })
491 .collect::<Vec<_>>();
492493sorted_non_det_ids.sort_by_key(|id| remapping[id.local_def_index.as_usize() - start]);
494495let sorted_non_det_ids = Rc::from(sorted_non_det_ids);
496LocalDefsRemapping { first_non_det_index: startas u32, remapping, sorted_non_det_ids }
497 }
498}
499500pub(crate) mod remapped_def_id {
501use super::*;
502503/// On-disk representation of `DefId`.
504 /// This creates a type-safe way to enforce that we remap the CrateNum between the on-disk
505 /// representation and the compilation session.
506#[derive(#[automatically_derived]impl ::core::marker::Copy for RemappedRawDefId { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for RemappedRawDefId {
}
#[automatically_derived]impl ::core::clone::Clone for RemappedRawDefId {
#[inline]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<u32>;
*self
}
}Clone, #[automatically_derived]impl ::core::hash::Hash for RemappedRawDefId {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.krate, state);
::core::hash::Hash::hash(&self.index, state)
}
}Hash, #[automatically_derived]impl ::core::marker::StructuralPartialEq for
RemappedRawDefId {
}
#[automatically_derived]impl ::core::cmp::PartialEq for RemappedRawDefId {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.krate == other.krate && self.index == other.index
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for RemappedRawDefId {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<u32>;
}
}Eq, const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for RemappedRawDefId {
fn encode(&self, __encoder: &mut __E) {
let RemappedRawDefId {
krate: ref __binding_0, index: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::BlobDecoder> ::rustc_serialize::Decodable<__D>
for RemappedRawDefId {
fn decode(__decoder: &mut __D) -> Self {
RemappedRawDefId {
krate: ::rustc_serialize::Decodable::decode(__decoder),
index: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};BlobDecodable)]
507pub(crate) struct RemappedRawDefId {
508 krate: u32,
509 index: u32,
510 }
511512impl RemappedRawDefId {
513pub(crate) fn new_unchecked(krate: u32, index: u32) -> RemappedRawDefId {
514RemappedRawDefId { krate, index }
515 }
516517pub(crate) fn create(def_id: DefId, remapping: &LocalDefsRemapping) -> RemappedRawDefId {
518let def_id = remapping.map_def_id(def_id);
519RemappedRawDefId { krate: def_id.krate.as_u32(), index: def_id.index.as_u32() }
520 }
521522/// This exists so that `provide_one!` is happy
523pub(crate) fn decode(self, meta: (&CrateMetadata, TyCtxt<'_>)) -> DefId {
524let krate = CrateNum::from_u32(self.krate);
525let krate = meta.0.map_encoded_cnum_to_current(krate);
526DefId { krate, index: DefIndex::from_u32(self.index) }
527 }
528529pub(crate) fn decompose(&self) -> (u32, u32) {
530 (self.krate, self.index)
531 }
532 }
533}
534535/// A dependency record, as stored in the hashed [`CrateRoot`].
536///
537/// Note the absence of the dependency's `-C extra-filename`: it lives in
538/// [`CrateRootUnhashed::dep_extra_filenames`] instead, deliberately outside the hash.
539#[derive(const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for CrateDep {
fn encode(&self, __encoder: &mut __E) {
let CrateDep {
name: ref __binding_0,
hash: ref __binding_1,
host_hash: ref __binding_2,
kind: ref __binding_3,
is_private: ref __binding_4 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_4,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::BlobDecoder> ::rustc_serialize::Decodable<__D>
for CrateDep {
fn decode(__decoder: &mut __D) -> Self {
CrateDep {
name: ::rustc_serialize::Decodable::decode(__decoder),
hash: ::rustc_serialize::Decodable::decode(__decoder),
host_hash: ::rustc_serialize::Decodable::decode(__decoder),
kind: ::rustc_serialize::Decodable::decode(__decoder),
is_private: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};BlobDecodable)]
540pub(crate) struct CrateDep {
541pub name: Symbol,
542pub hash: Svh,
543pub host_hash: Option<Svh>,
544pub kind: CrateDepKind,
545pub is_private: bool,
546}
547548#[derive(const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
TraitImpls {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let TraitImpls {
trait_id: ref __binding_0, impls: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
}
}
};MetadataEncodable, const _: () =
{
impl<__D: LazyDecoder> ::rustc_serialize::Decodable<__D> for
TraitImpls {
fn decode(__decoder: &mut __D) -> Self {
TraitImpls {
trait_id: ::rustc_serialize::Decodable::decode(__decoder),
impls: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};LazyDecodable)]
549pub(crate) struct TraitImpls {
550 trait_id: RemappedRawDefId,
551 impls: LazyArray<(LocalDefId, Option<SimplifiedType>)>,
552}
553554#[derive(const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
IncoherentImpls {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let IncoherentImpls {
self_ty: ref __binding_0, impls: ref __binding_1 } = *self;
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
}
}
};MetadataEncodable, const _: () =
{
impl<__D: LazyDecoder> ::rustc_serialize::Decodable<__D> for
IncoherentImpls {
fn decode(__decoder: &mut __D) -> Self {
IncoherentImpls {
self_ty: ::rustc_serialize::Decodable::decode(__decoder),
impls: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};LazyDecodable)]
555pub(crate) struct IncoherentImpls {
556 self_ty: LazyValue<SimplifiedType>,
557 impls: LazyArray<LocalDefId>,
558}
559560/// Define `LazyTables` and `TableBuilders` at the same time.
561macro_rules!define_tables {
562 (
563 - defaulted: $($name1:ident: Table<$T1:ty>,)+
564 - optional: $($name2:ident: Table<$T2:ty>,)+
565 ) => {
566#[derive(MetadataEncodable, LazyDecodable)]
567pub(crate) struct LazyTables {
568 $($name1: LazyTable<RemappedLocalDefId, DefIndex, $T1>,)+
569 $($name2: LazyTable<RemappedLocalDefId, DefIndex, Option<$T2>>,)+
570 }
571572#[derive(Default)]
573struct TableBuilders {
574 $($name1: TableBuilder<RemappedLocalDefId, DefIndex, $T1>,)+
575 $($name2: TableBuilder<RemappedLocalDefId, DefIndex, Option<$T2>>,)+
576 }
577578impl TableBuilders {
579fn encode(&self, buf: &mut FileEncoder<'_>) -> LazyTables {
580 LazyTables {
581 $($name1: self.$name1.encode(buf),)+
582 $($name2: self.$name2.encode(buf),)+
583 }
584 }
585 }
586587impl<'a, 'tcx, 'b> TableWriter<'a, 'tcx, 'b> {
588 $(
589/// Records a value into the corresponding `TableBuilders` field, encoding it in
590 /// the process when necessary
591fn $name1<T>(&mut self, i: LocalDefId, v: T)
592where
593$T1: EncodeFrom<'tcx, T>
594 {
595let encoded = <$T1 as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
596let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
597self.encoder.tables.$name1.set(idx, encoded);
598 }
599 )+
600 $(
601/// Records a value into the corresponding `TableBuilders` field, encoding it in
602 /// the process when necessary
603fn $name2<T>(&mut self, i: LocalDefId, v: T)
604where
605$T2: EncodeFrom<'tcx, T>
606 {
607let encoded = <$T2 as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
608let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
609self.encoder.tables.$name2.set(idx, Some(encoded));
610 }
611 )+
612 }
613 }
614}
615616/// Helper struct for writing values into [`TableBuilders`].
617#[must_use]
618struct TableWriter<'a, 'tcx, 'b> {
619 encoder: &'b mut EncodeContext<'a, 'tcx>,
620}
621622pub(crate) struct LazyTables {
intrinsic: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::IntrinsicDef>>>,
is_macro_rules: LazyTable<RemappedLocalDefId, DefIndex, bool>,
type_alias_is_checked: LazyTable<RemappedLocalDefId, DefIndex, bool>,
attr_flags: LazyTable<RemappedLocalDefId, DefIndex, AttrFlags>,
def_path_hashes: LazyTable<RemappedLocalDefId, DefIndex, u64>,
explicit_item_bounds: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_item_self_bounds: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
inferred_outlives_of: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_super_clauses_of: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_implied_clauses_of: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_implied_const_bounds: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<(ty::PolyTraitRef<'static>, Span)>>,
inherent_impls: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<LocalDefId>>,
module_children_reexports: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<ModChild>>,
ambig_module_children: LazyTable<RemappedLocalDefId, DefIndex,
LazyArray<AmbigModChild>>,
cross_crate_inlinable: LazyTable<RemappedLocalDefId, DefIndex, bool>,
asyncness: LazyTable<RemappedLocalDefId, DefIndex, ty::Asyncness>,
constness: LazyTable<RemappedLocalDefId, DefIndex, hir::Constness>,
safety: LazyTable<RemappedLocalDefId, DefIndex, hir::Safety>,
defaultness: LazyTable<RemappedLocalDefId, DefIndex, hir::Defaultness>,
impl_is_fully_generic_for_reflection: LazyTable<RemappedLocalDefId,
DefIndex, bool>,
opt_rpitit_info: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::ImplTraitInTraitData>>>,
attributes: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<Attribute>>>,
module_children_non_reexports: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<LocalDefId>>>,
associated_item_or_field_def_ids: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<LocalDefId>>>,
def_kind: LazyTable<RemappedLocalDefId, DefIndex, Option<DefKind>>,
visibility: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::Visibility<LocalDefId>>>>,
def_span: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<Span>>>,
def_ident_span: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<Span>>>,
lookup_stability: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<Stability>>>,
lookup_const_stability: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ConstStability>>>,
lookup_default_body_stability: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<DefaultBodyStability>>>,
lookup_deprecation_entry: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<Deprecation>>>,
explicit_clauses_of: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::GenericClauses<'static>>>>,
generics_of: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::Generics>>>,
type_of: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static, Ty<'static>>>>>,
variances_of: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<ty::Variance>>>,
fn_sig: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static, ty::PolyFnSig<'static>>>>>,
codegen_fn_attrs: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<CodegenFnAttrs>>>,
impl_trait_header: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::ImplTraitHeader<'static>>>>,
const_param_default: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static,
rustc_middle::ty::Const<'static>>>>>,
object_lifetime_default: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ObjectLifetimeDefault>>>,
optimized_mir: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::Body<'static>>>>,
mir_for_ctfe: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::Body<'static>>>>,
trivial_const: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<(ConstValue, Ty<'static>)>>>,
closure_saved_names_of_captured_variables: LazyTable<RemappedLocalDefId,
DefIndex, Option<LazyValue<IndexVec<FieldIdx, Symbol>>>>,
mir_coroutine_witnesses: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::CoroutineLayout<'static>>>>,
promoted_mir: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>>,
thir_abstract_const: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static, ty::Const<'static>>>>>,
impl_parent: LazyTable<RemappedLocalDefId, DefIndex,
Option<RemappedRawDefId>>,
const_conditions: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::ConstConditions<'static>>>>,
coerce_unsized_info: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::adjustment::CoerceUnsizedInfo>>>,
mir_const_qualif: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::ConstQualifs>>>,
rendered_const: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<String>>>,
rendered_precise_capturing_args: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<PreciseCapturingArgKind<Symbol, Symbol>>>>,
fn_arg_idents: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<Option<Ident>>>>,
coroutine_kind: LazyTable<RemappedLocalDefId, DefIndex,
Option<hir::CoroutineKind>>,
coroutine_for_closure: LazyTable<RemappedLocalDefId, DefIndex,
Option<RemappedRawDefId>>,
adt_destructor: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::Destructor>>>,
adt_async_destructor: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::AsyncDestructor>>>,
coroutine_by_move_body_def_id: LazyTable<RemappedLocalDefId, DefIndex,
Option<RemappedRawDefId>>,
eval_static_initializer: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::interpret::ConstAllocation<'static>>>>,
trait_def: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::TraitDef>>>,
expn_that_defined: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ExpnId>>>,
default_fields: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<DefId>>>,
params_in_repr: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<DenseBitSet<u32>>>>,
repr_options: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ReprOptions>>>,
def_keys: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<DefKey>>>,
variant_data: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<VariantData>>>,
assoc_container: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::AssocContainer>>>,
macro_definition: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ast::DelimArgs>>>,
deduced_param_attrs: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<DeducedParamAttrs>>>,
collect_return_position_impl_trait_in_trait_tys: LazyTable<RemappedLocalDefId,
DefIndex,
Option<LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>>>>,
doc_link_resolutions: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<DocLinkResMap>>>,
doc_link_traits_in_scope: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<DefId>>>,
assumed_wf_types_for_rpitit: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyArray<(Ty<'static>, Span)>>>,
opaque_ty_origin: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<hir::OpaqueTyOrigin<DefId>>>>,
anon_const_kind: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::AnonConstKind>>>,
const_of_item: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<Option<ty::EarlyBinder<'static, ty::Const<'static>>>>>>,
associated_types_for_impl_traits_in_trait_or_impl: LazyTable<RemappedLocalDefId,
DefIndex, Option<LazyValue<DefIdMap<Vec<DefId>>>>>,
args_known_to_outlive_alias_params: LazyTable<RemappedLocalDefId,
DefIndex, Option<LazyValue<Vec<(usize, DenseBitSet<u32>)>>>>,
mut_restriction: LazyTable<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::RestrictionKind>>>,
}
const _: () =
{
impl<'tcx, '__a>
::rustc_serialize::Encodable<EncodeContext<'__a, 'tcx>> for
LazyTables {
fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) {
#![allow(unreachable_code)]
let LazyTables {
intrinsic: ref __binding_0,
is_macro_rules: ref __binding_1,
type_alias_is_checked: ref __binding_2,
attr_flags: ref __binding_3,
def_path_hashes: ref __binding_4,
explicit_item_bounds: ref __binding_5,
explicit_item_self_bounds: ref __binding_6,
inferred_outlives_of: ref __binding_7,
explicit_super_clauses_of: ref __binding_8,
explicit_implied_clauses_of: ref __binding_9,
explicit_implied_const_bounds: ref __binding_10,
inherent_impls: ref __binding_11,
module_children_reexports: ref __binding_12,
ambig_module_children: ref __binding_13,
cross_crate_inlinable: ref __binding_14,
asyncness: ref __binding_15,
constness: ref __binding_16,
safety: ref __binding_17,
defaultness: ref __binding_18,
impl_is_fully_generic_for_reflection: ref __binding_19,
opt_rpitit_info: ref __binding_20,
attributes: ref __binding_21,
module_children_non_reexports: ref __binding_22,
associated_item_or_field_def_ids: ref __binding_23,
def_kind: ref __binding_24,
visibility: ref __binding_25,
def_span: ref __binding_26,
def_ident_span: ref __binding_27,
lookup_stability: ref __binding_28,
lookup_const_stability: ref __binding_29,
lookup_default_body_stability: ref __binding_30,
lookup_deprecation_entry: ref __binding_31,
explicit_clauses_of: ref __binding_32,
generics_of: ref __binding_33,
type_of: ref __binding_34,
variances_of: ref __binding_35,
fn_sig: ref __binding_36,
codegen_fn_attrs: ref __binding_37,
impl_trait_header: ref __binding_38,
const_param_default: ref __binding_39,
object_lifetime_default: ref __binding_40,
optimized_mir: ref __binding_41,
mir_for_ctfe: ref __binding_42,
trivial_const: ref __binding_43,
closure_saved_names_of_captured_variables: ref __binding_44,
mir_coroutine_witnesses: ref __binding_45,
promoted_mir: ref __binding_46,
thir_abstract_const: ref __binding_47,
impl_parent: ref __binding_48,
const_conditions: ref __binding_49,
coerce_unsized_info: ref __binding_50,
mir_const_qualif: ref __binding_51,
rendered_const: ref __binding_52,
rendered_precise_capturing_args: ref __binding_53,
fn_arg_idents: ref __binding_54,
coroutine_kind: ref __binding_55,
coroutine_for_closure: ref __binding_56,
adt_destructor: ref __binding_57,
adt_async_destructor: ref __binding_58,
coroutine_by_move_body_def_id: ref __binding_59,
eval_static_initializer: ref __binding_60,
trait_def: ref __binding_61,
expn_that_defined: ref __binding_62,
default_fields: ref __binding_63,
params_in_repr: ref __binding_64,
repr_options: ref __binding_65,
def_keys: ref __binding_66,
variant_data: ref __binding_67,
assoc_container: ref __binding_68,
macro_definition: ref __binding_69,
deduced_param_attrs: ref __binding_70,
collect_return_position_impl_trait_in_trait_tys: ref __binding_71,
doc_link_resolutions: ref __binding_72,
doc_link_traits_in_scope: ref __binding_73,
assumed_wf_types_for_rpitit: ref __binding_74,
opaque_ty_origin: ref __binding_75,
anon_const_kind: ref __binding_76,
const_of_item: ref __binding_77,
associated_types_for_impl_traits_in_trait_or_impl: ref __binding_78,
args_known_to_outlive_alias_params: ref __binding_79,
mut_restriction: ref __binding_80 } = *self;
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_0, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_1, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_2, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_3, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_4, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_5, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_6, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_7, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_8, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_9, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_10, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_11, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_12, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_13, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_14, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_15, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_16, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_17, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_18, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_19, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_20, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_21, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_22, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_23, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_24, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_25, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_26, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_27, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_28, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_29, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_30, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_31, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_32, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_33, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_34, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_35, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_36, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_37, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_38, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_39, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_40, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_41, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_42, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_43, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_44, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_45, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_46, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_47, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_48, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_49, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_50, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_51, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_52, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_53, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_54, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_55, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_56, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_57, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_58, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_59, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_60, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_61, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_62, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_63, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_64, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_65, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_66, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_67, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_68, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_69, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_70, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_71, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_72, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_73, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_74, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_75, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_76, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_77, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_78, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_79, __encoder);
::rustc_serialize::Encodable::<EncodeContext<'__a,
'tcx>>::encode(__binding_80, __encoder);
}
}
};
const _: () =
{
impl<__D: LazyDecoder> ::rustc_serialize::Decodable<__D> for
LazyTables {
fn decode(__decoder: &mut __D) -> Self {
LazyTables {
intrinsic: ::rustc_serialize::Decodable::decode(__decoder),
is_macro_rules: ::rustc_serialize::Decodable::decode(__decoder),
type_alias_is_checked: ::rustc_serialize::Decodable::decode(__decoder),
attr_flags: ::rustc_serialize::Decodable::decode(__decoder),
def_path_hashes: ::rustc_serialize::Decodable::decode(__decoder),
explicit_item_bounds: ::rustc_serialize::Decodable::decode(__decoder),
explicit_item_self_bounds: ::rustc_serialize::Decodable::decode(__decoder),
inferred_outlives_of: ::rustc_serialize::Decodable::decode(__decoder),
explicit_super_clauses_of: ::rustc_serialize::Decodable::decode(__decoder),
explicit_implied_clauses_of: ::rustc_serialize::Decodable::decode(__decoder),
explicit_implied_const_bounds: ::rustc_serialize::Decodable::decode(__decoder),
inherent_impls: ::rustc_serialize::Decodable::decode(__decoder),
module_children_reexports: ::rustc_serialize::Decodable::decode(__decoder),
ambig_module_children: ::rustc_serialize::Decodable::decode(__decoder),
cross_crate_inlinable: ::rustc_serialize::Decodable::decode(__decoder),
asyncness: ::rustc_serialize::Decodable::decode(__decoder),
constness: ::rustc_serialize::Decodable::decode(__decoder),
safety: ::rustc_serialize::Decodable::decode(__decoder),
defaultness: ::rustc_serialize::Decodable::decode(__decoder),
impl_is_fully_generic_for_reflection: ::rustc_serialize::Decodable::decode(__decoder),
opt_rpitit_info: ::rustc_serialize::Decodable::decode(__decoder),
attributes: ::rustc_serialize::Decodable::decode(__decoder),
module_children_non_reexports: ::rustc_serialize::Decodable::decode(__decoder),
associated_item_or_field_def_ids: ::rustc_serialize::Decodable::decode(__decoder),
def_kind: ::rustc_serialize::Decodable::decode(__decoder),
visibility: ::rustc_serialize::Decodable::decode(__decoder),
def_span: ::rustc_serialize::Decodable::decode(__decoder),
def_ident_span: ::rustc_serialize::Decodable::decode(__decoder),
lookup_stability: ::rustc_serialize::Decodable::decode(__decoder),
lookup_const_stability: ::rustc_serialize::Decodable::decode(__decoder),
lookup_default_body_stability: ::rustc_serialize::Decodable::decode(__decoder),
lookup_deprecation_entry: ::rustc_serialize::Decodable::decode(__decoder),
explicit_clauses_of: ::rustc_serialize::Decodable::decode(__decoder),
generics_of: ::rustc_serialize::Decodable::decode(__decoder),
type_of: ::rustc_serialize::Decodable::decode(__decoder),
variances_of: ::rustc_serialize::Decodable::decode(__decoder),
fn_sig: ::rustc_serialize::Decodable::decode(__decoder),
codegen_fn_attrs: ::rustc_serialize::Decodable::decode(__decoder),
impl_trait_header: ::rustc_serialize::Decodable::decode(__decoder),
const_param_default: ::rustc_serialize::Decodable::decode(__decoder),
object_lifetime_default: ::rustc_serialize::Decodable::decode(__decoder),
optimized_mir: ::rustc_serialize::Decodable::decode(__decoder),
mir_for_ctfe: ::rustc_serialize::Decodable::decode(__decoder),
trivial_const: ::rustc_serialize::Decodable::decode(__decoder),
closure_saved_names_of_captured_variables: ::rustc_serialize::Decodable::decode(__decoder),
mir_coroutine_witnesses: ::rustc_serialize::Decodable::decode(__decoder),
promoted_mir: ::rustc_serialize::Decodable::decode(__decoder),
thir_abstract_const: ::rustc_serialize::Decodable::decode(__decoder),
impl_parent: ::rustc_serialize::Decodable::decode(__decoder),
const_conditions: ::rustc_serialize::Decodable::decode(__decoder),
coerce_unsized_info: ::rustc_serialize::Decodable::decode(__decoder),
mir_const_qualif: ::rustc_serialize::Decodable::decode(__decoder),
rendered_const: ::rustc_serialize::Decodable::decode(__decoder),
rendered_precise_capturing_args: ::rustc_serialize::Decodable::decode(__decoder),
fn_arg_idents: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_kind: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_for_closure: ::rustc_serialize::Decodable::decode(__decoder),
adt_destructor: ::rustc_serialize::Decodable::decode(__decoder),
adt_async_destructor: ::rustc_serialize::Decodable::decode(__decoder),
coroutine_by_move_body_def_id: ::rustc_serialize::Decodable::decode(__decoder),
eval_static_initializer: ::rustc_serialize::Decodable::decode(__decoder),
trait_def: ::rustc_serialize::Decodable::decode(__decoder),
expn_that_defined: ::rustc_serialize::Decodable::decode(__decoder),
default_fields: ::rustc_serialize::Decodable::decode(__decoder),
params_in_repr: ::rustc_serialize::Decodable::decode(__decoder),
repr_options: ::rustc_serialize::Decodable::decode(__decoder),
def_keys: ::rustc_serialize::Decodable::decode(__decoder),
variant_data: ::rustc_serialize::Decodable::decode(__decoder),
assoc_container: ::rustc_serialize::Decodable::decode(__decoder),
macro_definition: ::rustc_serialize::Decodable::decode(__decoder),
deduced_param_attrs: ::rustc_serialize::Decodable::decode(__decoder),
collect_return_position_impl_trait_in_trait_tys: ::rustc_serialize::Decodable::decode(__decoder),
doc_link_resolutions: ::rustc_serialize::Decodable::decode(__decoder),
doc_link_traits_in_scope: ::rustc_serialize::Decodable::decode(__decoder),
assumed_wf_types_for_rpitit: ::rustc_serialize::Decodable::decode(__decoder),
opaque_ty_origin: ::rustc_serialize::Decodable::decode(__decoder),
anon_const_kind: ::rustc_serialize::Decodable::decode(__decoder),
const_of_item: ::rustc_serialize::Decodable::decode(__decoder),
associated_types_for_impl_traits_in_trait_or_impl: ::rustc_serialize::Decodable::decode(__decoder),
args_known_to_outlive_alias_params: ::rustc_serialize::Decodable::decode(__decoder),
mut_restriction: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};
struct TableBuilders {
intrinsic: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::IntrinsicDef>>>,
is_macro_rules: TableBuilder<RemappedLocalDefId, DefIndex, bool>,
type_alias_is_checked: TableBuilder<RemappedLocalDefId, DefIndex, bool>,
attr_flags: TableBuilder<RemappedLocalDefId, DefIndex, AttrFlags>,
def_path_hashes: TableBuilder<RemappedLocalDefId, DefIndex, u64>,
explicit_item_bounds: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_item_self_bounds: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
inferred_outlives_of: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_super_clauses_of: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_implied_clauses_of: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<(ty::Clause<'static>, Span)>>,
explicit_implied_const_bounds: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<(ty::PolyTraitRef<'static>, Span)>>,
inherent_impls: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<LocalDefId>>,
module_children_reexports: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<ModChild>>,
ambig_module_children: TableBuilder<RemappedLocalDefId, DefIndex,
LazyArray<AmbigModChild>>,
cross_crate_inlinable: TableBuilder<RemappedLocalDefId, DefIndex, bool>,
asyncness: TableBuilder<RemappedLocalDefId, DefIndex, ty::Asyncness>,
constness: TableBuilder<RemappedLocalDefId, DefIndex, hir::Constness>,
safety: TableBuilder<RemappedLocalDefId, DefIndex, hir::Safety>,
defaultness: TableBuilder<RemappedLocalDefId, DefIndex, hir::Defaultness>,
impl_is_fully_generic_for_reflection: TableBuilder<RemappedLocalDefId,
DefIndex, bool>,
opt_rpitit_info: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::ImplTraitInTraitData>>>,
attributes: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyArray<Attribute>>>,
module_children_non_reexports: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyArray<LocalDefId>>>,
associated_item_or_field_def_ids: TableBuilder<RemappedLocalDefId,
DefIndex, Option<LazyArray<LocalDefId>>>,
def_kind: TableBuilder<RemappedLocalDefId, DefIndex, Option<DefKind>>,
visibility: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::Visibility<LocalDefId>>>>,
def_span: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<Span>>>,
def_ident_span: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<Span>>>,
lookup_stability: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<Stability>>>,
lookup_const_stability: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ConstStability>>>,
lookup_default_body_stability: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<DefaultBodyStability>>>,
lookup_deprecation_entry: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<Deprecation>>>,
explicit_clauses_of: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::GenericClauses<'static>>>>,
generics_of: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::Generics>>>,
type_of: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static, Ty<'static>>>>>,
variances_of: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyArray<ty::Variance>>>,
fn_sig: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static, ty::PolyFnSig<'static>>>>>,
codegen_fn_attrs: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<CodegenFnAttrs>>>,
impl_trait_header: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::ImplTraitHeader<'static>>>>,
const_param_default: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static,
rustc_middle::ty::Const<'static>>>>>,
object_lifetime_default: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ObjectLifetimeDefault>>>,
optimized_mir: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::Body<'static>>>>,
mir_for_ctfe: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::Body<'static>>>>,
trivial_const: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<(ConstValue, Ty<'static>)>>>,
closure_saved_names_of_captured_variables: TableBuilder<RemappedLocalDefId,
DefIndex, Option<LazyValue<IndexVec<FieldIdx, Symbol>>>>,
mir_coroutine_witnesses: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::CoroutineLayout<'static>>>>,
promoted_mir: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>>,
thir_abstract_const: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::EarlyBinder<'static, ty::Const<'static>>>>>,
impl_parent: TableBuilder<RemappedLocalDefId, DefIndex,
Option<RemappedRawDefId>>,
const_conditions: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::ConstConditions<'static>>>>,
coerce_unsized_info: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::adjustment::CoerceUnsizedInfo>>>,
mir_const_qualif: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::ConstQualifs>>>,
rendered_const: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<String>>>,
rendered_precise_capturing_args: TableBuilder<RemappedLocalDefId,
DefIndex, Option<LazyArray<PreciseCapturingArgKind<Symbol, Symbol>>>>,
fn_arg_idents: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyArray<Option<Ident>>>>,
coroutine_kind: TableBuilder<RemappedLocalDefId, DefIndex,
Option<hir::CoroutineKind>>,
coroutine_for_closure: TableBuilder<RemappedLocalDefId, DefIndex,
Option<RemappedRawDefId>>,
adt_destructor: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::Destructor>>>,
adt_async_destructor: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::AsyncDestructor>>>,
coroutine_by_move_body_def_id: TableBuilder<RemappedLocalDefId, DefIndex,
Option<RemappedRawDefId>>,
eval_static_initializer: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<mir::interpret::ConstAllocation<'static>>>>,
trait_def: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::TraitDef>>>,
expn_that_defined: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ExpnId>>>,
default_fields: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<DefId>>>,
params_in_repr: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<DenseBitSet<u32>>>>,
repr_options: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ReprOptions>>>,
def_keys: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<DefKey>>>,
variant_data: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<VariantData>>>,
assoc_container: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::AssocContainer>>>,
macro_definition: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ast::DelimArgs>>>,
deduced_param_attrs: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyArray<DeducedParamAttrs>>>,
collect_return_position_impl_trait_in_trait_tys: TableBuilder<RemappedLocalDefId,
DefIndex,
Option<LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>>>>,
doc_link_resolutions: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<DocLinkResMap>>>,
doc_link_traits_in_scope: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyArray<DefId>>>,
assumed_wf_types_for_rpitit: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyArray<(Ty<'static>, Span)>>>,
opaque_ty_origin: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<hir::OpaqueTyOrigin<DefId>>>>,
anon_const_kind: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::AnonConstKind>>>,
const_of_item: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<Option<ty::EarlyBinder<'static, ty::Const<'static>>>>>>,
associated_types_for_impl_traits_in_trait_or_impl: TableBuilder<RemappedLocalDefId,
DefIndex, Option<LazyValue<DefIdMap<Vec<DefId>>>>>,
args_known_to_outlive_alias_params: TableBuilder<RemappedLocalDefId,
DefIndex, Option<LazyValue<Vec<(usize, DenseBitSet<u32>)>>>>,
mut_restriction: TableBuilder<RemappedLocalDefId, DefIndex,
Option<LazyValue<ty::RestrictionKind>>>,
}
#[automatically_derived]impl ::core::default::Default for TableBuilders {
#[inline]
fn default() -> Self {
TableBuilders {
intrinsic: ::core::default::Default::default(),
is_macro_rules: ::core::default::Default::default(),
type_alias_is_checked: ::core::default::Default::default(),
attr_flags: ::core::default::Default::default(),
def_path_hashes: ::core::default::Default::default(),
explicit_item_bounds: ::core::default::Default::default(),
explicit_item_self_bounds: ::core::default::Default::default(),
inferred_outlives_of: ::core::default::Default::default(),
explicit_super_clauses_of: ::core::default::Default::default(),
explicit_implied_clauses_of: ::core::default::Default::default(),
explicit_implied_const_bounds: ::core::default::Default::default(),
inherent_impls: ::core::default::Default::default(),
module_children_reexports: ::core::default::Default::default(),
ambig_module_children: ::core::default::Default::default(),
cross_crate_inlinable: ::core::default::Default::default(),
asyncness: ::core::default::Default::default(),
constness: ::core::default::Default::default(),
safety: ::core::default::Default::default(),
defaultness: ::core::default::Default::default(),
impl_is_fully_generic_for_reflection: ::core::default::Default::default(),
opt_rpitit_info: ::core::default::Default::default(),
attributes: ::core::default::Default::default(),
module_children_non_reexports: ::core::default::Default::default(),
associated_item_or_field_def_ids: ::core::default::Default::default(),
def_kind: ::core::default::Default::default(),
visibility: ::core::default::Default::default(),
def_span: ::core::default::Default::default(),
def_ident_span: ::core::default::Default::default(),
lookup_stability: ::core::default::Default::default(),
lookup_const_stability: ::core::default::Default::default(),
lookup_default_body_stability: ::core::default::Default::default(),
lookup_deprecation_entry: ::core::default::Default::default(),
explicit_clauses_of: ::core::default::Default::default(),
generics_of: ::core::default::Default::default(),
type_of: ::core::default::Default::default(),
variances_of: ::core::default::Default::default(),
fn_sig: ::core::default::Default::default(),
codegen_fn_attrs: ::core::default::Default::default(),
impl_trait_header: ::core::default::Default::default(),
const_param_default: ::core::default::Default::default(),
object_lifetime_default: ::core::default::Default::default(),
optimized_mir: ::core::default::Default::default(),
mir_for_ctfe: ::core::default::Default::default(),
trivial_const: ::core::default::Default::default(),
closure_saved_names_of_captured_variables: ::core::default::Default::default(),
mir_coroutine_witnesses: ::core::default::Default::default(),
promoted_mir: ::core::default::Default::default(),
thir_abstract_const: ::core::default::Default::default(),
impl_parent: ::core::default::Default::default(),
const_conditions: ::core::default::Default::default(),
coerce_unsized_info: ::core::default::Default::default(),
mir_const_qualif: ::core::default::Default::default(),
rendered_const: ::core::default::Default::default(),
rendered_precise_capturing_args: ::core::default::Default::default(),
fn_arg_idents: ::core::default::Default::default(),
coroutine_kind: ::core::default::Default::default(),
coroutine_for_closure: ::core::default::Default::default(),
adt_destructor: ::core::default::Default::default(),
adt_async_destructor: ::core::default::Default::default(),
coroutine_by_move_body_def_id: ::core::default::Default::default(),
eval_static_initializer: ::core::default::Default::default(),
trait_def: ::core::default::Default::default(),
expn_that_defined: ::core::default::Default::default(),
default_fields: ::core::default::Default::default(),
params_in_repr: ::core::default::Default::default(),
repr_options: ::core::default::Default::default(),
def_keys: ::core::default::Default::default(),
variant_data: ::core::default::Default::default(),
assoc_container: ::core::default::Default::default(),
macro_definition: ::core::default::Default::default(),
deduced_param_attrs: ::core::default::Default::default(),
collect_return_position_impl_trait_in_trait_tys: ::core::default::Default::default(),
doc_link_resolutions: ::core::default::Default::default(),
doc_link_traits_in_scope: ::core::default::Default::default(),
assumed_wf_types_for_rpitit: ::core::default::Default::default(),
opaque_ty_origin: ::core::default::Default::default(),
anon_const_kind: ::core::default::Default::default(),
const_of_item: ::core::default::Default::default(),
associated_types_for_impl_traits_in_trait_or_impl: ::core::default::Default::default(),
args_known_to_outlive_alias_params: ::core::default::Default::default(),
mut_restriction: ::core::default::Default::default(),
}
}
}
impl TableBuilders {
fn encode(&self, buf: &mut FileEncoder<'_>) -> LazyTables {
LazyTables {
intrinsic: self.intrinsic.encode(buf),
is_macro_rules: self.is_macro_rules.encode(buf),
type_alias_is_checked: self.type_alias_is_checked.encode(buf),
attr_flags: self.attr_flags.encode(buf),
def_path_hashes: self.def_path_hashes.encode(buf),
explicit_item_bounds: self.explicit_item_bounds.encode(buf),
explicit_item_self_bounds: self.explicit_item_self_bounds.encode(buf),
inferred_outlives_of: self.inferred_outlives_of.encode(buf),
explicit_super_clauses_of: self.explicit_super_clauses_of.encode(buf),
explicit_implied_clauses_of: self.explicit_implied_clauses_of.encode(buf),
explicit_implied_const_bounds: self.explicit_implied_const_bounds.encode(buf),
inherent_impls: self.inherent_impls.encode(buf),
module_children_reexports: self.module_children_reexports.encode(buf),
ambig_module_children: self.ambig_module_children.encode(buf),
cross_crate_inlinable: self.cross_crate_inlinable.encode(buf),
asyncness: self.asyncness.encode(buf),
constness: self.constness.encode(buf),
safety: self.safety.encode(buf),
defaultness: self.defaultness.encode(buf),
impl_is_fully_generic_for_reflection: self.impl_is_fully_generic_for_reflection.encode(buf),
opt_rpitit_info: self.opt_rpitit_info.encode(buf),
attributes: self.attributes.encode(buf),
module_children_non_reexports: self.module_children_non_reexports.encode(buf),
associated_item_or_field_def_ids: self.associated_item_or_field_def_ids.encode(buf),
def_kind: self.def_kind.encode(buf),
visibility: self.visibility.encode(buf),
def_span: self.def_span.encode(buf),
def_ident_span: self.def_ident_span.encode(buf),
lookup_stability: self.lookup_stability.encode(buf),
lookup_const_stability: self.lookup_const_stability.encode(buf),
lookup_default_body_stability: self.lookup_default_body_stability.encode(buf),
lookup_deprecation_entry: self.lookup_deprecation_entry.encode(buf),
explicit_clauses_of: self.explicit_clauses_of.encode(buf),
generics_of: self.generics_of.encode(buf),
type_of: self.type_of.encode(buf),
variances_of: self.variances_of.encode(buf),
fn_sig: self.fn_sig.encode(buf),
codegen_fn_attrs: self.codegen_fn_attrs.encode(buf),
impl_trait_header: self.impl_trait_header.encode(buf),
const_param_default: self.const_param_default.encode(buf),
object_lifetime_default: self.object_lifetime_default.encode(buf),
optimized_mir: self.optimized_mir.encode(buf),
mir_for_ctfe: self.mir_for_ctfe.encode(buf),
trivial_const: self.trivial_const.encode(buf),
closure_saved_names_of_captured_variables: self.closure_saved_names_of_captured_variables.encode(buf),
mir_coroutine_witnesses: self.mir_coroutine_witnesses.encode(buf),
promoted_mir: self.promoted_mir.encode(buf),
thir_abstract_const: self.thir_abstract_const.encode(buf),
impl_parent: self.impl_parent.encode(buf),
const_conditions: self.const_conditions.encode(buf),
coerce_unsized_info: self.coerce_unsized_info.encode(buf),
mir_const_qualif: self.mir_const_qualif.encode(buf),
rendered_const: self.rendered_const.encode(buf),
rendered_precise_capturing_args: self.rendered_precise_capturing_args.encode(buf),
fn_arg_idents: self.fn_arg_idents.encode(buf),
coroutine_kind: self.coroutine_kind.encode(buf),
coroutine_for_closure: self.coroutine_for_closure.encode(buf),
adt_destructor: self.adt_destructor.encode(buf),
adt_async_destructor: self.adt_async_destructor.encode(buf),
coroutine_by_move_body_def_id: self.coroutine_by_move_body_def_id.encode(buf),
eval_static_initializer: self.eval_static_initializer.encode(buf),
trait_def: self.trait_def.encode(buf),
expn_that_defined: self.expn_that_defined.encode(buf),
default_fields: self.default_fields.encode(buf),
params_in_repr: self.params_in_repr.encode(buf),
repr_options: self.repr_options.encode(buf),
def_keys: self.def_keys.encode(buf),
variant_data: self.variant_data.encode(buf),
assoc_container: self.assoc_container.encode(buf),
macro_definition: self.macro_definition.encode(buf),
deduced_param_attrs: self.deduced_param_attrs.encode(buf),
collect_return_position_impl_trait_in_trait_tys: self.collect_return_position_impl_trait_in_trait_tys.encode(buf),
doc_link_resolutions: self.doc_link_resolutions.encode(buf),
doc_link_traits_in_scope: self.doc_link_traits_in_scope.encode(buf),
assumed_wf_types_for_rpitit: self.assumed_wf_types_for_rpitit.encode(buf),
opaque_ty_origin: self.opaque_ty_origin.encode(buf),
anon_const_kind: self.anon_const_kind.encode(buf),
const_of_item: self.const_of_item.encode(buf),
associated_types_for_impl_traits_in_trait_or_impl: self.associated_types_for_impl_traits_in_trait_or_impl.encode(buf),
args_known_to_outlive_alias_params: self.args_known_to_outlive_alias_params.encode(buf),
mut_restriction: self.mut_restriction.encode(buf),
}
}
}
impl<'a, 'tcx, 'b> TableWriter<'a, 'tcx, 'b> {
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn intrinsic<T>(&mut self, i: LocalDefId, v: T) where
Option<LazyValue<ty::IntrinsicDef>>: EncodeFrom<'tcx, T> {
let encoded =
<Option<LazyValue<ty::IntrinsicDef>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.intrinsic.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn is_macro_rules<T>(&mut self, i: LocalDefId, v: T) where
bool: EncodeFrom<'tcx, T> {
let encoded =
<bool as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.is_macro_rules.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn type_alias_is_checked<T>(&mut self, i: LocalDefId, v: T) where
bool: EncodeFrom<'tcx, T> {
let encoded =
<bool as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.type_alias_is_checked.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn attr_flags<T>(&mut self, i: LocalDefId, v: T) where
AttrFlags: EncodeFrom<'tcx, T> {
let encoded =
<AttrFlags as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.attr_flags.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn def_path_hashes<T>(&mut self, i: LocalDefId, v: T) where
u64: EncodeFrom<'tcx, T> {
let encoded =
<u64 as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.def_path_hashes.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn explicit_item_bounds<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<(ty::Clause<'static>, Span)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<(ty::Clause<'static>, Span)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.explicit_item_bounds.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn explicit_item_self_bounds<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<(ty::Clause<'static>, Span)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<(ty::Clause<'static>, Span)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.explicit_item_self_bounds.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn inferred_outlives_of<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<(ty::Clause<'static>, Span)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<(ty::Clause<'static>, Span)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.inferred_outlives_of.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn explicit_super_clauses_of<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<(ty::Clause<'static>, Span)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<(ty::Clause<'static>, Span)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.explicit_super_clauses_of.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn explicit_implied_clauses_of<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<(ty::Clause<'static>, Span)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<(ty::Clause<'static>, Span)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.explicit_implied_clauses_of.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn explicit_implied_const_bounds<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<(ty::PolyTraitRef<'static>, Span)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<(ty::PolyTraitRef<'static>, Span)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.explicit_implied_const_bounds.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn inherent_impls<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<LocalDefId>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<LocalDefId> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.inherent_impls.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn module_children_reexports<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<ModChild>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<ModChild> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.module_children_reexports.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn ambig_module_children<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<AmbigModChild>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<AmbigModChild> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.ambig_module_children.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn cross_crate_inlinable<T>(&mut self, i: LocalDefId, v: T) where
bool: EncodeFrom<'tcx, T> {
let encoded =
<bool as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.cross_crate_inlinable.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn asyncness<T>(&mut self, i: LocalDefId, v: T) where
ty::Asyncness: EncodeFrom<'tcx, T> {
let encoded =
<ty::Asyncness as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.asyncness.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn constness<T>(&mut self, i: LocalDefId, v: T) where
hir::Constness: EncodeFrom<'tcx, T> {
let encoded =
<hir::Constness as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.constness.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn safety<T>(&mut self, i: LocalDefId, v: T) where
hir::Safety: EncodeFrom<'tcx, T> {
let encoded =
<hir::Safety as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.safety.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn defaultness<T>(&mut self, i: LocalDefId, v: T) where
hir::Defaultness: EncodeFrom<'tcx, T> {
let encoded =
<hir::Defaultness as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.defaultness.set(idx, encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn impl_is_fully_generic_for_reflection<T>(&mut self, i: LocalDefId, v: T)
where bool: EncodeFrom<'tcx, T> {
let encoded =
<bool as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.impl_is_fully_generic_for_reflection.set(idx,
encoded);
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn opt_rpitit_info<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::ImplTraitInTraitData>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::ImplTraitInTraitData> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.opt_rpitit_info.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn attributes<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<Attribute>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<Attribute> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.attributes.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn module_children_non_reexports<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<LocalDefId>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<LocalDefId> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.module_children_non_reexports.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn associated_item_or_field_def_ids<T>(&mut self, i: LocalDefId, v: T)
where LazyArray<LocalDefId>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<LocalDefId> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.associated_item_or_field_def_ids.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn def_kind<T>(&mut self, i: LocalDefId, v: T) where
DefKind: EncodeFrom<'tcx, T> {
let encoded =
<DefKind as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.def_kind.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn visibility<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::Visibility<LocalDefId>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::Visibility<LocalDefId>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.visibility.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn def_span<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<Span>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<Span> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.def_span.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn def_ident_span<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<Span>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<Span> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.def_ident_span.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn lookup_stability<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<Stability>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<Stability> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.lookup_stability.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn lookup_const_stability<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ConstStability>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ConstStability> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.lookup_const_stability.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn lookup_default_body_stability<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<DefaultBodyStability>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<DefaultBodyStability> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.lookup_default_body_stability.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn lookup_deprecation_entry<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<Deprecation>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<Deprecation> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.lookup_deprecation_entry.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn explicit_clauses_of<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::GenericClauses<'static>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::GenericClauses<'static>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.explicit_clauses_of.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn generics_of<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::Generics>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::Generics> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.generics_of.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn type_of<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::EarlyBinder<'static,
Ty<'static>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::EarlyBinder<'static, Ty<'static>>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.type_of.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn variances_of<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<ty::Variance>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<ty::Variance> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.variances_of.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn fn_sig<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::EarlyBinder<'static,
ty::PolyFnSig<'static>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::EarlyBinder<'static, ty::PolyFnSig<'static>>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.fn_sig.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn codegen_fn_attrs<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<CodegenFnAttrs>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<CodegenFnAttrs> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.codegen_fn_attrs.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn impl_trait_header<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::ImplTraitHeader<'static>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::ImplTraitHeader<'static>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.impl_trait_header.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn const_param_default<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::EarlyBinder<'static,
rustc_middle::ty::Const<'static>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::EarlyBinder<'static,
rustc_middle::ty::Const<'static>>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.const_param_default.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn object_lifetime_default<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ObjectLifetimeDefault>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ObjectLifetimeDefault> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.object_lifetime_default.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn optimized_mir<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<mir::Body<'static>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<mir::Body<'static>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.optimized_mir.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn mir_for_ctfe<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<mir::Body<'static>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<mir::Body<'static>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.mir_for_ctfe.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn trivial_const<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<(ConstValue, Ty<'static>)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<(ConstValue, Ty<'static>)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.trivial_const.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn closure_saved_names_of_captured_variables<T>(&mut self, i: LocalDefId,
v: T) where
LazyValue<IndexVec<FieldIdx, Symbol>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<IndexVec<FieldIdx, Symbol>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.closure_saved_names_of_captured_variables.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn mir_coroutine_witnesses<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<mir::CoroutineLayout<'static>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<mir::CoroutineLayout<'static>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.mir_coroutine_witnesses.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn promoted_mir<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<IndexVec<mir::Promoted,
mir::Body<'static>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.promoted_mir.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn thir_abstract_const<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::EarlyBinder<'static,
ty::Const<'static>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::EarlyBinder<'static, ty::Const<'static>>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.thir_abstract_const.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn impl_parent<T>(&mut self, i: LocalDefId, v: T) where
RemappedRawDefId: EncodeFrom<'tcx, T> {
let encoded =
<RemappedRawDefId as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.impl_parent.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn const_conditions<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::ConstConditions<'static>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::ConstConditions<'static>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.const_conditions.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn coerce_unsized_info<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::adjustment::CoerceUnsizedInfo>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::adjustment::CoerceUnsizedInfo> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.coerce_unsized_info.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn mir_const_qualif<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<mir::ConstQualifs>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<mir::ConstQualifs> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.mir_const_qualif.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn rendered_const<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<String>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<String> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.rendered_const.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn rendered_precise_capturing_args<T>(&mut self, i: LocalDefId, v: T)
where
LazyArray<PreciseCapturingArgKind<Symbol,
Symbol>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<PreciseCapturingArgKind<Symbol, Symbol>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.rendered_precise_capturing_args.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn fn_arg_idents<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<Option<Ident>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<Option<Ident>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.fn_arg_idents.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn coroutine_kind<T>(&mut self, i: LocalDefId, v: T) where
hir::CoroutineKind: EncodeFrom<'tcx, T> {
let encoded =
<hir::CoroutineKind as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.coroutine_kind.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn coroutine_for_closure<T>(&mut self, i: LocalDefId, v: T) where
RemappedRawDefId: EncodeFrom<'tcx, T> {
let encoded =
<RemappedRawDefId as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.coroutine_for_closure.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn adt_destructor<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::Destructor>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::Destructor> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.adt_destructor.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn adt_async_destructor<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::AsyncDestructor>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::AsyncDestructor> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.adt_async_destructor.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn coroutine_by_move_body_def_id<T>(&mut self, i: LocalDefId, v: T) where
RemappedRawDefId: EncodeFrom<'tcx, T> {
let encoded =
<RemappedRawDefId as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.coroutine_by_move_body_def_id.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn eval_static_initializer<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<mir::interpret::ConstAllocation<'static>>: EncodeFrom<'tcx,
T> {
let encoded =
<LazyValue<mir::interpret::ConstAllocation<'static>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.eval_static_initializer.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn trait_def<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::TraitDef>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::TraitDef> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.trait_def.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn expn_that_defined<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ExpnId>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ExpnId> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.expn_that_defined.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn default_fields<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<DefId>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<DefId> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.default_fields.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn params_in_repr<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<DenseBitSet<u32>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<DenseBitSet<u32>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.params_in_repr.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn repr_options<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ReprOptions>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ReprOptions> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.repr_options.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn def_keys<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<DefKey>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<DefKey> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.def_keys.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn variant_data<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<VariantData>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<VariantData> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.variant_data.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn assoc_container<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::AssocContainer>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::AssocContainer> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.assoc_container.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn macro_definition<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ast::DelimArgs>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ast::DelimArgs> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.macro_definition.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn deduced_param_attrs<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<DeducedParamAttrs>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<DeducedParamAttrs> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.deduced_param_attrs.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn collect_return_position_impl_trait_in_trait_tys<T>(&mut self,
i: LocalDefId, v: T) where
LazyValue<DefIdMap<ty::EarlyBinder<'static,
Ty<'static>>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.collect_return_position_impl_trait_in_trait_tys.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn doc_link_resolutions<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<DocLinkResMap>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<DocLinkResMap> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.doc_link_resolutions.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn doc_link_traits_in_scope<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<DefId>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<DefId> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.doc_link_traits_in_scope.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn assumed_wf_types_for_rpitit<T>(&mut self, i: LocalDefId, v: T) where
LazyArray<(Ty<'static>, Span)>: EncodeFrom<'tcx, T> {
let encoded =
<LazyArray<(Ty<'static>, Span)> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.assumed_wf_types_for_rpitit.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn opaque_ty_origin<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<hir::OpaqueTyOrigin<DefId>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<hir::OpaqueTyOrigin<DefId>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.opaque_ty_origin.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn anon_const_kind<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::AnonConstKind>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::AnonConstKind> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.anon_const_kind.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn const_of_item<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<Option<ty::EarlyBinder<'static,
ty::Const<'static>>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<Option<ty::EarlyBinder<'static, ty::Const<'static>>>>
as EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.const_of_item.set(idx, Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn associated_types_for_impl_traits_in_trait_or_impl<T>(&mut self,
i: LocalDefId, v: T) where
LazyValue<DefIdMap<Vec<DefId>>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<DefIdMap<Vec<DefId>>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.associated_types_for_impl_traits_in_trait_or_impl.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn args_known_to_outlive_alias_params<T>(&mut self, i: LocalDefId, v: T)
where LazyValue<Vec<(usize, DenseBitSet<u32>)>>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<Vec<(usize, DenseBitSet<u32>)>> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.args_known_to_outlive_alias_params.set(idx,
Some(encoded));
}
/// Records a value into the corresponding `TableBuilders` field, encoding it in
/// the process when necessary
fn mut_restriction<T>(&mut self, i: LocalDefId, v: T) where
LazyValue<ty::RestrictionKind>: EncodeFrom<'tcx, T> {
let encoded =
<LazyValue<ty::RestrictionKind> as
EncodeFrom<'tcx, T>>::encode_from(self.encoder, v);
let idx = self.encoder.local_defs_remapping.map_local_def_id(i);
self.encoder.tables.mut_restriction.set(idx, Some(encoded));
}
}define_tables! {
623// If the compiler complains about `EncodeFrom` or `ParameterizedOverTcx` bounds when calling a
624// function generated in this macro, add them to parameterized.rs
625- defaulted:
626 intrinsic: Table<Option<LazyValue<ty::IntrinsicDef>>>,
627 is_macro_rules: Table<bool>,
628 type_alias_is_checked: Table<bool>,
629 attr_flags: Table<AttrFlags>,
630// The u64 is the crate-local part of the DefPathHash. All hashes in this crate have the same
631 // StableCrateId, so we omit encoding those into the table.
632 //
633 // Note also that this table is fully populated (no gaps) as every DefIndex should have a
634 // corresponding DefPathHash.
635def_path_hashes: Table<u64>,
636 explicit_item_bounds: Table<LazyArray<(ty::Clause<'static>, Span)>>,
637 explicit_item_self_bounds: Table<LazyArray<(ty::Clause<'static>, Span)>>,
638 inferred_outlives_of: Table<LazyArray<(ty::Clause<'static>, Span)>>,
639 explicit_super_clauses_of: Table<LazyArray<(ty::Clause<'static>, Span)>>,
640 explicit_implied_clauses_of: Table<LazyArray<(ty::Clause<'static>, Span)>>,
641 explicit_implied_const_bounds: Table<LazyArray<(ty::PolyTraitRef<'static>, Span)>>,
642 inherent_impls: Table<LazyArray<LocalDefId>>,
643// Reexported names are not associated with individual `DefId`s,
644 // e.g. a glob import can introduce a lot of names, all with the same `DefId`.
645 // That's why the encoded list needs to contain `ModChild` structures describing all the names
646 // individually instead of `DefId`s.
647module_children_reexports: Table<LazyArray<ModChild>>,
648 ambig_module_children: Table<LazyArray<AmbigModChild>>,
649 cross_crate_inlinable: Table<bool>,
650 asyncness: Table<ty::Asyncness>,
651 constness: Table<hir::Constness>,
652 safety: Table<hir::Safety>,
653 defaultness: Table<hir::Defaultness>,
654 impl_is_fully_generic_for_reflection: Table<bool>,
655656- optional:
657 opt_rpitit_info: Table<LazyValue<ty::ImplTraitInTraitData>>,
658 attributes: Table<LazyArray<Attribute>>,
659// For non-reexported names in a module every name is associated with a separate `DefId`,
660 // so we can take their names, visibilities etc from other encoded tables.
661module_children_non_reexports: Table<LazyArray<LocalDefId>>,
662 associated_item_or_field_def_ids: Table<LazyArray<LocalDefId>>,
663 def_kind: Table<DefKind>,
664 visibility: Table<LazyValue<ty::Visibility<LocalDefId>>>,
665 def_span: Table<LazyValue<Span>>,
666 def_ident_span: Table<LazyValue<Span>>,
667 lookup_stability: Table<LazyValue<Stability>>,
668 lookup_const_stability: Table<LazyValue<ConstStability>>,
669 lookup_default_body_stability: Table<LazyValue<DefaultBodyStability>>,
670 lookup_deprecation_entry: Table<LazyValue<Deprecation>>,
671 explicit_clauses_of: Table<LazyValue<ty::GenericClauses<'static>>>,
672 generics_of: Table<LazyValue<ty::Generics>>,
673 type_of: Table<LazyValue<ty::EarlyBinder<'static, Ty<'static>>>>,
674 variances_of: Table<LazyArray<ty::Variance>>,
675 fn_sig: Table<LazyValue<ty::EarlyBinder<'static, ty::PolyFnSig<'static>>>>,
676 codegen_fn_attrs: Table<LazyValue<CodegenFnAttrs>>,
677 impl_trait_header: Table<LazyValue<ty::ImplTraitHeader<'static>>>,
678 const_param_default: Table<LazyValue<ty::EarlyBinder<'static, rustc_middle::ty::Const<'static>>>>,
679 object_lifetime_default: Table<LazyValue<ObjectLifetimeDefault>>,
680 optimized_mir: Table<LazyValue<mir::Body<'static>>>,
681 mir_for_ctfe: Table<LazyValue<mir::Body<'static>>>,
682 trivial_const: Table<LazyValue<(ConstValue, Ty<'static>)>>,
683 closure_saved_names_of_captured_variables: Table<LazyValue<IndexVec<FieldIdx, Symbol>>>,
684 mir_coroutine_witnesses: Table<LazyValue<mir::CoroutineLayout<'static>>>,
685 promoted_mir: Table<LazyValue<IndexVec<mir::Promoted, mir::Body<'static>>>>,
686 thir_abstract_const: Table<LazyValue<ty::EarlyBinder<'static, ty::Const<'static>>>>,
687 impl_parent: Table<RemappedRawDefId>,
688 const_conditions: Table<LazyValue<ty::ConstConditions<'static>>>,
689// FIXME(eddyb) perhaps compute this on the fly if cheap enough?
690coerce_unsized_info: Table<LazyValue<ty::adjustment::CoerceUnsizedInfo>>,
691 mir_const_qualif: Table<LazyValue<mir::ConstQualifs>>,
692 rendered_const: Table<LazyValue<String>>,
693 rendered_precise_capturing_args: Table<LazyArray<PreciseCapturingArgKind<Symbol, Symbol>>>,
694 fn_arg_idents: Table<LazyArray<Option<Ident>>>,
695 coroutine_kind: Table<hir::CoroutineKind>,
696 coroutine_for_closure: Table<RemappedRawDefId>,
697 adt_destructor: Table<LazyValue<ty::Destructor>>,
698 adt_async_destructor: Table<LazyValue<ty::AsyncDestructor>>,
699 coroutine_by_move_body_def_id: Table<RemappedRawDefId>,
700 eval_static_initializer: Table<LazyValue<mir::interpret::ConstAllocation<'static>>>,
701 trait_def: Table<LazyValue<ty::TraitDef>>,
702 expn_that_defined: Table<LazyValue<ExpnId>>,
703 default_fields: Table<LazyValue<DefId>>,
704 params_in_repr: Table<LazyValue<DenseBitSet<u32>>>,
705 repr_options: Table<LazyValue<ReprOptions>>,
706// `def_keys` and `def_path_hashes` represent a lazy version of a
707 // `DefPathTable`. This allows us to avoid deserializing an entire
708 // `DefPathTable` up front, since we may only ever use a few
709 // definitions from any given crate.
710def_keys: Table<LazyValue<DefKey>>,
711 variant_data: Table<LazyValue<VariantData>>,
712 assoc_container: Table<LazyValue<ty::AssocContainer>>,
713 macro_definition: Table<LazyValue<ast::DelimArgs>>,
714 deduced_param_attrs: Table<LazyArray<DeducedParamAttrs>>,
715 collect_return_position_impl_trait_in_trait_tys: Table<LazyValue<DefIdMap<ty::EarlyBinder<'static, Ty<'static>>>>>,
716 doc_link_resolutions: Table<LazyValue<DocLinkResMap>>,
717 doc_link_traits_in_scope: Table<LazyArray<DefId>>,
718 assumed_wf_types_for_rpitit: Table<LazyArray<(Ty<'static>, Span)>>,
719 opaque_ty_origin: Table<LazyValue<hir::OpaqueTyOrigin<DefId>>>,
720 anon_const_kind: Table<LazyValue<ty::AnonConstKind>>,
721 const_of_item: Table<LazyValue<Option<ty::EarlyBinder<'static, ty::Const<'static>>>>>,
722 associated_types_for_impl_traits_in_trait_or_impl: Table<LazyValue<DefIdMap<Vec<DefId>>>>,
723 args_known_to_outlive_alias_params: Table<LazyValue<Vec<(usize, DenseBitSet<u32>)>>>,
724 mut_restriction: Table<LazyValue<ty::RestrictionKind>>,
725}726727#[derive(const _: () =
{
impl<'tcx, __E: ::rustc_middle::ty::codec::TyEncoder<'tcx>>
::rustc_serialize::Encodable<__E> for VariantData {
fn encode(&self, __encoder: &mut __E) {
let VariantData {
idx: ref __binding_0,
discr: ref __binding_1,
ctor: ref __binding_2,
is_non_exhaustive: ref __binding_3 } = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_1,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_2,
__encoder);
::rustc_serialize::Encodable::<__E>::encode(__binding_3,
__encoder);
}
}
};TyEncodable, const _: () =
{
impl<'tcx, __D: ::rustc_middle::ty::codec::TyDecoder<'tcx>>
::rustc_serialize::Decodable<__D> for VariantData {
fn decode(__decoder: &mut __D) -> Self {
VariantData {
idx: ::rustc_serialize::Decodable::decode(__decoder),
discr: ::rustc_serialize::Decodable::decode(__decoder),
ctor: ::rustc_serialize::Decodable::decode(__decoder),
is_non_exhaustive: ::rustc_serialize::Decodable::decode(__decoder),
}
}
}
};TyDecodable)]
728struct VariantData {
729 idx: VariantIdx,
730 discr: ty::VariantDiscr,
731/// If this is unit or tuple-variant/struct, then this is the index of the ctor id.
732ctor: Option<(CtorKind, LocalDefId)>,
733 is_non_exhaustive: bool,
734}
735736pub struct AttrFlags(<AttrFlags as
::bitflags::__private::PublicFlags>::Internal);
#[automatically_derived]impl ::core::default::Default for AttrFlags {
#[inline]
fn default() -> Self { AttrFlags(::core::default::Default::default()) }
}
impl AttrFlags {
#[allow(deprecated, non_upper_case_globals,)]
pub const IS_DOC_HIDDEN: Self = Self::from_bits_retain(1 << 0);
}
impl ::bitflags::Flags for AttrFlags {
const FLAGS: &'static [::bitflags::Flag<AttrFlags>] =
&[{
#[allow(deprecated, non_upper_case_globals,)]
::bitflags::Flag::new("IS_DOC_HIDDEN",
AttrFlags::IS_DOC_HIDDEN)
}];
type Bits = u8;
fn bits(&self) -> u8 { AttrFlags::bits(self) }
fn from_bits_retain(bits: u8) -> AttrFlags {
AttrFlags::from_bits_retain(bits)
}
}
#[allow(dead_code, deprecated, unused_doc_comments, unused_attributes,
unused_mut, unused_imports, non_upper_case_globals, clippy ::
assign_op_pattern, clippy :: indexing_slicing, clippy :: same_name_method,
clippy :: iter_without_into_iter,)]
const _: () =
{
#[repr(transparent)]
pub struct InternalBitFlags(u8);
#[automatically_derived]
#[doc(hidden)]
unsafe impl ::core::clone::TrivialClone for InternalBitFlags { }
#[automatically_derived]
impl ::core::clone::Clone for InternalBitFlags {
#[inline]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<u8>;
*self
}
}
#[automatically_derived]
impl ::core::marker::Copy for InternalBitFlags { }
#[automatically_derived]
impl ::core::marker::StructuralPartialEq for InternalBitFlags { }
#[automatically_derived]
impl ::core::cmp::PartialEq for InternalBitFlags {
#[inline]
fn eq(&self, other: &Self) -> bool { self.0 == other.0 }
}
#[automatically_derived]
impl ::core::cmp::Eq for InternalBitFlags {
#[inline]
#[doc(hidden)]
#[coverage(off)]
fn assert_fields_are_eq(&self) {
let _: ::core::cmp::AssertParamIsEq<u8>;
}
}
#[automatically_derived]
impl ::core::cmp::PartialOrd for InternalBitFlags {
#[inline]
fn partial_cmp(&self, other: &Self)
-> ::core::option::Option<::core::cmp::Ordering> {
::core::option::Option::Some(::core::cmp::Ord::cmp(self,
other))
}
}
#[automatically_derived]
impl ::core::cmp::Ord for InternalBitFlags {
#[inline]
fn cmp(&self, other: &Self) -> ::core::cmp::Ordering {
::core::cmp::Ord::cmp(&self.0, &other.0)
}
}
#[automatically_derived]
impl ::core::hash::Hash for InternalBitFlags {
#[inline]
fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
::core::hash::Hash::hash(&self.0, state)
}
}
impl ::bitflags::__private::PublicFlags for AttrFlags {
type Primitive = u8;
type Internal = InternalBitFlags;
}
impl ::bitflags::__private::core::default::Default for
InternalBitFlags {
#[inline]
fn default() -> Self { InternalBitFlags::empty() }
}
impl ::bitflags::__private::core::fmt::Debug for InternalBitFlags {
fn fmt(&self,
f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
-> ::bitflags::__private::core::fmt::Result {
if self.is_empty() {
f.write_fmt(format_args!("{0:#x}",
<u8 as ::bitflags::Bits>::EMPTY))
} else {
::bitflags::__private::core::fmt::Display::fmt(self, f)
}
}
}
impl ::bitflags::__private::core::fmt::Display for InternalBitFlags {
fn fmt(&self,
f: &mut ::bitflags::__private::core::fmt::Formatter<'_>)
-> ::bitflags::__private::core::fmt::Result {
::bitflags::parser::to_writer(&AttrFlags(*self), f)
}
}
impl ::bitflags::__private::core::str::FromStr for InternalBitFlags {
type Err = ::bitflags::parser::ParseError;
fn from_str(s: &str)
->
::bitflags::__private::core::result::Result<Self,
Self::Err> {
::bitflags::parser::from_str::<AttrFlags>(s).map(|flags|
flags.0)
}
}
impl ::bitflags::__private::core::convert::AsRef<u8> for
InternalBitFlags {
fn as_ref(&self) -> &u8 { &self.0 }
}
impl ::bitflags::__private::core::convert::From<u8> for
InternalBitFlags {
fn from(bits: u8) -> Self { Self::from_bits_retain(bits) }
}
#[allow(dead_code, deprecated, unused_attributes)]
impl InternalBitFlags {
/// Get a flags value with all bits unset.
#[inline]
pub const fn empty() -> Self {
Self(<u8 as ::bitflags::Bits>::EMPTY)
}
/// Get a flags value with all known bits set.
#[inline]
pub const fn all() -> Self {
let mut truncated = <u8 as ::bitflags::Bits>::EMPTY;
let mut i = 0;
{
{
let flag =
<AttrFlags as ::bitflags::Flags>::FLAGS[i].value().bits();
truncated = truncated | flag;
i += 1;
}
};
let _ = i;
Self(truncated)
}
/// Get the underlying bits value.
///
/// The returned value is exactly the bits set in this flags value.
#[inline]
pub const fn bits(&self) -> u8 { self.0 }
/// Convert from a bits value.
///
/// This method will return `None` if any unknown bits are set.
#[inline]
pub const fn from_bits(bits: u8)
-> ::bitflags::__private::core::option::Option<Self> {
let truncated = Self::from_bits_truncate(bits).0;
if truncated == bits {
::bitflags::__private::core::option::Option::Some(Self(bits))
} else { ::bitflags::__private::core::option::Option::None }
}
/// Convert from a bits value, unsetting any unknown bits.
#[inline]
pub const fn from_bits_truncate(bits: u8) -> Self {
Self(bits & Self::all().0)
}
/// Convert from a bits value exactly.
#[inline]
pub const fn from_bits_retain(bits: u8) -> Self { Self(bits) }
/// Get a flags value with the bits of a flag with the given name set.
///
/// This method will return `None` if `name` is empty or doesn't
/// correspond to any named flag.
#[inline]
pub fn from_name(name: &str)
-> ::bitflags::__private::core::option::Option<Self> {
{
if name == "IS_DOC_HIDDEN" {
return ::bitflags::__private::core::option::Option::Some(Self(AttrFlags::IS_DOC_HIDDEN.bits()));
}
};
;
let _ = name;
::bitflags::__private::core::option::Option::None
}
/// Whether all bits in this flags value are unset.
#[inline]
pub const fn is_empty(&self) -> bool {
self.0 == <u8 as ::bitflags::Bits>::EMPTY
}
/// Whether all known bits in this flags value are set.
#[inline]
pub const fn is_all(&self) -> bool {
Self::all().0 | self.0 == self.0
}
/// Whether any set bits in a source flags value are also set in a target flags value.
#[inline]
pub const fn intersects(&self, other: Self) -> bool {
self.0 & other.0 != <u8 as ::bitflags::Bits>::EMPTY
}
/// Whether all set bits in a source flags value are also set in a target flags value.
#[inline]
pub const fn contains(&self, other: Self) -> bool {
self.0 & other.0 == other.0
}
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
pub fn insert(&mut self, other: Self) {
*self = Self(self.0).union(other);
}
/// The intersection of a source flags value with the complement of a target flags
/// value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `remove` won't truncate `other`, but the `!` operator will.
#[inline]
pub fn remove(&mut self, other: Self) {
*self = Self(self.0).difference(other);
}
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
pub fn toggle(&mut self, other: Self) {
*self = Self(self.0).symmetric_difference(other);
}
/// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
#[inline]
pub fn set(&mut self, other: Self, value: bool) {
if value { self.insert(other); } else { self.remove(other); }
}
/// The bitwise and (`&`) of the bits in two flags values.
#[inline]
#[must_use]
pub const fn intersection(self, other: Self) -> Self {
Self(self.0 & other.0)
}
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
#[must_use]
pub const fn union(self, other: Self) -> Self {
Self(self.0 | other.0)
}
/// The intersection of a source flags value with the complement of a target flags
/// value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `difference` won't truncate `other`, but the `!` operator will.
#[inline]
#[must_use]
pub const fn difference(self, other: Self) -> Self {
Self(self.0 & !other.0)
}
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
#[must_use]
pub const fn symmetric_difference(self, other: Self) -> Self {
Self(self.0 ^ other.0)
}
/// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
#[inline]
#[must_use]
pub const fn complement(self) -> Self {
Self::from_bits_truncate(!self.0)
}
}
impl ::bitflags::__private::core::fmt::Binary for InternalBitFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::fmt::Octal for InternalBitFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::fmt::LowerHex for InternalBitFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::fmt::UpperHex for InternalBitFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::ops::BitOr for InternalBitFlags {
type Output = Self;
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
fn bitor(self, other: InternalBitFlags) -> Self {
self.union(other)
}
}
impl ::bitflags::__private::core::ops::BitOrAssign for
InternalBitFlags {
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
fn bitor_assign(&mut self, other: Self) { self.insert(other); }
}
impl ::bitflags::__private::core::ops::BitXor for InternalBitFlags {
type Output = Self;
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
fn bitxor(self, other: Self) -> Self {
self.symmetric_difference(other)
}
}
impl ::bitflags::__private::core::ops::BitXorAssign for
InternalBitFlags {
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
}
impl ::bitflags::__private::core::ops::BitAnd for InternalBitFlags {
type Output = Self;
/// The bitwise and (`&`) of the bits in two flags values.
#[inline]
fn bitand(self, other: Self) -> Self { self.intersection(other) }
}
impl ::bitflags::__private::core::ops::BitAndAssign for
InternalBitFlags {
/// The bitwise and (`&`) of the bits in two flags values.
#[inline]
fn bitand_assign(&mut self, other: Self) {
*self =
Self::from_bits_retain(self.bits()).intersection(other);
}
}
impl ::bitflags::__private::core::ops::Sub for InternalBitFlags {
type Output = Self;
/// The intersection of a source flags value with the complement of a target flags value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `difference` won't truncate `other`, but the `!` operator will.
#[inline]
fn sub(self, other: Self) -> Self { self.difference(other) }
}
impl ::bitflags::__private::core::ops::SubAssign for InternalBitFlags
{
/// The intersection of a source flags value with the complement of a target flags value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `difference` won't truncate `other`, but the `!` operator will.
#[inline]
fn sub_assign(&mut self, other: Self) { self.remove(other); }
}
impl ::bitflags::__private::core::ops::Not for InternalBitFlags {
type Output = Self;
/// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
#[inline]
fn not(self) -> Self { self.complement() }
}
impl ::bitflags::__private::core::iter::Extend<InternalBitFlags> for
InternalBitFlags {
/// The bitwise or (`|`) of the bits in each flags value.
fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
= Self>>(&mut self, iterator: T) {
for item in iterator { self.insert(item) }
}
}
impl ::bitflags::__private::core::iter::FromIterator<InternalBitFlags>
for InternalBitFlags {
/// The bitwise or (`|`) of the bits in each flags value.
fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
= Self>>(iterator: T) -> Self {
use ::bitflags::__private::core::iter::Extend;
let mut result = Self::empty();
result.extend(iterator);
result
}
}
impl InternalBitFlags {
/// Yield a set of contained flags values.
///
/// Each yielded flags value will correspond to a defined named flag. Any unknown bits
/// will be yielded together as a final flags value.
#[inline]
pub const fn iter(&self) -> ::bitflags::iter::Iter<AttrFlags> {
::bitflags::iter::Iter::__private_const_new(<AttrFlags as
::bitflags::Flags>::FLAGS,
AttrFlags::from_bits_retain(self.bits()),
AttrFlags::from_bits_retain(self.bits()))
}
/// Yield a set of contained named flags values.
///
/// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
/// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
#[inline]
pub const fn iter_names(&self)
-> ::bitflags::iter::IterNames<AttrFlags> {
::bitflags::iter::IterNames::__private_const_new(<AttrFlags as
::bitflags::Flags>::FLAGS,
AttrFlags::from_bits_retain(self.bits()),
AttrFlags::from_bits_retain(self.bits()))
}
}
impl ::bitflags::__private::core::iter::IntoIterator for
InternalBitFlags {
type Item = AttrFlags;
type IntoIter = ::bitflags::iter::Iter<AttrFlags>;
fn into_iter(self) -> Self::IntoIter { self.iter() }
}
impl InternalBitFlags {
/// Returns a mutable reference to the raw value of the flags currently stored.
#[inline]
pub fn bits_mut(&mut self) -> &mut u8 { &mut self.0 }
}
#[allow(dead_code, deprecated, unused_attributes)]
impl AttrFlags {
/// Get a flags value with all bits unset.
#[inline]
pub const fn empty() -> Self { Self(InternalBitFlags::empty()) }
/// Get a flags value with all known bits set.
#[inline]
pub const fn all() -> Self { Self(InternalBitFlags::all()) }
/// Get the underlying bits value.
///
/// The returned value is exactly the bits set in this flags value.
#[inline]
pub const fn bits(&self) -> u8 { self.0.bits() }
/// Convert from a bits value.
///
/// This method will return `None` if any unknown bits are set.
#[inline]
pub const fn from_bits(bits: u8)
-> ::bitflags::__private::core::option::Option<Self> {
match InternalBitFlags::from_bits(bits) {
::bitflags::__private::core::option::Option::Some(bits) =>
::bitflags::__private::core::option::Option::Some(Self(bits)),
::bitflags::__private::core::option::Option::None =>
::bitflags::__private::core::option::Option::None,
}
}
/// Convert from a bits value, unsetting any unknown bits.
#[inline]
pub const fn from_bits_truncate(bits: u8) -> Self {
Self(InternalBitFlags::from_bits_truncate(bits))
}
/// Convert from a bits value exactly.
#[inline]
pub const fn from_bits_retain(bits: u8) -> Self {
Self(InternalBitFlags::from_bits_retain(bits))
}
/// Get a flags value with the bits of a flag with the given name set.
///
/// This method will return `None` if `name` is empty or doesn't
/// correspond to any named flag.
#[inline]
pub fn from_name(name: &str)
-> ::bitflags::__private::core::option::Option<Self> {
match InternalBitFlags::from_name(name) {
::bitflags::__private::core::option::Option::Some(bits) =>
::bitflags::__private::core::option::Option::Some(Self(bits)),
::bitflags::__private::core::option::Option::None =>
::bitflags::__private::core::option::Option::None,
}
}
/// Whether all bits in this flags value are unset.
#[inline]
pub const fn is_empty(&self) -> bool { self.0.is_empty() }
/// Whether all known bits in this flags value are set.
#[inline]
pub const fn is_all(&self) -> bool { self.0.is_all() }
/// Whether any set bits in a source flags value are also set in a target flags value.
#[inline]
pub const fn intersects(&self, other: Self) -> bool {
self.0.intersects(other.0)
}
/// Whether all set bits in a source flags value are also set in a target flags value.
#[inline]
pub const fn contains(&self, other: Self) -> bool {
self.0.contains(other.0)
}
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
pub fn insert(&mut self, other: Self) { self.0.insert(other.0) }
/// The intersection of a source flags value with the complement of a target flags
/// value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `remove` won't truncate `other`, but the `!` operator will.
#[inline]
pub fn remove(&mut self, other: Self) { self.0.remove(other.0) }
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
pub fn toggle(&mut self, other: Self) { self.0.toggle(other.0) }
/// Call `insert` when `value` is `true` or `remove` when `value` is `false`.
#[inline]
pub fn set(&mut self, other: Self, value: bool) {
self.0.set(other.0, value)
}
/// The bitwise and (`&`) of the bits in two flags values.
#[inline]
#[must_use]
pub const fn intersection(self, other: Self) -> Self {
Self(self.0.intersection(other.0))
}
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
#[must_use]
pub const fn union(self, other: Self) -> Self {
Self(self.0.union(other.0))
}
/// The intersection of a source flags value with the complement of a target flags
/// value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `difference` won't truncate `other`, but the `!` operator will.
#[inline]
#[must_use]
pub const fn difference(self, other: Self) -> Self {
Self(self.0.difference(other.0))
}
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
#[must_use]
pub const fn symmetric_difference(self, other: Self) -> Self {
Self(self.0.symmetric_difference(other.0))
}
/// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
#[inline]
#[must_use]
pub const fn complement(self) -> Self {
Self(self.0.complement())
}
}
impl ::bitflags::__private::core::fmt::Binary for AttrFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::Binary::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::fmt::Octal for AttrFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::Octal::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::fmt::LowerHex for AttrFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::LowerHex::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::fmt::UpperHex for AttrFlags {
fn fmt(&self, f: &mut ::bitflags::__private::core::fmt::Formatter)
-> ::bitflags::__private::core::fmt::Result {
let inner = self.0;
::bitflags::__private::core::fmt::UpperHex::fmt(&inner, f)
}
}
impl ::bitflags::__private::core::ops::BitOr for AttrFlags {
type Output = Self;
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
fn bitor(self, other: AttrFlags) -> Self { self.union(other) }
}
impl ::bitflags::__private::core::ops::BitOrAssign for AttrFlags {
/// The bitwise or (`|`) of the bits in two flags values.
#[inline]
fn bitor_assign(&mut self, other: Self) { self.insert(other); }
}
impl ::bitflags::__private::core::ops::BitXor for AttrFlags {
type Output = Self;
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
fn bitxor(self, other: Self) -> Self {
self.symmetric_difference(other)
}
}
impl ::bitflags::__private::core::ops::BitXorAssign for AttrFlags {
/// The bitwise exclusive-or (`^`) of the bits in two flags values.
#[inline]
fn bitxor_assign(&mut self, other: Self) { self.toggle(other); }
}
impl ::bitflags::__private::core::ops::BitAnd for AttrFlags {
type Output = Self;
/// The bitwise and (`&`) of the bits in two flags values.
#[inline]
fn bitand(self, other: Self) -> Self { self.intersection(other) }
}
impl ::bitflags::__private::core::ops::BitAndAssign for AttrFlags {
/// The bitwise and (`&`) of the bits in two flags values.
#[inline]
fn bitand_assign(&mut self, other: Self) {
*self =
Self::from_bits_retain(self.bits()).intersection(other);
}
}
impl ::bitflags::__private::core::ops::Sub for AttrFlags {
type Output = Self;
/// The intersection of a source flags value with the complement of a target flags value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `difference` won't truncate `other`, but the `!` operator will.
#[inline]
fn sub(self, other: Self) -> Self { self.difference(other) }
}
impl ::bitflags::__private::core::ops::SubAssign for AttrFlags {
/// The intersection of a source flags value with the complement of a target flags value (`&!`).
///
/// This method is not equivalent to `self & !other` when `other` has unknown bits set.
/// `difference` won't truncate `other`, but the `!` operator will.
#[inline]
fn sub_assign(&mut self, other: Self) { self.remove(other); }
}
impl ::bitflags::__private::core::ops::Not for AttrFlags {
type Output = Self;
/// The bitwise negation (`!`) of the bits in a flags value, truncating the result.
#[inline]
fn not(self) -> Self { self.complement() }
}
impl ::bitflags::__private::core::iter::Extend<AttrFlags> for
AttrFlags {
/// The bitwise or (`|`) of the bits in each flags value.
fn extend<T: ::bitflags::__private::core::iter::IntoIterator<Item
= Self>>(&mut self, iterator: T) {
for item in iterator { self.insert(item) }
}
}
impl ::bitflags::__private::core::iter::FromIterator<AttrFlags> for
AttrFlags {
/// The bitwise or (`|`) of the bits in each flags value.
fn from_iter<T: ::bitflags::__private::core::iter::IntoIterator<Item
= Self>>(iterator: T) -> Self {
use ::bitflags::__private::core::iter::Extend;
let mut result = Self::empty();
result.extend(iterator);
result
}
}
impl AttrFlags {
/// Yield a set of contained flags values.
///
/// Each yielded flags value will correspond to a defined named flag. Any unknown bits
/// will be yielded together as a final flags value.
#[inline]
pub const fn iter(&self) -> ::bitflags::iter::Iter<AttrFlags> {
::bitflags::iter::Iter::__private_const_new(<AttrFlags as
::bitflags::Flags>::FLAGS,
AttrFlags::from_bits_retain(self.bits()),
AttrFlags::from_bits_retain(self.bits()))
}
/// Yield a set of contained named flags values.
///
/// This method is like [`iter`](#method.iter), except only yields bits in contained named flags.
/// Any unknown bits, or bits not corresponding to a contained flag will not be yielded.
#[inline]
pub const fn iter_names(&self)
-> ::bitflags::iter::IterNames<AttrFlags> {
::bitflags::iter::IterNames::__private_const_new(<AttrFlags as
::bitflags::Flags>::FLAGS,
AttrFlags::from_bits_retain(self.bits()),
AttrFlags::from_bits_retain(self.bits()))
}
}
impl ::bitflags::__private::core::iter::IntoIterator for AttrFlags {
type Item = AttrFlags;
type IntoIter = ::bitflags::iter::Iter<AttrFlags>;
fn into_iter(self) -> Self::IntoIter { self.iter() }
}
};bitflags::bitflags! {
737#[derive(Default)]
738pub struct AttrFlags: u8 {
739const IS_DOC_HIDDEN = 1 << 0;
740 }
741}742743/// A span tag byte encodes a bunch of data, so that we can cut out a few extra bytes from span
744/// encodings (which are very common, for example, libcore has ~650,000 unique spans and over 1.1
745/// million references to prior-written spans).
746///
747/// The byte format is split into several parts:
748///
749/// [ a a a a a c d d ]
750///
751/// `a` bits represent the span length. We have 5 bits, so we can store lengths up to 30 inline, with
752/// an all-1s pattern representing that the length is stored separately.
753///
754/// `c` represents whether the span context is zero (and then it is not stored as a separate varint)
755/// for direct span encodings, and whether the offset is absolute or relative otherwise (zero for
756/// absolute).
757///
758/// d bits represent the kind of span we are storing (local, foreign, partial, indirect).
759#[derive(const _: () =
{
impl<__E: ::rustc_span::SpanEncoder> ::rustc_serialize::Encodable<__E>
for SpanTag {
fn encode(&self, __encoder: &mut __E) {
let SpanTag(ref __binding_0) = *self;
::rustc_serialize::Encodable::<__E>::encode(__binding_0,
__encoder);
}
}
};Encodable, const _: () =
{
impl<__D: ::rustc_span::SpanDecoder> ::rustc_serialize::Decodable<__D>
for SpanTag {
fn decode(__decoder: &mut __D) -> Self {
SpanTag(::rustc_serialize::Decodable::decode(__decoder))
}
}
};Decodable, #[automatically_derived]impl ::core::marker::Copy for SpanTag { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for SpanTag {
}
#[automatically_derived]impl ::core::clone::Clone for SpanTag {
#[inline]
fn clone(&self) -> Self {
let _: ::core::clone::AssertParamIsClone<u8>;
*self
}
}Clone)]
760struct SpanTag(u8);
761762#[derive(#[automatically_derived]impl ::core::fmt::Debug for SpanKind {
#[inline]
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
::core::fmt::Formatter::write_str(f,
match self {
SpanKind::Local => "Local",
SpanKind::Foreign => "Foreign",
SpanKind::Partial => "Partial",
SpanKind::Indirect => "Indirect",
})
}
}Debug, #[automatically_derived]impl ::core::marker::Copy for SpanKind { }Copy, #[automatically_derived]#[doc(hidden)]unsafe impl ::core::clone::TrivialClone
for SpanKind {
}
#[automatically_derived]impl ::core::clone::Clone for SpanKind {
#[inline]
fn clone(&self) -> Self { *self }
}Clone, #[automatically_derived]impl ::core::marker::StructuralPartialEq for SpanKind
{
}
#[automatically_derived]impl ::core::cmp::PartialEq for SpanKind {
#[inline]
fn eq(&self, other: &Self) -> bool {
::core::intrinsics::discriminant_value(self) ==
::core::intrinsics::discriminant_value(other)
}
}PartialEq, #[automatically_derived]impl ::core::cmp::Eq for SpanKind { }Eq)]
763enum SpanKind {
764 Local = 0b00,
765 Foreign = 0b01,
766 Partial = 0b10,
767// Indicates the actual span contents are elsewhere.
768 // If this is the kind, then the span context bit represents whether it is a relative or
769 // absolute offset.
770Indirect = 0b11,
771}
772773impl SpanTag {
774fn new(kind: SpanKind, context: rustc_span::SyntaxContext, length: usize) -> SpanTag {
775let mut data = 0u8;
776data |= kindas u8;
777if context.is_root() {
778data |= 0b100;
779 }
780let all_1s_len = (0xffu8 << 3) >> 3;
781// strictly less than - all 1s pattern is a sentinel for storage being out of band.
782if length < all_1s_lenas usize {
783data |= (lengthas u8) << 3;
784 } else {
785data |= all_1s_len << 3;
786 }
787788SpanTag(data)
789 }
790791fn indirect(relative: bool, length_bytes: u8) -> SpanTag {
792let mut tag = SpanTag(SpanKind::Indirectas u8);
793if relative {
794tag.0 |= 0b100;
795 }
796if !(length_bytes <= 8) {
::core::panicking::panic("assertion failed: length_bytes <= 8")
};assert!(length_bytes <= 8);
797tag.0 |= length_bytes << 3;
798tag799 }
800801fn kind(self) -> SpanKind {
802let masked = self.0 & 0b11;
803match masked {
8040b00 => SpanKind::Local,
8050b01 => SpanKind::Foreign,
8060b10 => SpanKind::Partial,
8070b11 => SpanKind::Indirect,
808_ => ::core::panicking::unreachable_default_msg()unreachable!(),
809 }
810 }
811812fn is_relative_offset(self) -> bool {
813if true {
{
match (&self.kind(), &SpanKind::Indirect) {
(left_val, right_val) => {
if !(*left_val == *right_val) {
let kind = ::core::panicking::AssertKind::Eq;
::core::panicking::assert_failed(kind, &*left_val,
&*right_val, ::core::option::Option::None);
}
}
}
};
};debug_assert_eq!(self.kind(), SpanKind::Indirect);
814self.0 & 0b100 != 0
815}
816817fn context(self) -> Option<rustc_span::SyntaxContext> {
818if self.0 & 0b100 != 0 { Some(rustc_span::SyntaxContext::root()) } else { None }
819 }
820821fn length(self) -> Option<rustc_span::BytePos> {
822let all_1s_len = (0xffu8 << 3) >> 3;
823let len = self.0 >> 3;
824if len != all_1s_len { Some(rustc_span::BytePos(u32::from(len))) } else { None }
825 }
826}
827828// Tags for encoding Symbol's
829const SYMBOL_STR: u8 = 0;
830const SYMBOL_OFFSET: u8 = 1;
831const SYMBOL_PREDEFINED: u8 = 2;
832833pub fn provide(providers: &mut Providers) {
834 encoder::provide(&mut providers.queries);
835 decoder::provide(providers);
836}