-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Test for ICE: cannot convert ReLateParam to a region vid | ||
// https://github.com/rust-lang/rust/issues/125873 | ||
|
||
fn foo() { | ||
let a = for<'a> |b: &'a ()| -> &'a () { | ||
//~^ `for<...>` binders for closures are experimental | ||
const { | ||
let awd = (); | ||
let _: &'a () = &awd; | ||
//~^ `awd` does not live long enough | ||
}; | ||
b | ||
}; | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
error[E0658]: `for<...>` binders for closures are experimental | ||
--> $DIR/ice-issue-125873.rs:5:13 | ||
| | ||
LL | let a = for<'a> |b: &'a ()| -> &'a () { | ||
| ^^^^^^^ | ||
| | ||
= note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information | ||
= help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable | ||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date | ||
= help: consider removing `for<...>` | ||
|
||
error[E0597]: `awd` does not live long enough | ||
--> $DIR/ice-issue-125873.rs:9:29 | ||
| | ||
LL | let a = for<'a> |b: &'a ()| -> &'a () { | ||
| -- lifetime `'a` defined here | ||
... | ||
LL | let awd = (); | ||
| --- binding `awd` declared here | ||
LL | let _: &'a () = &awd; | ||
| ------ ^^^^ borrowed value does not live long enough | ||
| | | ||
| type annotation requires that `awd` is borrowed for `'a` | ||
LL | | ||
LL | }; | ||
| - `awd` dropped here while still borrowed | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0597, E0658. | ||
For more information about an error, try `rustc --explain E0597`. |