File tree 2 files changed +47
-0
lines changed
2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Test for ICE: cannot convert ReLateParam to a region vid
2
+ // https://github.com/rust-lang/rust/issues/125873
3
+
4
+ fn foo ( ) {
5
+ let a = for <' a > |b: & ' a ( ) | -> & ' a ( ) {
6
+ //~^ `for<...>` binders for closures are experimental
7
+ const {
8
+ let awd = ( ) ;
9
+ let _: & ' a ( ) = & awd;
10
+ //~^ `awd` does not live long enough
11
+ } ;
12
+ b
13
+ } ;
14
+ }
15
+
16
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0658]: `for<...>` binders for closures are experimental
2
+ --> $DIR/ice-issue-125873.rs:5:13
3
+ |
4
+ LL | let a = for<'a> |b: &'a ()| -> &'a () {
5
+ | ^^^^^^^
6
+ |
7
+ = note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information
8
+ = help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable
9
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10
+ = help: consider removing `for<...>`
11
+
12
+ error[E0597]: `awd` does not live long enough
13
+ --> $DIR/ice-issue-125873.rs:9:29
14
+ |
15
+ LL | let a = for<'a> |b: &'a ()| -> &'a () {
16
+ | -- lifetime `'a` defined here
17
+ ...
18
+ LL | let awd = ();
19
+ | --- binding `awd` declared here
20
+ LL | let _: &'a () = &awd;
21
+ | ------ ^^^^ borrowed value does not live long enough
22
+ | |
23
+ | type annotation requires that `awd` is borrowed for `'a`
24
+ LL |
25
+ LL | };
26
+ | - `awd` dropped here while still borrowed
27
+
28
+ error: aborting due to 2 previous errors
29
+
30
+ Some errors have detailed explanations: E0597, E0658.
31
+ For more information about an error, try `rustc --explain E0597`.
You can’t perform that action at this time.
0 commit comments