@@ -562,11 +562,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
562
562
. params
563
563
. iter ( )
564
564
. find ( |param| {
565
- parent_hir
566
- . attrs
567
- . get ( param. hir_id . local_id )
568
- . iter ( )
569
- . any ( |attr| attr. has_name ( sym:: rustc_host) )
565
+ matches ! (
566
+ param. kind,
567
+ hir:: GenericParamKind :: Const { is_host_effect: true , .. }
568
+ )
570
569
} )
571
570
. map ( |param| param. def_id ) ;
572
571
}
@@ -1353,27 +1352,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
1353
1352
let host_param_parts = if let Const :: Yes ( span) = constness
1354
1353
&& self . tcx . features ( ) . effects
1355
1354
{
1356
- if let Some ( param) =
1357
- generics. params . iter ( ) . find ( |x| x. attrs . iter ( ) . any ( |x| x. has_name ( sym:: rustc_host) ) )
1358
- {
1359
- // user has manually specified a `rustc_host` param, in this case, we set
1360
- // the param id so that lowering logic can use that. But we don't create
1361
- // another host param, so this gives `None`.
1362
- self . host_param_id = Some ( self . local_def_id ( param. id ) ) ;
1363
- None
1364
- } else {
1365
- let param_node_id = self . next_node_id ( ) ;
1366
- let hir_id = self . next_id ( ) ;
1367
- let def_id = self . create_def (
1368
- self . local_def_id ( parent_node_id) ,
1369
- param_node_id,
1370
- DefPathData :: TypeNs ( sym:: host) ,
1371
- DefKind :: ConstParam ,
1372
- span,
1373
- ) ;
1374
- self . host_param_id = Some ( def_id) ;
1375
- Some ( ( span, hir_id, def_id) )
1376
- }
1355
+ let param_node_id = self . next_node_id ( ) ;
1356
+ let hir_id = self . next_id ( ) ;
1357
+ let def_id = self . create_def (
1358
+ self . local_def_id ( parent_node_id) ,
1359
+ param_node_id,
1360
+ DefPathData :: TypeNs ( sym:: host) ,
1361
+ DefKind :: ConstParam ,
1362
+ span,
1363
+ ) ;
1364
+ self . host_param_id = Some ( def_id) ;
1365
+ Some ( ( span, hir_id, def_id) )
1377
1366
} else {
1378
1367
None
1379
1368
} ;
@@ -1442,19 +1431,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
1442
1431
self . children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
1443
1432
self . children . push ( ( anon_const, hir:: MaybeOwner :: NonOwner ( const_id) ) ) ;
1444
1433
1445
- let attr_id = self . tcx . sess . parse_sess . attr_id_generator . mk_attr_id ( ) ;
1446
-
1447
- let attrs = self . arena . alloc_from_iter ( [ Attribute {
1448
- kind : AttrKind :: Normal ( P ( NormalAttr :: from_ident ( Ident :: new (
1449
- sym:: rustc_host,
1450
- span,
1451
- ) ) ) ) ,
1452
- span,
1453
- id : attr_id,
1454
- style : AttrStyle :: Outer ,
1455
- } ] ) ;
1456
- self . attrs . insert ( hir_id. local_id , attrs) ;
1457
-
1458
1434
let const_body = self . lower_body ( |this| {
1459
1435
(
1460
1436
& [ ] ,
@@ -1496,6 +1472,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1496
1472
hir_id : const_id,
1497
1473
body : const_body,
1498
1474
} ) ,
1475
+ is_host_effect : true ,
1499
1476
} ,
1500
1477
colon_span : None ,
1501
1478
pure_wrt_drop : false ,
0 commit comments