Rollup merge of #96747 - JohnTitor:expect-local-track-caller, r=compiler-errors
Add `track_caller` to `DefId::expect_local()` Suggested in https://github.com/rust-lang/rust/issues/96738#issuecomment-1118961888. `DefId::expect_local()` often causes ICEs (panics) and should be a good candidate to add `track_caller`.
This commit is contained in:
commit
b8c829b64f
@ -279,6 +279,7 @@ impl DefId {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[track_caller]
|
||||
pub fn expect_local(self) -> LocalDefId {
|
||||
self.as_local().unwrap_or_else(|| panic!("DefId::expect_local: `{:?}` isn't local", self))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user