-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-coroutinesArea: CoroutinesArea: CoroutinesC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
When compiling:
#![feature(generators)]
fn main() {
let _a = || {
if false { yield }
let a = String::new();
a.len()
};
}
I currently get:
error[E0597]: `a` does not live long enough
--> foo.rs:8:5
|
7 | a.len()
| - borrow occurs here
8 | };
| ^ `a` dropped here while still borrowed
9 | }
| - borrowed value needs to live until here
error: aborting due to previous error
Would be nice to not have to bind it to a local!
alex
Metadata
Metadata
Assignees
Labels
A-coroutinesArea: CoroutinesArea: CoroutinesC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.