Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-lexical lifetimes #159

Closed
iorveth opened this issue May 17, 2019 · 0 comments · Fixed by #160
Closed

non-lexical lifetimes #159

iorveth opened this issue May 17, 2019 · 0 comments · Fixed by #160

Comments

@iorveth
Copy link

iorveth commented May 17, 2019

https://doc.rust-lang.org/edition-guide/rust-2018/the-compiler/improved-error-messages.html
The code in this example will compile, because of non-lexical lifetimes, described previously.
https://doc.rust-lang.org/edition-guide/rust-2018/ownership-and-lifetimes/non-lexical-lifetimes.html
Consider this example

fn main() {
    let mut x = 5;
    let y = &x;

    x += 1;
    println!("{}",*y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant