@@ -562,11 +562,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
562562 . params
563563 . iter ( )
564564 . 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+ )
570569 } )
571570 . map ( |param| param. def_id ) ;
572571 }
@@ -1353,27 +1352,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
13531352 let host_param_parts = if let Const :: Yes ( span) = constness
13541353 && self . tcx . features ( ) . effects
13551354 {
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) )
13771366 } else {
13781367 None
13791368 } ;
@@ -1442,19 +1431,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
14421431 self . children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
14431432 self . children . push ( ( anon_const, hir:: MaybeOwner :: NonOwner ( const_id) ) ) ;
14441433
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-
14581434 let const_body = self . lower_body ( |this| {
14591435 (
14601436 & [ ] ,
@@ -1496,6 +1472,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14961472 hir_id : const_id,
14971473 body : const_body,
14981474 } ) ,
1475+ is_host_effect : true ,
14991476 } ,
15001477 colon_span : None ,
15011478 pure_wrt_drop : false ,
0 commit comments