File tree 3 files changed +47
-3
lines changed
compiler/rustc_borrowck/src/region_infer
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> {
1950
1950
target_test : impl Fn ( RegionVid ) -> bool ,
1951
1951
) -> ( BlameConstraint < ' tcx > , Vec < ExtraConstraintInfo > ) {
1952
1952
// 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 ( ) ;
1955
1961
debug ! (
1956
1962
"path={:#?}" ,
1957
1963
path. iter( )
Original file line number Diff line number Diff line change 1
- //@ known-bug: #133252
1
+ // Regression test for borrowck ICE #133252
2
2
//@ edition:2021
3
3
use std:: future:: Future ;
4
4
@@ -7,6 +7,8 @@ fn ice() -> impl Future<Output = &'static dyn Owned> {
7
7
async {
8
8
let not_static = 0 ;
9
9
force_send ( async_load ( & not_static) ) ;
10
+ //~^ ERROR implementation of `LoadQuery` is not general enough
11
+ //~| ERROR `not_static` does not live long enough
10
12
loop { }
11
13
}
12
14
}
@@ -41,3 +43,5 @@ impl Future for SimpleFuture {
41
43
loop { }
42
44
}
43
45
}
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