File tree Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Expand file tree Collapse file tree 3 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -705,9 +705,14 @@ impl Inherited<'a, 'tcx> {
705705            span_bug ! ( obligation. cause. span,  "escaping bound vars in predicate {:?}" , 
706706                      obligation) ; 
707707        } 
708-         self . fulfillment_cx 
709-             . borrow_mut ( ) 
710-             . register_predicate_obligation ( self ,  obligation) ; 
708+         let  _ = self . fulfillment_cx 
709+             . try_borrow_mut ( ) 
710+             . map_err ( |e| self . tcx . sess . delay_span_bug ( obligation. cause . span ,  & format ! ( 
711+                 "fullfillment context already borrowed: {:?} - {:?}" , 
712+                 e, 
713+                 obligation, 
714+             ) ) ) 
715+             . map ( |mut  cx| cx. register_predicate_obligation ( self ,  obligation) ) ; 
711716    } 
712717
713718    fn  register_predicates < I > ( & self ,  obligations :  I ) 
Original file line number Diff line number Diff line change 1+ // #66353: ICE when trying to recover from incorrect associated type 
2+ 
3+ trait  _Func < T >  { 
4+     fn  func ( _:  Self ) ; 
5+ } 
6+ 
7+ trait  _A  { 
8+     type  AssocT ; 
9+ } 
10+ 
11+ fn  main ( )  { 
12+     _Func :: <  <( )  as  _A >:: AssocT  > :: func ( ( ) ) ; 
13+     //~^ ERROR the trait bound `(): _A` is not satisfied 
14+     //~| ERROR the trait bound `(): _Func<_>` is not satisfied 
15+ } 
Original file line number Diff line number Diff line change 1+ error[E0277]: the trait bound `(): _A` is not satisfied
2+   --> $DIR/issue-66353.rs:12:14
3+    |
4+ LL |     _Func::< <() as _A>::AssocT >::func(());
5+    |              ^^^^^^^^^^^^^^^^^^ the trait `_A` is not implemented for `()`
6+ 
7+ error[E0277]: the trait bound `(): _Func<_>` is not satisfied
8+   --> $DIR/issue-66353.rs:12:41
9+    |
10+ LL |     fn func(_: Self);
11+    |     ----------------- required by `_Func::func`
12+ ...
13+ LL |     _Func::< <() as _A>::AssocT >::func(());
14+    |                                         ^^ the trait `_Func<_>` is not implemented for `()`
15+ 
16+ error: aborting due to 2 previous errors
17+ 
18+ For more information about this error, try `rustc --explain E0277`.
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments