@@ -561,11 +561,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
561561 . params
562562 . iter ( )
563563 . 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+ )
569568 } )
570569 . map ( |param| param. def_id ) ;
571570 }
@@ -1352,27 +1351,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
13521351 let host_param_parts = if let Const :: Yes ( span) = constness
13531352 && self . tcx . features ( ) . effects
13541353 {
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) )
13761365 } else {
13771366 None
13781367 } ;
@@ -1436,19 +1425,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
14361425 self . children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
14371426 self . children . push ( ( anon_const, hir:: MaybeOwner :: NonOwner ( const_id) ) ) ;
14381427
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-
14521428 let const_body = self . lower_body ( |this| {
14531429 (
14541430 & [ ] ,
@@ -1490,6 +1466,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
14901466 hir_id : const_id,
14911467 body : const_body,
14921468 } ) ,
1469+ is_host_effect : true ,
14931470 } ,
14941471 colon_span : None ,
14951472 pure_wrt_drop : false ,
0 commit comments