@@ -565,11 +565,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
565
565
. params
566
566
. iter ( )
567
567
. find ( |param| {
568
- parent_hir
569
- . attrs
570
- . get ( param. hir_id . local_id )
571
- . iter ( )
572
- . any ( |attr| attr. has_name ( sym:: rustc_host) )
568
+ matches ! (
569
+ param. kind,
570
+ hir:: GenericParamKind :: Const { is_host_effect: true , .. }
571
+ )
573
572
} )
574
573
. map ( |param| param. def_id ) ;
575
574
}
@@ -1372,27 +1371,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
1372
1371
let host_param_parts = if let Const :: Yes ( span) = constness
1373
1372
&& self . tcx . features ( ) . effects
1374
1373
{
1375
- if let Some ( param) =
1376
- generics. params . iter ( ) . find ( |x| x. attrs . iter ( ) . any ( |x| x. has_name ( sym:: rustc_host) ) )
1377
- {
1378
- // user has manually specified a `rustc_host` param, in this case, we set
1379
- // the param id so that lowering logic can use that. But we don't create
1380
- // another host param, so this gives `None`.
1381
- self . host_param_id = Some ( self . local_def_id ( param. id ) ) ;
1382
- None
1383
- } else {
1384
- let param_node_id = self . next_node_id ( ) ;
1385
- let hir_id = self . next_id ( ) ;
1386
- let def_id = self . create_def (
1387
- self . local_def_id ( parent_node_id) ,
1388
- param_node_id,
1389
- sym:: host,
1390
- DefKind :: ConstParam ,
1391
- span,
1392
- ) ;
1393
- self . host_param_id = Some ( def_id) ;
1394
- Some ( ( span, hir_id, def_id) )
1395
- }
1374
+ let param_node_id = self . next_node_id ( ) ;
1375
+ let hir_id = self . next_id ( ) ;
1376
+ let def_id = self . create_def (
1377
+ self . local_def_id ( parent_node_id) ,
1378
+ param_node_id,
1379
+ sym:: host,
1380
+ DefKind :: ConstParam ,
1381
+ span,
1382
+ ) ;
1383
+ self . host_param_id = Some ( def_id) ;
1384
+ Some ( ( span, hir_id, def_id) )
1396
1385
} else {
1397
1386
None
1398
1387
} ;
@@ -1456,19 +1445,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
1456
1445
self . children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
1457
1446
self . children . push ( ( anon_const, hir:: MaybeOwner :: NonOwner ( const_id) ) ) ;
1458
1447
1459
- let attr_id = self . tcx . sess . parse_sess . attr_id_generator . mk_attr_id ( ) ;
1460
-
1461
- let attrs = self . arena . alloc_from_iter ( [ Attribute {
1462
- kind : AttrKind :: Normal ( P ( NormalAttr :: from_ident ( Ident :: new (
1463
- sym:: rustc_host,
1464
- span,
1465
- ) ) ) ) ,
1466
- span,
1467
- id : attr_id,
1468
- style : AttrStyle :: Outer ,
1469
- } ] ) ;
1470
- self . attrs . insert ( hir_id. local_id , attrs) ;
1471
-
1472
1448
let const_body = self . lower_body ( |this| {
1473
1449
(
1474
1450
& [ ] ,
@@ -1510,6 +1486,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1510
1486
hir_id : const_id,
1511
1487
body : const_body,
1512
1488
} ) ,
1489
+ is_host_effect : true ,
1513
1490
} ,
1514
1491
colon_span : None ,
1515
1492
pure_wrt_drop : false ,
0 commit comments