Skip to content

Commit 5a2fbcf

Browse files
Rollup merge of rust-lang#96747 - JohnTitor:expect-local-track-caller, r=compiler-errors
Add `track_caller` to `DefId::expect_local()` Suggested in rust-lang#96738 (comment). `DefId::expect_local()` often causes ICEs (panics) and should be a good candidate to add `track_caller`.
2 parents c5abe2d + 2ed38cd commit 5a2fbcf

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/rustc_span/src/def_id.rs

+1
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ impl DefId {
279279
}
280280

281281
#[inline]
282+
#[track_caller]
282283
pub fn expect_local(self) -> LocalDefId {
283284
self.as_local().unwrap_or_else(|| panic!("DefId::expect_local: `{:?}` isn't local", self))
284285
}

0 commit comments

Comments
 (0)