Rollup merge of #113832 - WaffleLapkin:track_lint_caller, r=compiler-errors
Add `#[track_caller]` to lint related diagnostic functions This fixes locations reported by `-Ztrack-diagnostics`.
This commit is contained in:
commit
4bbd7818b5
4 changed files with 19 additions and 0 deletions
|
@ -278,6 +278,7 @@ pub fn explain_lint_level_source(
|
|||
/// // ^^^^^^^^^^^^^^^^^^^^^ returns `&mut DiagnosticBuilder` by default
|
||||
/// )
|
||||
/// ```
|
||||
#[track_caller]
|
||||
pub fn struct_lint_level(
|
||||
sess: &Session,
|
||||
lint: &'static Lint,
|
||||
|
@ -291,6 +292,7 @@ pub fn struct_lint_level(
|
|||
) {
|
||||
// Avoid codegen bloat from monomorphization by immediately doing dyn dispatch of `decorate` to
|
||||
// the "real" work.
|
||||
#[track_caller]
|
||||
fn struct_lint_level_impl(
|
||||
sess: &Session,
|
||||
lint: &'static Lint,
|
||||
|
|
|
@ -1860,6 +1860,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
/// Emit a lint at `span` from a lint struct (some type that implements `DecorateLint`,
|
||||
/// typically generated by `#[derive(LintDiagnostic)]`).
|
||||
#[track_caller]
|
||||
pub fn emit_spanned_lint(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
|
@ -1880,6 +1881,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn struct_span_lint_hir(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
|
@ -1896,6 +1898,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
|
||||
/// Emit a lint from a lint struct (some type that implements `DecorateLint`, typically
|
||||
/// generated by `#[derive(LintDiagnostic)]`).
|
||||
#[track_caller]
|
||||
pub fn emit_lint(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
|
@ -1911,6 +1914,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
///
|
||||
/// [`struct_lint_level`]: rustc_middle::lint::struct_lint_level#decorate-signature
|
||||
#[rustc_lint_diagnostics]
|
||||
#[track_caller]
|
||||
pub fn struct_lint_node(
|
||||
self,
|
||||
lint: &'static Lint,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue