diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-06-02 11:13:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-02 11:13:21 +0200 |
| commit | ddc5d2c9d2c0d100707666d5f2168ccc0dab40ed (patch) | |
| tree | 9c98ef8da4bebc5523f390519c4dedb6b4d2af79 | |
| parent | fb1976011e3df96b5d3eccd6b2f4e51ef7dc8f16 (diff) | |
| parent | c7db4b08fff9591adb2c7a66d5f81ce685655622 (diff) | |
| download | rust-ddc5d2c9d2c0d100707666d5f2168ccc0dab40ed.tar.gz rust-ddc5d2c9d2c0d100707666d5f2168ccc0dab40ed.zip | |
Rollup merge of #96894 - JohnTitor:expect-non-local-track-caller, r=petrochenkov
Apply track_caller to closure on `expect_non_local()` r? `@petrochenkov` Alternatively we could remove the closure by replicating the same logic of `map_id()`. I'm happy to switch to it if you'd like.
| -rw-r--r-- | compiler/rustc_hir/src/def.rs | 5 | ||||
| -rw-r--r-- | compiler/rustc_hir/src/lib.rs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_hir/src/def.rs b/compiler/rustc_hir/src/def.rs index 68876e89c4b..414f6272591 100644 --- a/compiler/rustc_hir/src/def.rs +++ b/compiler/rustc_hir/src/def.rs @@ -671,7 +671,10 @@ impl<Id> Res<Id> { #[track_caller] pub fn expect_non_local<OtherId>(self) -> Res<OtherId> { - self.map_id(|_| panic!("unexpected `Res::Local`")) + self.map_id( + #[track_caller] + |_| panic!("unexpected `Res::Local`"), + ) } pub fn macro_kind(self) -> Option<MacroKind> { diff --git a/compiler/rustc_hir/src/lib.rs b/compiler/rustc_hir/src/lib.rs index 7833571f88d..d845c433d8c 100644 --- a/compiler/rustc_hir/src/lib.rs +++ b/compiler/rustc_hir/src/lib.rs @@ -3,6 +3,7 @@ //! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html #![feature(associated_type_defaults)] +#![feature(closure_track_caller)] #![feature(const_btree_new)] #![feature(let_else)] #![feature(once_cell)] |
