Struct rustc_metadata::rmeta::encoder::EncodeContext[−][src]

pub(super) struct EncodeContext<'a, 'tcx> {
    opaque: Encoder,
    tcx: TyCtxt<'tcx>,
    feat: &'tcx Features,
    tables: TableBuilders<'tcx>,
    lazy_state: LazyState,
    type_shorthands: FxHashMap<Ty<'tcx>, usize>,
    predicate_shorthands: FxHashMap<PredicateKind<'tcx>, usize>,
    interpret_allocs: FxIndexSet<AllocId>,
    source_file_cache: (Lrc<SourceFile>, usize),
    required_source_files: Option<GrowableBitSet<usize>>,
    is_proc_macro: bool,
    hygiene_ctxt: &'a HygieneEncodeContext,
}

Fields

opaque: Encodertcx: TyCtxt<'tcx>feat: &'tcx Featurestables: TableBuilders<'tcx>lazy_state: LazyStatetype_shorthands: FxHashMap<Ty<'tcx>, usize>predicate_shorthands: FxHashMap<PredicateKind<'tcx>, usize>interpret_allocs: FxIndexSet<AllocId>source_file_cache: (Lrc<SourceFile>, usize)required_source_files: Option<GrowableBitSet<usize>>is_proc_macro: boolhygiene_ctxt: &'a HygieneEncodeContext

Implementations

impl<'a, 'tcx> EncodeContext<'a, 'tcx>[src]

fn emit_lazy_distance<T: ?Sized + LazyMeta>(
    &mut self,
    lazy: Lazy<T>
) -> Result<(), !>
[src]

fn lazy<T: ?Sized + LazyMeta>(
    &mut self,
    value: impl EncodeContentsForLazy<'a, 'tcx, T>
) -> Lazy<T>
[src]

fn encode_info_for_items(&mut self)[src]

fn encode_def_path_table(&mut self)[src]

fn encode_source_map(&mut self) -> Lazy<[SourceFile]>[src]

fn encode_crate_root(&mut self) -> Lazy<CrateRoot<'tcx>>[src]

impl<'a, 'tcx> EncodeContext<'a, 'tcx>[src]

fn encode_def_ids(&mut self)[src]

fn encode_item_type(&mut self, def_id: DefId)[src]

fn encode_enum_variant_info(&mut self, def: &AdtDef, index: VariantIdx)[src]

fn encode_enum_variant_ctor(&mut self, def: &AdtDef, index: VariantIdx)[src]

