Skip to content

Commit

Permalink
auto merge of #12238 : ktt3ja/rust/lifetime-error-msg, r=nikomatsakis
Browse files Browse the repository at this point in the history
For the following code snippet:

```rust
struct Foo { bar: int }
fn foo1(x: &Foo) -> &int {
    &x.bar
}
```

This PR generates the following error message:

```rust
test.rs:2:1: 4:2 note: consider using an explicit lifetime parameter as shown: fn foo1<'a>(x: &'a Foo) -> &'a int
test.rs:2 fn foo1(x: &Foo) -> &int {
test.rs:3     &x.bar
test.rs:4 }
test.rs:3:5: 3:11 error: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements
test.rs:3     &x.bar
              ^~~~~~
```

Currently it does not support methods.
  • Loading branch information
bors committed Mar 13, 2014
2 parents 6ca5773 + 9faa2a5 commit 3fbee34
Show file tree
Hide file tree
Showing 6 changed files with 772 additions and 6 deletions.
Loading

0 comments on commit 3fbee34

Please sign in to comment.