Skip to content

Commit ddc5d2c

Browse files
authored
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.
2 parents fb19760 + c7db4b0 commit ddc5d2c

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

compiler/rustc_hir/src/def.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,10 @@ impl<Id> Res<Id> {
671671

672672
#[track_caller]
673673
pub fn expect_non_local<OtherId>(self) -> Res<OtherId> {
674-
self.map_id(|_| panic!("unexpected `Res::Local`"))
674+
self.map_id(
675+
#[track_caller]
676+
|_| panic!("unexpected `Res::Local`"),
677+
)
675678
}
676679

677680
pub fn macro_kind(self) -> Option<MacroKind> {

compiler/rustc_hir/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
44
55
#![feature(associated_type_defaults)]
6+
#![feature(closure_track_caller)]
67
#![feature(const_btree_new)]
78
#![feature(let_else)]
89
#![feature(once_cell)]

0 commit comments

Comments
 (0)