Skip to content
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

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

WaffleLapkin
Copy link
Member

This fixes locations reported by -Ztrack-diagnostics.

Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

@compiler-errors
Copy link
Member

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(
Copy link
Member Author

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]...

Copy link
Member

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.

Copy link
Member

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.

@WaffleLapkin
Copy link
Member Author

@bors r=compiler-errors rollup

@bors
Copy link
Contributor

bors commented Jul 18, 2023

📌 Commit 3dd5413 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Jul 18, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 18, 2023
…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
@bors bors merged commit 4bbd781 into rust-lang:master Jul 18, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants