File tree Expand file tree Collapse file tree 3 files changed +47
-3
lines changed 
compiler/rustc_borrowck/src/region_infer Expand file tree Collapse file tree 3 files changed +47
-3
lines changed Original file line number Diff line number Diff line change @@ -1945,8 +1945,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19451945        target_test :  impl  Fn ( RegionVid )  -> bool , 
19461946    )  -> ( BlameConstraint < ' tcx > ,  Vec < ExtraConstraintInfo > )  { 
19471947        // Find all paths 
1948-         let  ( path,  target_region)  =
1949-             self . find_constraint_paths_between_regions ( from_region,  target_test) . unwrap ( ) ; 
1948+         let  ( path,  target_region)  = self 
1949+             . find_constraint_paths_between_regions ( from_region,  target_test) 
1950+             . or_else ( || { 
1951+                 self . find_constraint_paths_between_regions ( from_region,  |r| { 
1952+                     self . cannot_name_placeholder ( from_region,  r) 
1953+                 } ) 
1954+             } ) 
1955+             . unwrap ( ) ; 
19501956        debug ! ( 
19511957            "path={:#?}" , 
19521958            path. iter( ) 
Original file line number Diff line number Diff line change 1- //@ known-bug:  #133252 
1+ // Regression test for borrowck ICE  #133252 
22//@ edition:2021 
33use  std:: future:: Future ; 
44
@@ -7,6 +7,8 @@ fn ice() -> impl Future<Output = &'static dyn Owned> {
77    async  { 
88        let  not_static = 0 ; 
99        force_send ( async_load ( & not_static) ) ; 
10+         //~^ ERROR implementation of `LoadQuery` is not general enough 
11+         //~| ERROR `not_static` does not live long enough 
1012        loop  { } 
1113    } 
1214} 
@@ -41,3 +43,5 @@ impl Future for SimpleFuture {
4143        loop  { } 
4244    } 
4345} 
46+ 
47+ fn  main ( )  { } 
Original file line number Diff line number Diff line change 1+ error: implementation of `LoadQuery` is not general enough
2+   --> $DIR/implementation-not-general-enough-ice-133252.rs:9:9
3+    |
4+ LL |         force_send(async_load(¬_static));
5+    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `LoadQuery` is not general enough
6+    |
7+    = note: `LoadQuery<'0>` would have to be implemented for the type `&u8`, for any lifetime `'0`...
8+    = note: ...but `LoadQuery<'1>` is actually implemented for the type `&'1 u8`, for some specific lifetime `'1`
9+ 
10+ error[E0597]: `not_static` does not live long enough
11+   --> $DIR/implementation-not-general-enough-ice-133252.rs:9:31
12+    |
13+ LL |     async {
14+    |         - return type of async block is &(dyn Owned + '1)
15+ LL |         let not_static = 0;
16+    |             ---------- binding `not_static` declared here
17+ LL |         force_send(async_load(¬_static));
18+    |                    -----------^^^^^^^^^^^-
19+    |                    |          |
20+    |                    |          borrowed value does not live long enough
21+    |                    argument requires that `not_static` is borrowed for `'1`
22+ ...
23+ LL |     }
24+    |     - `not_static` dropped here while still borrowed
25+    |
26+ note: due to current limitations in the borrow checker, this implies a `'static` lifetime
27+   --> $DIR/implementation-not-general-enough-ice-133252.rs:16:18
28+    |
29+ LL | fn force_send<T: Send>(_: T) {}
30+    |                  ^^^^
31+ 
32+ error: aborting due to 2 previous errors
33+ 
34+ For more information about this error, try `rustc --explain E0597`.
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments