Struct rustc_save_analysis::SaveContext
source · pub struct SaveContext<'tcx> {
pub(crate) tcx: TyCtxt<'tcx>,
pub(crate) maybe_typeck_results: Option<&'tcx TypeckResults<'tcx>>,
pub(crate) effective_visibilities: &'tcx EffectiveVisibilities,
pub(crate) span_utils: SpanUtils<'tcx>,
pub(crate) config: Config,
pub(crate) impl_counter: Cell<u32>,
}
Fields§
§tcx: TyCtxt<'tcx>
§maybe_typeck_results: Option<&'tcx TypeckResults<'tcx>>
§effective_visibilities: &'tcx EffectiveVisibilities
§span_utils: SpanUtils<'tcx>
§config: Config
§impl_counter: Cell<u32>
Implementations§
source§impl<'tcx> SaveContext<'tcx>
impl<'tcx> SaveContext<'tcx>
sourcepub(crate) fn typeck_results(&self) -> &'tcx TypeckResults<'tcx>
pub(crate) fn typeck_results(&self) -> &'tcx TypeckResults<'tcx>
Gets the type-checking results for the current body.
As this will ICE if called outside bodies, only call when working with
Expr
or Pat
nodes (they are guaranteed to be found only in bodies).
pub(crate) fn span_from_span(&self, span: Span) -> SpanData
sourcepub fn compilation_output(&self, crate_name: Symbol) -> PathBuf
pub fn compilation_output(&self, crate_name: Symbol) -> PathBuf
Returns path to the compilation output (e.g., libfoo-12345678.rmeta)
sourcepub fn get_external_crates(&self) -> Vec<ExternalCrateData>
pub fn get_external_crates(&self) -> Vec<ExternalCrateData>
List external crates used by the current crate.
pub fn get_extern_item_data(&self, item: &ForeignItem<'_>) -> Option<Data>
pub fn get_item_data(&self, item: &Item<'_>) -> Option<Data>
pub fn get_field_data(&self, field: &FieldDef<'_>, scope: HirId) -> Option<Def>
pub fn get_method_data(
&self,
hir_id: HirId,
ident: Ident,
span: Span
) -> Option<Def>
pub fn get_expr_data(&self, expr: &Expr<'_>) -> Option<Data>
pub fn get_path_res(&self, hir_id: HirId) -> Res
pub fn get_path_data(&self, id: HirId, path: &QPath<'_>) -> Option<Ref>
pub fn get_path_segment_data(&self, path_seg: &PathSegment<'_>) -> Option<Ref>
pub fn get_path_segment_data_with_id(
&self,
path_seg: &PathSegment<'_>,
id: HirId
) -> Option<Ref>
pub fn get_field_ref_data(
&self,
field_ref: &ExprField<'_>,
variant: &VariantDef
) -> Option<Ref>
sourcepub(crate) fn get_macro_use_data(&self, span: Span) -> Option<MacroRef>
pub(crate) fn get_macro_use_data(&self, span: Span) -> Option<MacroRef>
Attempt to return MacroRef for any AST node.
For a given piece of AST defined by the supplied Span and NodeId,
returns None
if the node is not macro-generated or the span is malformed,
else uses the expansion callsite and callee to return some MacroRef.
FIXME: DumpVisitor::process_macro_use
should actually dump this data
pub(crate) fn lookup_def_id(&self, ref_id: HirId) -> Option<DefId>
pub(crate) fn docs_for_attrs(&self, attrs: &[Attribute]) -> String
pub(crate) fn next_impl_id(&self) -> u32
Auto Trait Implementations§
impl<'tcx> !RefUnwindSafe for SaveContext<'tcx>
impl<'tcx> !Send for SaveContext<'tcx>
impl<'tcx> !Sync for SaveContext<'tcx>
impl<'tcx> Unpin for SaveContext<'tcx>
impl<'tcx> !UnwindSafe for SaveContext<'tcx>
Blanket Implementations§
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference’s “Type Layout” chapter for details on type layout guarantees.
Size: 72 bytes