@@ -565,11 +565,10 @@ impl<'hir> LoweringContext<'_, 'hir> {
565565 . params
566566 . iter ( )
567567 . 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+ )
573572 } )
574573 . map ( |param| param. def_id ) ;
575574 }
@@ -1372,27 +1371,17 @@ impl<'hir> LoweringContext<'_, 'hir> {
13721371 let host_param_parts = if let Const :: Yes ( span) = constness
13731372 && self . tcx . features ( ) . effects
13741373 {
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) )
13961385 } else {
13971386 None
13981387 } ;
@@ -1456,19 +1445,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
14561445 self . children . push ( ( def_id, hir:: MaybeOwner :: NonOwner ( hir_id) ) ) ;
14571446 self . children . push ( ( anon_const, hir:: MaybeOwner :: NonOwner ( const_id) ) ) ;
14581447
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-
14721448 let const_body = self . lower_body ( |this| {
14731449 (
14741450 & [ ] ,
@@ -1510,6 +1486,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
15101486 hir_id : const_id,
15111487 body : const_body,
15121488 } ) ,
1489+ is_host_effect : true ,
15131490 } ,
15141491 colon_span : None ,
15151492 pure_wrt_drop : false ,
0 commit comments