]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/context.rs
report kind of deprecated item in message
[rust.git] / src / librustc_lint / context.rs
index edbeea6db41cdbb2b5859bca9735a51203538270..31d30a264a59ed57c193ec36ffaa68f4332e63fe 100644 (file)
@@ -394,8 +394,11 @@ fn check_tool_name_for_backwards_compat(
                     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)
                 }
@@ -428,11 +431,11 @@ pub struct LateContext<'tcx> {
     /// 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>,
@@ -570,7 +573,7 @@ fn lookup_with_diagnostics(
                     }
                 }
                 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");
@@ -674,35 +677,35 @@ fn lookup<S: Into<MultiSpan>>(
 }
 
 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)),
         }
     }