-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints
Description
This program ought not to compile, but the error we get is pretty darn incomprehensible (play):
#![feature(nll)]
#![feature(in_band_lifetimes)]
#![allow(warnings)]
struct CookieJar<'data> {
vec: Vec<String>,
data: &'data (),
}
impl CookieJar<'data> {
fn cookie_me(&self) -> Cookie<'data> {
let next = 22;
me_want_cookie(next, self)
}
}
struct Cookie<'jar> {
jar: &'jar CookieJar<'jar>
}
fn me_want_cookie(next: usize, jar: &'jar CookieJar<'jar>) -> Cookie<'jar> {
Cookie { jar }
}
fn main() {
}
gives me
error: free region `` does not outlive free region `'data`
--> src/main.rs:12:13
|
12 | let next = 22;
| ^^^^
Metadata
Metadata
Assignees
Labels
A-NLLArea: Non-lexical lifetimes (NLL)Area: Non-lexical lifetimes (NLL)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lints