diff options
| author | bors <bors@rust-lang.org> | 2014-07-20 02:46:34 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-07-20 02:46:34 +0000 |
| commit | 56fafe28ee17a4aa48795083ee08be744f068067 (patch) | |
| tree | c1f7f0d1ec8166ff91dfd629e235b294393915cd /src/libsyntax/parse | |
| parent | 5e0a597a1a15e36ac7d855ca400e5add9d86716b (diff) | |
| parent | 6f99a27886023acf4d10efb4d56c89c88ffee9be (diff) | |
| download | rust-56fafe28ee17a4aa48795083ee08be744f068067.tar.gz rust-56fafe28ee17a4aa48795083ee08be744f068067.zip | |
auto merge of #15767 : pcwalton/rust/lifetime-elision, r=nick29581
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]
r? @nick29581
Diffstat (limited to 'src/libsyntax/parse')
0 files changed, 0 insertions, 0 deletions
