Skip to content

Commit 923e3d2

Browse files
committed
Auto merge of #80500 - jyn514:track-caller, r=nagisa
Add `#[track_caller]` to `bug!` and `register_renamed` Before: ``` thread 'rustc' panicked at 'compiler/rustc_lint/src/context.rs:267:18: invalid lint renaming of broken_intra_doc_links to rustdoc::broken_intra_doc_links', compiler/rustc_middle/src/util/bug.rs:34:26 ``` After: ``` thread 'rustc' panicked at 'src/librustdoc/core.rs:455:24: invalid lint renaming of broken_intra_doc_links to rustdoc::broken_intra_doc_links', compiler/rustc_middle/src/util/bug.rs:35:26 ``` The reason I added it to `register_renamed` too is that any panic in that function will be the caller's fault.
2 parents f0073a5 + 56ea926 commit 923e3d2

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

compiler/rustc_lint/src/context.rs

+1
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ impl LintStore {
261261
}
262262
}
263263

264+
#[track_caller]
264265
pub fn register_renamed(&mut self, old_name: &str, new_name: &str) {
265266
let target = match self.by_name.get(new_name) {
266267
Some(&Id(lint_id)) => lint_id,

compiler/rustc_middle/src/util/bug.rs

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn span_bug_fmt<S: Into<MultiSpan>>(span: S, args: fmt::Arguments<'_>) -> !
2121
opt_span_bug_fmt(Some(span), args, Location::caller());
2222
}
2323

24+
#[track_caller]
2425
fn opt_span_bug_fmt<S: Into<MultiSpan>>(
2526
span: Option<S>,
2627
args: fmt::Arguments<'_>,

0 commit comments

Comments
 (0)