Skip to content

Commit

Permalink
Lint against usages of struct_span_lint_hir.
Browse files Browse the repository at this point in the history
  • Loading branch information
crlf0710 committed Oct 29, 2022
1 parent 33b55ac commit 3b6b604
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion compiler/rustc_middle/src/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2819,7 +2819,9 @@ impl<'tcx> TyCtxt<'tcx> {
span: impl Into<MultiSpan>,
decorator: impl for<'a> DecorateLint<'a, ()>,
) {
self.struct_span_lint_hir(lint, hir_id, span, decorator.msg(), |diag| {
let msg = decorator.msg();
let (level, src) = self.lint_level_at_node(lint, hir_id);
struct_lint_level(self.sess, lint, level, src, Some(span.into()), msg, |diag| {
decorator.decorate_lint(diag)
})
}
Expand All @@ -2829,6 +2831,7 @@ impl<'tcx> TyCtxt<'tcx> {
/// Return value of the `decorate` closure is ignored, see [`struct_lint_level`] for a detailed explanation.
///
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
#[rustc_lint_diagnostics]
pub fn struct_span_lint_hir(
self,
lint: &'static Lint,
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_passes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
//! This API is completely unstable and subject to change.

#![allow(rustc::potential_query_instability)]
#![deny(rustc::untranslatable_diagnostic)]
#![deny(rustc::diagnostic_outside_of_impl)]
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(iter_intersperse)]
#![feature(let_chains)]
Expand Down

0 comments on commit 3b6b604

Please sign in to comment.