Skip to content

Conversation

@sophiajt
Copy link
Contributor

This patch moves the "doesn't live long enough" region-style errors to instead use labels.

An example follows.

Before:

error: `x` does not live long enough
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18
   |
26 |         let y = &x;
   |                  ^
   |
note: reference must be valid for the block at 23:10...
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:23:11
   |
23 | fn main() {
   |           ^
note: ...but borrowed value is only valid for the block suffix following statement 0 at 25:18
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:25:19
   |
25 |         let x = 1;
   |                   ^

After:

error: `x` does not live long enough
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18
   |
26 |         let y = &x;
   |                  ^ does not live long enough
...
32 |     };
   |     - borrowed value only valid until here
...
35 | }
   | - borrowed value must be valid until here

r? @nikomatsakis

Copy link
Contributor

@nikomatsakis nikomatsakis Aug 17, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use s.end_point() here...

@nikomatsakis
Copy link
Contributor

r=me modulo nits

@sophiajt sophiajt force-pushed the region_error_labels branch from 286c996 to 864b3ef Compare August 17, 2016 22:53
@sophiajt
Copy link
Contributor Author

@bors r=nikomatsakis

@bors
Copy link
Collaborator

bors commented Aug 17, 2016

📌 Commit 864b3ef has been approved by nikomatsakis

@bors
Copy link
Collaborator

bors commented Aug 18, 2016

⌛ Testing commit 864b3ef with merge 43c090e...

bors added a commit that referenced this pull request Aug 18, 2016
…sakis

Move 'doesn't live long enough' errors to labels

This patch moves the "doesn't live long enough" region-style errors to instead use labels.

An example follows.

Before:

```
error: `x` does not live long enough
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18
   |
26 |         let y = &x;
   |                  ^
   |
note: reference must be valid for the block at 23:10...
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:23:11
   |
23 | fn main() {
   |           ^
note: ...but borrowed value is only valid for the block suffix following statement 0 at 25:18
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:25:19
   |
25 |         let x = 1;
   |                   ^
```

After:

```
error: `x` does not live long enough
  --> src/test/compile-fail/send-is-not-static-ensures-scoping.rs:26:18
   |
26 |         let y = &x;
   |                  ^ does not live long enough
...
32 |     };
   |     - borrowed value only valid until here
...
35 | }
   | - borrowed value must be valid until here
```

r? @nikomatsakis
@bors bors merged commit 864b3ef into rust-lang:master Aug 18, 2016
@sophiajt sophiajt deleted the region_error_labels branch August 18, 2016 15:56
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 this pull request may close these issues.

3 participants