@@ -111,7 +111,7 @@ impl<'a, 'hir> ItemLowerer<'a, 'hir> {
111
111
}
112
112
113
113
fn lower_foreign_item ( & mut self , item : & ForeignItem ) {
114
- assert_ne ! ( item. ident. name, kw:: Empty ) ;
114
+ debug_assert_ne ! ( item. ident. name, kw:: Empty ) ;
115
115
self . with_lctx ( item. id , |lctx| hir:: OwnerNode :: ForeignItem ( lctx. lower_foreign_item ( item) ) )
116
116
}
117
117
}
@@ -180,26 +180,26 @@ impl<'hir> LoweringContext<'_, 'hir> {
180
180
) -> hir:: ItemKind < ' hir > {
181
181
match i {
182
182
ItemKind :: ExternCrate ( orig_name) => {
183
- assert_ne ! ( ident. name, kw:: Empty ) ;
183
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
184
184
let ident = self . lower_ident ( ident) ;
185
185
hir:: ItemKind :: ExternCrate ( * orig_name, ident)
186
186
}
187
187
ItemKind :: Use ( use_tree) => {
188
- assert_eq ! ( ident. name, kw:: Empty ) ;
188
+ debug_assert_eq ! ( ident. name, kw:: Empty ) ;
189
189
// Start with an empty prefix.
190
190
let prefix = Path { segments : ThinVec :: new ( ) , span : use_tree. span , tokens : None } ;
191
191
192
192
self . lower_use_tree ( use_tree, & prefix, id, vis_span, attrs)
193
193
}
194
194
ItemKind :: Static ( box ast:: StaticItem { ty : t, safety : _, mutability : m, expr : e } ) => {
195
- assert_ne ! ( ident. name, kw:: Empty ) ;
195
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
196
196
let ident = self . lower_ident ( ident) ;
197
197
let ( ty, body_id) =
198
198
self . lower_const_item ( t, span, e. as_deref ( ) , ImplTraitPosition :: StaticTy ) ;
199
199
hir:: ItemKind :: Static ( ident, ty, * m, body_id)
200
200
}
201
201
ItemKind :: Const ( box ast:: ConstItem { generics, ty, expr, .. } ) => {
202
- assert_ne ! ( ident. name, kw:: Empty ) ;
202
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
203
203
let ident = self . lower_ident ( ident) ;
204
204
let ( generics, ( ty, body_id) ) = self . lower_generics (
205
205
generics,
@@ -219,7 +219,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
219
219
define_opaque,
220
220
..
221
221
} ) => {
222
- assert_ne ! ( ident. name, kw:: Empty ) ;
222
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
223
223
self . with_new_scopes ( * fn_sig_span, |this| {
224
224
// Note: we don't need to change the return type from `T` to
225
225
// `impl Future<Output = T>` here because lower_body
@@ -258,7 +258,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
258
258
} )
259
259
}
260
260
ItemKind :: Mod ( _, mod_kind) => {
261
- assert_ne ! ( ident. name, kw:: Empty ) ;
261
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
262
262
let ident = self . lower_ident ( ident) ;
263
263
match mod_kind {
264
264
ModKind :: Loaded ( items, _, spans, _) => {
@@ -268,7 +268,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
268
268
}
269
269
}
270
270
ItemKind :: ForeignMod ( fm) => {
271
- assert_eq ! ( ident. name, kw:: Empty ) ;
271
+ debug_assert_eq ! ( ident. name, kw:: Empty ) ;
272
272
hir:: ItemKind :: ForeignMod {
273
273
abi : fm. abi . map_or ( ExternAbi :: FALLBACK , |abi| self . lower_abi ( abi) ) ,
274
274
items : self
@@ -277,14 +277,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
277
277
}
278
278
}
279
279
ItemKind :: GlobalAsm ( asm) => {
280
- assert_eq ! ( ident. name, kw:: Empty ) ;
280
+ debug_assert_eq ! ( ident. name, kw:: Empty ) ;
281
281
let asm = self . lower_inline_asm ( span, asm) ;
282
282
let fake_body =
283
283
self . lower_body ( |this| ( & [ ] , this. expr ( span, hir:: ExprKind :: InlineAsm ( asm) ) ) ) ;
284
284
hir:: ItemKind :: GlobalAsm { asm, fake_body }
285
285
}
286
286
ItemKind :: TyAlias ( box TyAlias { generics, where_clauses, ty, .. } ) => {
287
- assert_ne ! ( ident. name, kw:: Empty ) ;
287
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
288
288
// We lower
289
289
//
290
290
// type Foo = impl Trait
@@ -322,7 +322,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
322
322
hir:: ItemKind :: TyAlias ( ident, ty, generics)
323
323
}
324
324
ItemKind :: Enum ( enum_definition, generics) => {
325
- assert_ne ! ( ident. name, kw:: Empty ) ;
325
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
326
326
let ident = self . lower_ident ( ident) ;
327
327
let ( generics, variants) = self . lower_generics (
328
328
generics,
@@ -337,7 +337,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
337
337
hir:: ItemKind :: Enum ( ident, hir:: EnumDef { variants } , generics)
338
338
}
339
339
ItemKind :: Struct ( struct_def, generics) => {
340
- assert_ne ! ( ident. name, kw:: Empty ) ;
340
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
341
341
let ident = self . lower_ident ( ident) ;
342
342
let ( generics, struct_def) = self . lower_generics (
343
343
generics,
@@ -348,7 +348,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
348
348
hir:: ItemKind :: Struct ( ident, struct_def, generics)
349
349
}
350
350
ItemKind :: Union ( vdata, generics) => {
351
- assert_ne ! ( ident. name, kw:: Empty ) ;
351
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
352
352
let ident = self . lower_ident ( ident) ;
353
353
let ( generics, vdata) = self . lower_generics (
354
354
generics,
@@ -368,7 +368,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
368
368
self_ty : ty,
369
369
items : impl_items,
370
370
} ) => {
371
- assert_eq ! ( ident. name, kw:: Empty ) ;
371
+ debug_assert_eq ! ( ident. name, kw:: Empty ) ;
372
372
// Lower the "impl header" first. This ordering is important
373
373
// for in-band lifetimes! Consider `'a` here:
374
374
//
@@ -434,7 +434,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
434
434
} ) )
435
435
}
436
436
ItemKind :: Trait ( box Trait { is_auto, safety, generics, bounds, items } ) => {
437
- assert_ne ! ( ident. name, kw:: Empty ) ;
437
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
438
438
let ident = self . lower_ident ( ident) ;
439
439
let ( generics, ( safety, items, bounds) ) = self . lower_generics (
440
440
generics,
@@ -455,7 +455,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
455
455
hir:: ItemKind :: Trait ( * is_auto, safety, ident, generics, bounds, items)
456
456
}
457
457
ItemKind :: TraitAlias ( generics, bounds) => {
458
- assert_ne ! ( ident. name, kw:: Empty ) ;
458
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
459
459
let ident = self . lower_ident ( ident) ;
460
460
let ( generics, bounds) = self . lower_generics (
461
461
generics,
@@ -471,7 +471,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
471
471
hir:: ItemKind :: TraitAlias ( ident, generics, bounds)
472
472
}
473
473
ItemKind :: MacroDef ( MacroDef { body, macro_rules } ) => {
474
- assert_ne ! ( ident. name, kw:: Empty ) ;
474
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
475
475
let ident = self . lower_ident ( ident) ;
476
476
let body = P ( self . lower_delim_args ( body) ) ;
477
477
let def_id = self . local_def_id ( id) ;
@@ -486,7 +486,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
486
486
hir:: ItemKind :: Macro ( ident, macro_def, macro_kind)
487
487
}
488
488
ItemKind :: Delegation ( box delegation) => {
489
- assert_ne ! ( ident. name, kw:: Empty ) ;
489
+ debug_assert_ne ! ( ident. name, kw:: Empty ) ;
490
490
let ident = self . lower_ident ( ident) ;
491
491
let delegation_results = self . lower_delegation ( delegation, id) ;
492
492
hir:: ItemKind :: Fn {
@@ -545,6 +545,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
545
545
546
546
let res = self . lower_import_res ( id, path. span ) ;
547
547
let path = self . lower_use_path ( res, & path, ParamMode :: Explicit ) ;
548
+ let ident = self . lower_ident ( ident) ;
548
549
hir:: ItemKind :: Use ( path, hir:: UseKind :: Single ( ident) )
549
550
}
550
551
UseTreeKind :: Glob => {
@@ -797,7 +798,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
797
798
}
798
799
799
800
fn lower_trait_item ( & mut self , i : & AssocItem ) -> & ' hir hir:: TraitItem < ' hir > {
800
- assert_ne ! ( i. ident. name, kw:: Empty ) ;
801
+ debug_assert_ne ! ( i. ident. name, kw:: Empty ) ;
801
802
let hir_id = hir:: HirId :: make_owner ( self . current_hir_id_owner . def_id ) ;
802
803
let attrs = self . lower_attrs ( hir_id, & i. attrs , i. span ) ;
803
804
let trait_item_def_id = hir_id. expect_owner ( ) ;
@@ -945,7 +946,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
945
946
}
946
947
947
948
fn lower_impl_item ( & mut self , i : & AssocItem ) -> & ' hir hir:: ImplItem < ' hir > {
948
- assert_ne ! ( i. ident. name, kw:: Empty ) ;
949
+ debug_assert_ne ! ( i. ident. name, kw:: Empty ) ;
949
950
// Since `default impl` is not yet implemented, this is always true in impls.
950
951
let has_value = true ;
951
952
let ( defaultness, _) = self . lower_defaultness ( i. kind . defaultness ( ) , has_value) ;
0 commit comments