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 @@ -1950,8 +1950,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19501950 target_test : impl Fn ( RegionVid ) -> bool ,
19511951 ) -> ( BlameConstraint < ' tcx > , Vec < ExtraConstraintInfo > ) {
19521952 // Find all paths
1953- let ( path, target_region) =
1954- self . find_constraint_paths_between_regions ( from_region, target_test) . unwrap ( ) ;
1953+ let ( path, target_region) = self
1954+ . find_constraint_paths_between_regions ( from_region, target_test)
1955+ . or_else ( || {
1956+ self . find_constraint_paths_between_regions ( from_region, |r| {
1957+ self . cannot_name_placeholder ( from_region, r)
1958+ } )
1959+ } )
1960+ . unwrap ( ) ;
19551961 debug ! (
19561962 "path={:#?}" ,
19571963 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