diff options
| author | Michael Goulet <michael@errs.io> | 2022-05-05 19:34:27 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-05-05 19:34:27 -0700 |
| commit | b8c829b64f6b95f89bff9b953c4eeb2bf8e8695b (patch) | |
| tree | 5fd47fc0450fa4c56ecc7e0c7c3ef43dcac3cce0 | |
| parent | 8bcf4b0efc3a11cc4745e128f237392387300e93 (diff) | |
| parent | 2ed38cdbdd3670790aaf3d48ab2bbdf10dad290b (diff) | |
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`.
| -rw-r--r-- | compiler/rustc_span/src/def_id.rs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/def_id.rs b/compiler/rustc_span/src/def_id.rs index d5f806308cf..6b529d5e083 100644 --- a/compiler/rustc_span/src/def_id.rs +++ b/compiler/rustc_span/src/def_id.rs @@ -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)) } |
