diff options
| author | Camelid <camelidcamel@gmail.com> | 2021-05-08 15:14:21 -0700 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2021-05-08 15:35:44 -0700 |
| commit | 4b7c8b0b53c2bea54e9cd029c68ebdc6f668b1b8 (patch) | |
| tree | 385715a68803d95420d07652fc14f3347faa2ff2 | |
| parent | ba13225ba1e3e94b5656181926cd38750eed1503 (diff) | |
| download | rust-4b7c8b0b53c2bea54e9cd029c68ebdc6f668b1b8.tar.gz rust-4b7c8b0b53c2bea54e9cd029c68ebdc6f668b1b8.zip | |
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.
| -rw-r--r-- | src/librustdoc/clean/types.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 550df203a9f..33aa42b137a 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -86,6 +86,7 @@ impl FakeDefId { } #[inline] + #[track_caller] crate fn expect_real(self) -> rustc_hir::def_id::DefId { self.as_real().unwrap_or_else(|| panic!("FakeDefId::expect_real: `{:?}` isn't real", self)) } |
