let symbols =
self.by_name.keys().map(|name| Symbol::intern(&name)).collect::<Vec<_>>();
- let suggestion =
- find_best_match_for_name(symbols.iter(), &lint_name.to_lowercase(), None);
+ let suggestion = find_best_match_for_name(
+ symbols.iter(),
+ Symbol::intern(&lint_name.to_lowercase()),
+ None,
+ );
CheckLintNameResult::NoLint(suggestion)
}
/// Current body, or `None` if outside a body.
pub enclosing_body: Option<hir::BodyId>,
- /// Type-checking side-tables for the current body. Access using the `tables`
- /// and `maybe_tables` methods, which handle querying the tables on demand.
+ /// Type-checking results for the current body. Access using the `typeck_results`
+ /// and `maybe_typeck_results` methods, which handle querying the typeck results on demand.
// FIXME(eddyb) move all the code accessing internal fields like this,
// to this module, to avoid exposing it to lint logic.
- pub(super) cached_typeck_tables: Cell<Option<&'tcx ty::TypeckTables<'tcx>>>,
+ pub(super) cached_typeck_results: Cell<Option<&'tcx ty::TypeckResults<'tcx>>>,
/// Parameter environment for the item we are in.
pub param_env: ty::ParamEnv<'tcx>,
}
}
BuiltinLintDiagnostics::DeprecatedMacro(suggestion, span) => {
- stability::deprecation_suggestion(&mut db, suggestion, span)
+ stability::deprecation_suggestion(&mut db, "macro", suggestion, span)
}
BuiltinLintDiagnostics::UnusedDocComment(span) => {
db.span_label(span, "rustdoc does not generate documentation for macro invocations");
}
impl<'tcx> LateContext<'tcx> {
- /// Gets the type-checking side-tables for the current body,
+ /// Gets the type-checking results for the current body,
/// or `None` if outside a body.
- pub fn maybe_typeck_tables(&self) -> Option<&'tcx ty::TypeckTables<'tcx>> {
- self.cached_typeck_tables.get().or_else(|| {
+ pub fn maybe_typeck_results(&self) -> Option<&'tcx ty::TypeckResults<'tcx>> {
+ self.cached_typeck_results.get().or_else(|| {
self.enclosing_body.map(|body| {
- let tables = self.tcx.body_tables(body);
- self.cached_typeck_tables.set(Some(tables));
- tables
+ let typeck_results = self.tcx.typeck_body(body);
+ self.cached_typeck_results.set(Some(typeck_results));
+ typeck_results
})
})
}
- /// Gets the type-checking side-tables for the current body.
+ /// 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).
#[track_caller]
- pub fn tables(&self) -> &'tcx ty::TypeckTables<'tcx> {
- self.maybe_typeck_tables().expect("`LateContext::tables` called outside of body")
+ pub fn typeck_results(&self) -> &'tcx ty::TypeckResults<'tcx> {
+ self.maybe_typeck_results().expect("`LateContext::typeck_results` called outside of body")
}
/// Returns the final resolution of a `QPath`, or `Res::Err` if unavailable.
- /// Unlike `.tables().qpath_res(qpath, id)`, this can be used even outside
+ /// Unlike `.typeck_results().qpath_res(qpath, id)`, this can be used even outside
/// bodies (e.g. for paths in `hir::Ty`), without any risk of ICE-ing.
pub fn qpath_res(&self, qpath: &hir::QPath<'_>, id: hir::HirId) -> Res {
match *qpath {
hir::QPath::Resolved(_, ref path) => path.res,
hir::QPath::TypeRelative(..) => self
- .maybe_typeck_tables()
- .and_then(|tables| tables.type_dependent_def(id))
+ .maybe_typeck_results()
+ .and_then(|typeck_results| typeck_results.type_dependent_def(id))
.map_or(Res::Err, |(kind, def_id)| Res::Def(kind, def_id)),
}
}