diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-07-17 21:44:59 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-07-19 13:10:58 -0700 |
| commit | 6f99a27886023acf4d10efb4d56c89c88ffee9be (patch) | |
| tree | ec05b0c028ea286b9c7ff4d0e3552e004462e488 /src/rustllvm/ExecutionEngineWrapper.cpp | |
| parent | 793b1424ac52b7d1cb20e508e313ce516530cea7 (diff) | |
| download | rust-6f99a27886023acf4d10efb4d56c89c88ffee9be.tar.gz rust-6f99a27886023acf4d10efb4d56c89c88ffee9be.zip | |
librustc: Implement lifetime elision.
This implements RFC 39. Omitted lifetimes in return values will now be
inferred to more useful defaults, and an error is reported if a lifetime
in a return type is omitted and one of the two lifetime elision rules
does not specify what it should be.
This primarily breaks two uncommon code patterns. The first is this:
unsafe fn get_foo_out_of_thin_air() -> &Foo {
...
}
This should be changed to:
unsafe fn get_foo_out_of_thin_air() -> &'static Foo {
...
}
The second pattern that needs to be changed is this:
enum MaybeBorrowed<'a> {
Borrowed(&'a str),
Owned(String),
}
fn foo() -> MaybeBorrowed {
Owned(format!("hello world"))
}
Change code like this to:
enum MaybeBorrowed<'a> {
Borrowed(&'a str),
Owned(String),
}
fn foo() -> MaybeBorrowed<'static> {
Owned(format!("hello world"))
}
Closes #15552.
[breaking-change]
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