fn encode_info_for_mod(&mut self, local_def_id: LocalDefId, md: &Mod<'_>)[src]

fn encode_field(
    &mut self,
    adt_def: &AdtDef,
    variant_index: VariantIdx,
    field_index: usize
)
[src]

fn encode_struct_ctor(&mut self, adt_def: &AdtDef, def_id: DefId)[src]

fn encode_explicit_item_bounds(&mut self, def_id: DefId)[src]

fn encode_info_for_trait_item(&mut self, def_id: DefId)[src]

fn encode_info_for_impl_item(&mut self, def_id: DefId)[src]

fn encode_fn_param_names_for_body(&mut self, body_id: BodyId) -> Lazy<[Ident]>[src]

fn encode_fn_param_names(&mut self, param_names: &[Ident]) -> Lazy<[Ident]>[src]

fn encode_mir(&mut self)[src]

fn encode_stability(&mut self, def_id: DefId)[src]

fn encode_const_stability(&mut self, def_id: DefId)[src]

fn encode_deprecation(&mut self, def_id: DefId)[src]

fn encode_rendered_const_for_body(
    &mut self,
    body_id: BodyId
) -> Lazy<RenderedConst>
[src]

fn encode_info_for_item(&mut self, def_id: DefId, item: &'tcx Item<'tcx>)[src]

fn encode_info_for_macro_def(&mut self, macro_def: &MacroDef<'_>)[src]

Serialize the text of exported macros

fn encode_info_for_generic_param(
    &mut self,
    def_id: DefId,
    kind: EntryKind,
    encode_type: bool
)
[src]

fn encode_info_for_closure(&mut self, def_id: LocalDefId)[src]

fn encode_info_for_anon_const(&mut self, def_id: LocalDefId)[src]

fn encode_native_libraries(&mut self) -> Lazy<[NativeLib]>[src]

fn encode_foreign_modules(&mut self) -> Lazy<[ForeignModule]>[src]

fn encode_hygiene(
    &mut self
) -> (Lazy<Table<u32, Lazy<SyntaxContextData>>>, Lazy<Table<u32, Lazy<ExpnData>>>)
[src]

fn encode_proc_macros(&mut self) -> Option<ProcMacroData>[src]

fn encode_crate_deps(&mut self) -> Lazy<[CrateDep]>[src]

fn encode_lib_features(&mut self) -> Lazy<[(Symbol, Option<Symbol>)]>[src]

fn encode_diagnostic_items(&mut self) -> Lazy<[(Symbol, DefIndex)]>[src]

fn encode_lang_items(&mut self) -> Lazy<[(DefIndex, usize)]>[src]

fn encode_lang_items_missing(&mut self) -> Lazy<[LangItem]>[src]

fn encode_impls(&mut self) -> Lazy<[TraitImpls]>[src]

Encodes an index, mapping each trait to its (local) implementations.

fn encode_exported_symbols(
    &mut self,
    exported_symbols: &[(ExportedSymbol<'tcx>, SymbolExportLevel)]
) -> Lazy<[(ExportedSymbol<'tcx>, SymbolExportLevel)]>
[src]

fn encode_dylib_dependency_formats(
    &mut self
) -> Lazy<[Option<LinkagePreference>]>
[src]

fn encode_info_for_foreign_item(
    &mut self,
    def_id: DefId,
    nitem: &ForeignItem<'_>
)
[src]

impl<'a, 'tcx> EncodeContext<'a, 'tcx>[src]

fn encode_fields(&mut self, adt_def: &AdtDef)[src]

fn encode_info_for_generics(&mut self, generics: &Generics<'tcx>)[src]

fn encode_info_for_expr(&mut self, expr: &Expr<'_>)[src]

fn encode_ident_span(&mut self, def_id: DefId, ident: Ident)[src]

fn encode_addl_info_for_item(&mut self, item: &Item<'_>)[src]

In some cases, along with the item itself, we also encode some sub-items. Usually we want some info from the item so it’s easier to do that here then to wait until we would encounter normally in the visitor walk.

Trait Implementations

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for ProcMacroData[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for CrateRoot<'tcx>[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for TraitImpls[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for LazyTables<'tcx>[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for EntryKind[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for ModData[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for FnData[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for AssocFnData[src]

fn encode(&self, __encoder: &mut EncodeContext<'__a, 'tcx>) -> Result<(), !>[src]

impl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<T>[src]

fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult[src]

impl<'a, 'tcx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<[T]>[src]

fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult[src]

impl<'a, 'tcx, I: Idx, T: Encodable<EncodeContext<'a, 'tcx>>> Encodable<EncodeContext<'a, 'tcx>> for Lazy<Table<I, T>> where
    Option<T>: FixedSizeEncoding, 
[src]

fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) -> EncodeResult[src]

impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx>[src]

type Error = !

fn emit_unit(&mut self) -> Result<(), Self::Error>[src]

fn emit_usize(&mut self, value: usize) -> Result<(), Self::Error>[src]

fn emit_u128(&mut self, value: u128) -> Result<(), Self::Error>[src]

fn emit_u64(&mut self, value: u64) -> Result<(), Self::Error>[src]

fn emit_u32(&mut self, value: u32) -> Result<(), Self::Error>[src]

fn emit_u16(&mut self, value: u16) -> Result<(), Self::Error>[src]

fn emit_u8(&mut self, value: u8) -> Result<(), Self::Error>[src]

fn emit_isize(&mut self, value: isize) -> Result<(), Self::Error>[src]

fn emit_i128(&mut self, value: i128) -> Result<(), Self::Error>[src]

fn emit_i64(&mut self, value: i64) -> Result<(), Self::Error>[src]

fn emit_i32(&mut self, value: i32) -> Result<(), Self::Error>[src]

fn emit_i16(&mut self, value: i16) -> Result<(), Self::Error>[src]

fn emit_i8(&mut self, value: i8) -> Result<(), Self::Error>[src]

fn emit_bool(&mut self, value: bool) -> Result<(), Self::Error>[src]

fn emit_f64(&mut self, value: f64) -> Result<(), Self::Error>[src]

fn emit_f32(&mut self, value: f32) -> Result<(), Self::Error>[src]

fn emit_char(&mut self, value: char) -> Result<(), Self::Error>[src]

fn emit_str(&mut self, value: &str) -> Result<(), Self::Error>[src]

fn emit_raw_bytes(&mut self, value: &[u8]) -> Result<(), Self::Error>[src]

fn emit_enum<F>(&mut self, _name: &str, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_enum_variant<F>(
    &mut self,
    _v_name: &str,
    v_id: usize,
    _len: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_enum_variant_arg<F>(
    &mut self,
    _a_idx: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_enum_struct_variant<F>(
    &mut self,
    v_name: &str,
    v_id: usize,
    len: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_enum_struct_variant_field<F>(
    &mut self,
    _f_name: &str,
    f_idx: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_struct<F>(
    &mut self,
    _name: &str,
    _len: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_struct_field<F>(
    &mut self,
    _f_name: &str,
    _f_idx: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_tuple<F>(&mut self, _len: usize, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_tuple_arg<F>(&mut self, _idx: usize, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_tuple_struct<F>(
    &mut self,
    _name: &str,
    len: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_tuple_struct_arg<F>(
    &mut self,
    f_idx: usize,
    f: F
) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_option<F>(&mut self, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_option_none(&mut self) -> Result<(), Self::Error>[src]

fn emit_option_some<F>(&mut self, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_seq<F>(&mut self, len: usize, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_seq_elt<F>(&mut self, _idx: usize, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_map<F>(&mut self, len: usize, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_map_elt_key<F>(&mut self, _idx: usize, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

fn emit_map_elt_val<F>(&mut self, _idx: usize, f: F) -> Result<(), Self::Error> where
    F: FnOnce(&mut Self) -> Result<(), Self::Error>, 
[src]

impl<'a, 'tcx> TyEncoder<'tcx> for EncodeContext<'a, 'tcx>[src]

const CLEAR_CROSS_CRATE: bool[src]

fn position(&self) -> usize[src]

fn type_shorthands(&mut self) -> &mut FxHashMap<Ty<'tcx>, usize>[src]

fn predicate_shorthands(&mut self) -> &mut FxHashMap<PredicateKind<'tcx>, usize>[src]

fn encode_alloc_id(&mut self, alloc_id: &AllocId) -> Result<(), Self::Error>[src]

impl<'tcx, 'a> Visitor<'tcx> for EncodeContext<'a, 'tcx>[src]

type Map = Map<'tcx>

fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map>[src]

The default versions of the visit_nested_XXX routines invoke this method to get a map to use. By selecting an enum variant, you control which kinds of nested HIR are visited; see NestedVisitorMap for details. By “nested HIR”, we are referring to bits of HIR that are not directly embedded within one another but rather indirectly, through a table in the crate. This is done to control dependencies during incremental compilation: the non-inline bits of HIR can be tracked and hashed separately. Read more

fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>)[src]

fn visit_anon_const(&mut self, c: &'tcx AnonConst)[src]

fn visit_item(&mut self, item: &'tcx Item<'tcx>)[src]

Visits the top-level item and (optionally) nested items / impl items. See visit_nested_item for details. Read more

fn visit_foreign_item(&mut self, ni: &'tcx ForeignItem<'tcx>)[src]

fn visit_generics(&mut self, generics: &'tcx Generics<'tcx>)[src]

fn visit_macro_def(&mut self, macro_def: &'tcx MacroDef<'tcx>)[src]

fn visit_nested_item(&mut self, id: ItemId)[src]

Invoked when a nested item is encountered. By default does nothing unless you override nested_visit_map to return other than None, in which case it will walk the item. You probably don’t want to override this method – instead, override nested_visit_map or use the “shallow” or “deep” visit patterns described on itemlikevisit::ItemLikeVisitor. The only reason to override this method is if you want a nested pattern but cannot supply a Map; see nested_visit_map for advice. Read more

fn visit_nested_trait_item(&mut self, id: TraitItemId)[src]

Like visit_nested_item(), but for trait items. See visit_nested_item() for advice on when to override this method. Read more

fn visit_nested_impl_item(&mut self, id: ImplItemId)[src]

Like visit_nested_item(), but for impl items. See visit_nested_item() for advice on when to override this method. Read more

fn visit_nested_foreign_item(&mut self, id: ForeignItemId)[src]

Like visit_nested_item(), but for foreign items. See visit_nested_item() for advice on when to override this method. Read more

fn visit_nested_body(&mut self, id: BodyId)[src]

Invoked to visit the body of a function, method or closure. Like visit_nested_item, does nothing by default unless you override nested_visit_map to return other than None, in which case it will walk the body. Read more

fn visit_param(&mut self, param: &'v Param<'v>)[src]

fn visit_body(&mut self, b: &'v Body<'v>)[src]

fn as_deep_visitor(&mut self) -> DeepVisitor<'_, Self>[src]

When invoking visit_all_item_likes(), you need to supply an item-like visitor. This method converts a “intra-visit” visitor into an item-like visitor that walks the entire tree. If you use this, you probably don’t want to process the contents of nested item-like things, since the outer loop will visit them as well. Read more

fn visit_id(&mut self, _hir_id: HirId)[src]

fn visit_name(&mut self, _span: Span, _name: Symbol)[src]

fn visit_ident(&mut self, ident: Ident)[src]

fn visit_mod(&mut self, m: &'v Mod<'v>, _s: Span, n: HirId)[src]

fn visit_local(&mut self, l: &'v Local<'v>)[src]

fn visit_block(&mut self, b: &'v Block<'v>)[src]

fn visit_stmt(&mut self, s: &'v Stmt<'v>)[src]

fn visit_arm(&mut self, a: &'v Arm<'v>)[src]

fn visit_pat(&mut self, p: &'v Pat<'v>)[src]

fn visit_ty(&mut self, t: &'v Ty<'v>)[src]

fn visit_generic_param(&mut self, p: &'v GenericParam<'v>)[src]

fn visit_const_param_default(&mut self, _param: HirId, ct: &'v AnonConst)[src]

fn visit_where_predicate(&mut self, predicate: &'v WherePredicate<'v>)[src]

fn visit_fn_decl(&mut self, fd: &'v FnDecl<'v>)[src]

fn visit_fn(
    &mut self,
    fk: FnKind<'v>,
    fd: &'v FnDecl<'v>,
    b: BodyId,
    s: Span,
    id: HirId
)
[src]

fn visit_use(&mut self, path: &'v Path<'v>, hir_id: HirId)[src]

fn visit_trait_item(&mut self, ti: &'v TraitItem<'v>)[src]

fn visit_trait_item_ref(&mut self, ii: &'v TraitItemRef)[src]

fn visit_impl_item(&mut self, ii: &'v ImplItem<'v>)[src]

fn visit_foreign_item_ref(&mut self, ii: &'v ForeignItemRef<'v>)[src]

fn visit_impl_item_ref(&mut self, ii: &'v ImplItemRef<'v>)[src]

fn visit_trait_ref(&mut self, t: &'v TraitRef<'v>)[src]

fn visit_param_bound(&mut self, bounds: &'v GenericBound<'v>)[src]

fn visit_poly_trait_ref(
    &mut self,
    t: &'v PolyTraitRef<'v>,
    m: TraitBoundModifier
)
[src]

fn visit_variant_data(
    &mut self,
    s: &'v VariantData<'v>,
    Symbol,
    &'v Generics<'v>,
    _parent_id: HirId,
    Span
)
[src]

fn visit_field_def(&mut self, s: &'v FieldDef<'v>)[src]

fn visit_enum_def(
    &mut self,
    enum_definition: &'v EnumDef<'v>,
    generics: &'v Generics<'v>,
    item_id: HirId,
    Span
)
[src]

fn visit_variant(
    &mut self,
    v: &'v Variant<'v>,
    g: &'v Generics<'v>,
    item_id: HirId
)
[src]

fn visit_label(&mut self, label: &'v Label)[src]

fn visit_generic_arg(&mut self, generic_arg: &'v GenericArg<'v>)[src]

fn visit_lifetime(&mut self, lifetime: &'v Lifetime)[src]

fn visit_qpath(&mut self, qpath: &'v QPath<'v>, id: HirId, span: Span)[src]

fn visit_path(&mut self, path: &'v Path<'v>, _id: HirId)[src]

fn visit_path_segment(
    &mut self,
    path_span: Span,
    path_segment: &'v PathSegment<'v>
)
[src]

fn visit_generic_args(
    &mut self,
    path_span: Span,
    generic_args: &'v GenericArgs<'v>
)
[src]

fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding<'v>)[src]

fn visit_attribute(&mut self, _id: HirId, _attr: &'v Attribute)[src]

fn visit_vis(&mut self, vis: &'v Spanned<VisibilityKind<'v>>)[src]

fn visit_associated_item_kind(&mut self, kind: &'v AssocItemKind)[src]

fn visit_defaultness(&mut self, defaultness: &'v Defaultness)[src]

Auto Trait Implementations

impl<'a, 'tcx> !RefUnwindSafe for EncodeContext<'a, 'tcx>

impl<'a, 'tcx> !Send for EncodeContext<'a, 'tcx>

impl<'a, 'tcx> !Sync for EncodeContext<'a, 'tcx>

impl<'a, 'tcx> Unpin for EncodeContext<'a, 'tcx>

impl<'a, 'tcx> !UnwindSafe for EncodeContext<'a, 'tcx>

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized, 
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized, 
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<'a, T> Captures<'a> for T where
    T: ?Sized, 
[src]