Skip to content

Commit 4b7c8b0

Browse files
committed
Add #[track_caller] to FakeDefId::expect_real()
Now, in the case that the function is not inlined, the panic location will be the caller's location, which is more helpful since the panic is not `expect_real()`'s fault.
1 parent ba13225 commit 4b7c8b0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/librustdoc/clean/types.rs

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ impl FakeDefId {
8686
}
8787

8888
#[inline]
89+
#[track_caller]
8990
crate fn expect_real(self) -> rustc_hir::def_id::DefId {
9091
self.as_real().unwrap_or_else(|| panic!("FakeDefId::expect_real: `{:?}` isn't real", self))
9192
}

0 commit comments

Comments
 (0)