File tree Expand file tree Collapse file tree 2 files changed +29
-13
lines changed 
compiler/rustc_trait_selection/src/traits 
src/test/ui/const-generics Expand file tree Collapse file tree 2 files changed +29
-13
lines changed Original file line number Diff line number Diff line change @@ -451,19 +451,21 @@ impl<'tcx> WfPredicates<'tcx> {
451451                GenericArgKind :: Const ( ct)  => { 
452452                    match  ct. kind ( )  { 
453453                        ty:: ConstKind :: Unevaluated ( uv)  => { 
454-                             let  obligations = self . nominal_obligations ( uv. def . did ,  uv. substs ) ; 
455-                             self . out . extend ( obligations) ; 
456- 
457-                             let  predicate =
458-                                 ty:: Binder :: dummy ( ty:: PredicateKind :: ConstEvaluatable ( ct) ) ; 
459-                             let  cause = self . cause ( traits:: WellFormed ( None ) ) ; 
460-                             self . out . push ( traits:: Obligation :: with_depth ( 
461-                                 self . tcx ( ) , 
462-                                 cause, 
463-                                 self . recursion_depth , 
464-                                 self . param_env , 
465-                                 predicate, 
466-                             ) ) ; 
454+                             if  !ct. has_escaping_bound_vars ( )  { 
455+                                 let  obligations = self . nominal_obligations ( uv. def . did ,  uv. substs ) ; 
456+                                 self . out . extend ( obligations) ; 
457+ 
458+                                 let  predicate =
459+                                     ty:: Binder :: dummy ( ty:: PredicateKind :: ConstEvaluatable ( ct) ) ; 
460+                                 let  cause = self . cause ( traits:: WellFormed ( None ) ) ; 
461+                                 self . out . push ( traits:: Obligation :: with_depth ( 
462+                                     self . tcx ( ) , 
463+                                     cause, 
464+                                     self . recursion_depth , 
465+                                     self . param_env , 
466+                                     predicate, 
467+                                 ) ) ; 
468+                             } 
467469                        } 
468470                        ty:: ConstKind :: Infer ( _)  => { 
469471                            let  cause = self . cause ( traits:: WellFormed ( None ) ) ; 
Original file line number Diff line number Diff line change 1+ // check-pass 
2+ // edition:2021 
3+ #![ feature( generic_const_exprs) ]  
4+ #![ allow( incomplete_features) ]  
5+ 
6+ #[ allow( unused) ]  
7+ async  fn  foo < ' a > ( )  { 
8+     let  _data = & mut  [ 0u8 ;  {  1  + 4  } ] ; 
9+     bar ( ) . await 
10+ } 
11+ 
12+ async  fn  bar ( )  { } 
13+ 
14+ fn  main ( )  { } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments