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.
This commit is contained in:
Dylan DPC 2022-06-02 11:13:21 +02:00 committed by GitHub
commit ddc5d2c9d2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -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> {

View file

@ -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)]