@@ -11,7 +11,7 @@ use rustc_ast::visit::{self, AssocCtxt, Visitor};
11
11
use rustc_errors:: struct_span_err;
12
12
use rustc_hir as hir;
13
13
use rustc_hir:: def:: { DefKind , Res } ;
14
- use rustc_hir:: def_id:: DefId ;
14
+ use rustc_hir:: def_id:: LocalDefId ;
15
15
use rustc_span:: source_map:: { respan, DesugaringKind } ;
16
16
use rustc_span:: symbol:: { kw, sym} ;
17
17
use rustc_span:: Span ;
@@ -269,7 +269,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
269
269
hir:: ItemKind :: Const ( ty, body_id)
270
270
}
271
271
ItemKind :: Fn ( _, FnSig { ref decl, header } , ref generics, ref body) => {
272
- let fn_def_id = self . resolver . definitions ( ) . local_def_id ( id) ;
272
+ let fn_def_id = self . resolver . definitions ( ) . local_def_id ( id) . expect_local ( ) ;
273
273
self . with_new_scopes ( |this| {
274
274
this. current_item = Some ( ident. span ) ;
275
275
@@ -287,7 +287,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
287
287
AnonymousLifetimeMode :: PassThrough ,
288
288
|this, idty| {
289
289
let ret_id = asyncness. opt_return_id ( ) ;
290
- this. lower_fn_decl ( & decl, Some ( ( fn_def_id, idty) ) , true , ret_id)
290
+ this. lower_fn_decl (
291
+ & decl,
292
+ Some ( ( fn_def_id. to_def_id ( ) , idty) ) ,
293
+ true ,
294
+ ret_id,
295
+ )
291
296
} ,
292
297
) ;
293
298
let sig = hir:: FnSig { decl, header : this. lower_fn_header ( header) } ;
@@ -351,7 +356,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
351
356
self_ty : ref ty,
352
357
items : ref impl_items,
353
358
} => {
354
- let def_id = self . resolver . definitions ( ) . local_def_id ( id) ;
359
+ let def_id = self . resolver . definitions ( ) . local_def_id ( id) . expect_local ( ) ;
355
360
356
361
// Lower the "impl header" first. This ordering is important
357
362
// for in-band lifetimes! Consider `'a` here:
@@ -648,7 +653,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
648
653
}
649
654
650
655
fn lower_foreign_item ( & mut self , i : & ForeignItem ) -> hir:: ForeignItem < ' hir > {
651
- let def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
656
+ let def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) . expect_local ( ) ;
652
657
hir:: ForeignItem {
653
658
hir_id : self . lower_node_id ( i. id ) ,
654
659
ident : i. ident ,
@@ -749,7 +754,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
749
754
}
750
755
751
756
fn lower_trait_item ( & mut self , i : & AssocItem ) -> hir:: TraitItem < ' hir > {
752
- let trait_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
757
+ let trait_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) . expect_local ( ) ;
753
758
754
759
let ( generics, kind) = match i. kind {
755
760
AssocItemKind :: Const ( _, ref ty, ref default) => {
@@ -814,7 +819,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
814
819
}
815
820
816
821
fn lower_impl_item ( & mut self , i : & AssocItem ) -> hir:: ImplItem < ' hir > {
817
- let impl_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) ;
822
+ let impl_item_def_id = self . resolver . definitions ( ) . local_def_id ( i. id ) . expect_local ( ) ;
818
823
819
824
let ( generics, kind) = match & i. kind {
820
825
AssocItemKind :: Const ( _, ty, expr) => {
@@ -1211,7 +1216,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1211
1216
& mut self ,
1212
1217
generics : & Generics ,
1213
1218
sig : & FnSig ,
1214
- fn_def_id : DefId ,
1219
+ fn_def_id : LocalDefId ,
1215
1220
impl_trait_return_allow : bool ,
1216
1221
is_async : Option < NodeId > ,
1217
1222
) -> ( hir:: Generics < ' hir > , hir:: FnSig < ' hir > ) {
@@ -1223,7 +1228,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1223
1228
|this, idty| {
1224
1229
this. lower_fn_decl (
1225
1230
& sig. decl ,
1226
- Some ( ( fn_def_id, idty) ) ,
1231
+ Some ( ( fn_def_id. to_def_id ( ) , idty) ) ,
1227
1232
impl_trait_return_allow,
1228
1233
is_async,
1229
1234
)
0 commit comments