Skip to content

Commit 53f2ac3

Browse files
authored
Rollup merge of #128648 - tiif:issue-125873, r=lcnr
Add regression test Fixes #125873
2 parents 2d7075c + 8eaef3e commit 53f2ac3

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Test for ICE: cannot convert ReLateParam to a region vid
2+
// https://github.com/rust-lang/rust/issues/125873
3+
4+
#![feature(closure_lifetime_binder)]
5+
fn foo() {
6+
let a = for<'a> |b: &'a ()| -> &'a () {
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 numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
error[E0597]: `awd` does not live long enough
2+
--> $DIR/using-late-bound-from-closure.rs:9:29
3+
|
4+
LL | let a = for<'a> |b: &'a ()| -> &'a () {
5+
| -- lifetime `'a` defined here
6+
LL | const {
7+
LL | let awd = ();
8+
| --- binding `awd` declared here
9+
LL | let _: &'a () = &awd;
10+
| ------ ^^^^ borrowed value does not live long enough
11+
| |
12+
| type annotation requires that `awd` is borrowed for `'a`
13+
LL |
14+
LL | };
15+
| - `awd` dropped here while still borrowed
16+
17+
error: aborting due to 1 previous error
18+
19+
For more information about this error, try `rustc --explain E0597`.

0 commit comments

Comments
 (0)