File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -900,6 +900,20 @@ fn generics_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::Generics {
900900            let  parent_id = tcx. hir ( ) . get_parent_item ( hir_id) ; 
901901            Some ( tcx. hir ( ) . local_def_id ( parent_id) ) 
902902        } 
903+         // FIXME(#43408) enable this in all cases when we get lazy normalization. 
904+         Node :: AnonConst ( & anon_const)  => { 
905+             // HACK(eddyb) this provides the correct generics when the workaround 
906+             // for a const parameter `AnonConst` is being used elsewhere, as then 
907+             // there won't be the kind of cyclic dependency blocking #43408. 
908+             let  expr = & tcx. hir ( ) . body ( anon_const. body ) . value ; 
909+             let  icx = ItemCtxt :: new ( tcx,  def_id) ; 
910+             if  AstConv :: const_param_def_id ( & icx,  expr) . is_some ( )  { 
911+                 let  parent_id = tcx. hir ( ) . get_parent_item ( hir_id) ; 
912+                 Some ( tcx. hir ( ) . local_def_id ( parent_id) ) 
913+             }  else  { 
914+                 None 
915+             } 
916+         } 
903917        Node :: Expr ( & hir:: Expr  { 
904918            node :  hir:: ExprKind :: Closure ( ..) , 
905919            ..
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments