-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add #[track_caller]
to lint related diagnostic functions
#113832
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
we also have some macros that reexport fns from Diagnostic to DiagnosticBuilder (or vice versa? can't remember) those may need annotation too |
@@ -1028,6 +1030,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> { | |||
struct_lint_level(self.sess, lint, level, src, span, msg, decorate) | |||
} | |||
|
|||
#[track_caller] | |||
pub fn emit_spanned_lint( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this and similar have #[rustc_lint_diagnostics]
also? it seems like there are a lot of lint-related diagnostic functions without #[rustc_lint_diagnostics]
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't matter, I don't even know if they trigger -Ztreat-err-as-bug
which is presumably one of the main usages of tracking caller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edit: im dumb
rustc_lint_diagnostics
shouldn't matter, ideally you'd add that to all the fns that we should deny outside of translatable diagnostics derives but that should be in a separate pr.
@bors r=compiler-errors rollup |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#113811 (Fix removal span calculation of `unused_qualifications` suggestion) - rust-lang#113812 (docs(release): Remove nightly-only cargo item) - rust-lang#113823 (Fix results search alias display) - rust-lang#113824 (a small `fn needs_drop` refactor) - rust-lang#113828 (Ping spastorino on changes to SMIR) - rust-lang#113832 (Add `#[track_caller]` to lint related diagnostic functions) r? `@ghost` `@rustbot` modify labels: rollup
This fixes locations reported by
-Ztrack-diagnostics
.