@@ -561,11 +561,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
561
561
. params
562
562
. iter ( )
563
563
. find ( |param| {
564
- parent_hir
565
- . attrs
566
- . get ( param. hir_id . local_id )
567
- . iter ( )
568
- . any ( |attr| attr. has_name ( sym:: rustc_host) )
564
+ matches ! (
565
+ param. kind,
566
+ hir:: GenericParamKind :: Const { is_host_effect: true , .. }
567
+ )
569
568
} )
570
569
. map ( |param| param. def_id ) ;
571
570
}
@@ -1352,27 +1351,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
1352
1351
let host_param_parts = if let Const :: Yes ( span) = constness
1353
1352
&& self . tcx . features ( ) . effects
1354
1353
{
1355
- if let Some ( param) =
1356
- generics. params . iter ( ) . find ( |x| x. attrs . iter ( ) . any ( |x| x. has_name ( sym:: rustc_host) ) )
1357
- {
1358
- // user has manually specified a `rustc_host` param, in this case, we set
1359
- // the param id so that lowering logic can use that. But we don't create
1360
- // another host param, so this gives `None`.
1361
- self . host_param_id = Some ( self . local_def_id ( param. id ) ) ;
1362
- None
1363
- } else {
1364
- let param_node_id = self . next_node_id ( ) ;
1365
- let hir_id = self . next_id ( ) ;
1366
- let def_id = self . create_def (
1367
- self . local_def_id ( parent_node_id) ,
1368
- param_node_id,
1369
- sym:: host,
1370
- DefKind :: ConstParam ,
1371
- span,
1372
- ) ;
1373
- self . host_param_id = Some ( def_id) ;
1374
- Some ( ( span, hir_id, def_id) )
1375
- }
1354
+ let param_node_id = self . next_node_id ( ) ;
1355
+ let hir_id = self . next_id ( ) ;
1356
+ let def_id = self . create_def (
1357
+ self . local_def_id ( parent_node_id) ,
1358
+ param_node_id,
1359
+ sym:: host,
1360
+ DefKind :: ConstParam ,
1361
+ span,
1362
+ ) ;
1363
+ self . host_param_id = Some ( def_id) ;
1364
+ Some ( ( span, hir_id, def_id) )
1376
1365
} else {
1377
1366
None
1378
1367
} ;
@@ -1436,19 +1425,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
1436
1425
self . children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
1437
1426
self . children . push ( ( anon_const, hir:: MaybeOwner :: NonOwner ( const_id) ) ) ;
1438
1427
1439
- let attr_id = self . tcx . sess . parse_sess . attr_id_generator . mk_attr_id ( ) ;
1440
-
1441
- let attrs = self . arena . alloc_from_iter ( [ Attribute {
1442
- kind : AttrKind :: Normal ( P ( NormalAttr :: from_ident ( Ident :: new (
1443
- sym:: rustc_host,
1444
- span,
1445
- ) ) ) ) ,
1446
- span,
1447
- id : attr_id,
1448
- style : AttrStyle :: Outer ,
1449
- } ] ) ;
1450
- self . attrs . insert ( hir_id. local_id , attrs) ;
1451
-
1452
1428
let const_body = self . lower_body ( |this| {
1453
1429
(
1454
1430
& [ ] ,
@@ -1490,6 +1466,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
1490
1466
hir_id : const_id,
1491
1467
body : const_body,
1492
1468
} ) ,
1469
+ is_host_effect : true ,
1493
1470
} ,
1494
1471
colon_span : None ,
1495
1472
pure_wrt_drop : false ,
0 commit comments