Struct rustc_trans::lint::LateContext
[−]
[src]
pub struct LateContext<'a, 'tcx> where 'tcx: 'a {
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub tables: &'a TypeckTables<'tcx>,
pub krate: &'a Crate,
pub access_levels: &'a AccessLevels<NodeId>,
// some fields omitted
}
rustc_private
)Context for lint checking after type checking.
Fields
tcx: TyCtxt<'a, 'tcx, 'tcx>
rustc_private
)Type context we're checking in.
tables: &'a TypeckTables<'tcx>
rustc_private
)Side-tables for the body we are in.
krate: &'a Crate
rustc_private
)The crate being checked.
access_levels: &'a AccessLevels<NodeId>
rustc_private
)Items accessible from the crate being checked.
Trait Implementations
impl<'a, 'tcx> LintContext<'tcx> for LateContext<'a, 'tcx>
[src]
fn sess(&self) -> &Session
rustc_private
)Get the overall compiler Session
object.
fn lints(&self) -> &LintStore
rustc_private
)fn mut_lints(&mut self) -> &mut LintStore
rustc_private
)fn level_stack(&mut self) -> &mut Vec<(LintId, (Level, LintSource))>
rustc_private
)fn enter_attrs(&mut self, attrs: &'tcx [Attribute])
rustc_private
)fn exit_attrs(&mut self, attrs: &'tcx [Attribute])
rustc_private
)fn current_level(&self, lint: &'static Lint) -> Level
rustc_private
)Get the level of lint
at the current position of the lint traversal. Read more
fn level_src(&self, lint: &'static Lint) -> Option<(Level, LintSource)>
rustc_private
)fn lookup_and_emit<S>(&self, lint: &'static Lint, span: Option<S>, msg: &str) where S: Into<MultiSpan>
rustc_private
)fn lookup<S>(&self,
lint: &'static Lint,
span: Option<S>,
msg: &str)
-> DiagnosticBuilder where S: Into<MultiSpan>
lint: &'static Lint,
span: Option<S>,
msg: &str)
-> DiagnosticBuilder where S: Into<MultiSpan>
rustc_private
)fn span_lint<S>(&self, lint: &'static Lint, span: S, msg: &str) where S: Into<MultiSpan>
rustc_private
)Emit a lint at the appropriate level, for a particular span.
fn early_lint(&self, early_lint: &EarlyLint)
rustc_private
)fn struct_span_lint<S>(&self,
lint: &'static Lint,
span: S,
msg: &str)
-> DiagnosticBuilder where S: Into<MultiSpan>
lint: &'static Lint,
span: S,
msg: &str)
-> DiagnosticBuilder where S: Into<MultiSpan>
rustc_private
)fn span_lint_note(&self,
lint: &'static Lint,
span: Span,
msg: &str,
note_span: Span,
note: &str)
lint: &'static Lint,
span: Span,
msg: &str,
note_span: Span,
note: &str)
rustc_private
)Emit a lint and note at the appropriate level, for a particular span.
fn span_lint_help(&self, lint: &'static Lint, span: Span, msg: &str, help: &str)
rustc_private
)Emit a lint and help at the appropriate level, for a particular span.
fn lint(&self, lint: &'static Lint, msg: &str)
rustc_private
)Emit a lint at the appropriate level, with no associated span.
fn with_lint_attrs<F>(&mut self, attrs: &'tcx [Attribute], f: F) where F: FnOnce(&mut Self) -> ()
rustc_private
)Merge the lints specified by any lint attributes into the current lint context, call the provided function, then reset the lints in effect to their previous state. Read more
impl<'a, 'tcx> Visitor<'tcx> for LateContext<'a, 'tcx>
[src]
fn nested_visit_map(&'this mut self) -> NestedVisitorMap<'this, 'tcx>
rustc_private
)Because lints are scoped lexically, we want to walk nested items in the context of the outer item, so enable deep-walking.
fn visit_id(&mut self, id: NodeId)
rustc_private
)fn visit_nested_body(&mut self, body: BodyId)
rustc_private
)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 Some(_)
, in which case it will walk the body. Read more
fn visit_body(&mut self, body: &'tcx Body)
rustc_private
)fn visit_item(&mut self, it: &'tcx Item)
rustc_private
)Visit the top-level item and (optionally) nested items / impl items. See visit_nested_item
for details. Read more
fn visit_foreign_item(&mut self, it: &'tcx ForeignItem)
rustc_private
)fn visit_pat(&mut self, p: &'tcx Pat)
rustc_private
)fn visit_expr(&mut self, e: &'tcx Expr)
rustc_private
)fn visit_stmt(&mut self, s: &'tcx Spanned<Stmt_>)
rustc_private
)fn visit_fn(&mut self,
fk: FnKind<'tcx>,
decl: &'tcx FnDecl,
body_id: BodyId,
span: Span,
id: NodeId)
fk: FnKind<'tcx>,
decl: &'tcx FnDecl,
body_id: BodyId,
span: Span,
id: NodeId)
rustc_private
)fn visit_variant_data(&mut self,
s: &'tcx VariantData,
name: Symbol,
g: &'tcx Generics,
item_id: NodeId,
Span)
s: &'tcx VariantData,
name: Symbol,
g: &'tcx Generics,
item_id: NodeId,
Span)
rustc_private
)fn visit_struct_field(&mut self, s: &'tcx StructField)
rustc_private
)fn visit_variant(&mut self,
v: &'tcx Spanned<Variant_>,
g: &'tcx Generics,
item_id: NodeId)
v: &'tcx Spanned<Variant_>,
g: &'tcx Generics,
item_id: NodeId)
rustc_private
)fn visit_ty(&mut self, t: &'tcx Ty)
rustc_private
)fn visit_name(&mut self, sp: Span, name: Symbol)
rustc_private
)fn visit_mod(&mut self, m: &'tcx Mod, s: Span, n: NodeId)
rustc_private
)fn visit_local(&mut self, l: &'tcx Local)
rustc_private
)fn visit_block(&mut self, b: &'tcx Block)
rustc_private
)fn visit_arm(&mut self, a: &'tcx Arm)
rustc_private
)fn visit_decl(&mut self, d: &'tcx Spanned<Decl_>)
rustc_private
)fn visit_generics(&mut self, g: &'tcx Generics)
rustc_private
)fn visit_trait_item(&mut self, trait_item: &'tcx TraitItem)
rustc_private
)fn visit_impl_item(&mut self, impl_item: &'tcx ImplItem)
rustc_private
)fn visit_lifetime(&mut self, lt: &'tcx Lifetime)
rustc_private
)fn visit_lifetime_def(&mut self, lt: &'tcx LifetimeDef)
rustc_private
)fn visit_path(&mut self, p: &'tcx Path, id: NodeId)
rustc_private
)fn visit_attribute(&mut self, attr: &'tcx Attribute)
rustc_private
)fn visit_nested_item(&mut self, id: ItemId)
rustc_private
)Invoked when a nested item is encountered. By default does nothing unless you override nested_visit_map
to return Some(_)
, 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)
rustc_private
)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)
rustc_private
)Like visit_nested_item()
, but for impl items. See visit_nested_item()
for advice on when to override this method. Read more
fn as_deep_visitor(&'s mut self) -> DeepVisitor<'s, Self>
rustc_private
)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_def_mention(&mut self, _def: Def)
rustc_private
)fn visit_where_predicate(&mut self, predicate: &'v WherePredicate)
rustc_private
)fn visit_fn_decl(&mut self, fd: &'v FnDecl)
rustc_private
)fn visit_trait_item_ref(&mut self, ii: &'v TraitItemRef)
rustc_private
)fn visit_impl_item_ref(&mut self, ii: &'v ImplItemRef)
rustc_private
)fn visit_trait_ref(&mut self, t: &'v TraitRef)
rustc_private
)fn visit_ty_param_bound(&mut self, bounds: &'v TyParamBound)
rustc_private
)fn visit_poly_trait_ref(&mut self, t: &'v PolyTraitRef, m: TraitBoundModifier)
rustc_private
)fn visit_enum_def(&mut self,
enum_definition: &'v EnumDef,
generics: &'v Generics,
item_id: NodeId,
Span)
enum_definition: &'v EnumDef,
generics: &'v Generics,
item_id: NodeId,
Span)
rustc_private
)fn visit_qpath(&mut self, qpath: &'v QPath, id: NodeId, span: Span)
rustc_private
)fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v PathSegment)
rustc_private
)fn visit_path_parameters(&mut self,
path_span: Span,
path_parameters: &'v PathParameters)
path_span: Span,
path_parameters: &'v PathParameters)
rustc_private
)fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding)
rustc_private
)fn visit_macro_def(&mut self, macro_def: &'v MacroDef)
rustc_private
)fn visit_vis(&mut self, vis: &'v Visibility)
rustc_private
)fn visit_associated_item_kind(&mut self, kind: &'v AssociatedItemKind)
rustc_private
)fn visit_defaultness(&mut self, defaultness: &'v Defaultness)
rustc_private
)