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

Update lifetime errors to specifically note temporaries #36171

Merged
merged 1 commit into from
Sep 3, 2016

Conversation

sophiajt
Copy link
Contributor

This PR updates the error message we give in the case of a temporary value not living long enough.

Before:

screen shot 2016-08-31 at 10 02 47 am

Now:

screen shot 2016-08-31 at 10 03 01 am

Specifically, it makes the following changes:

  • Detects if a temporary is being used. If so, it changes the labels to mention that a temporary value specifically is in question
  • Simplifies wording of the existing labels to focus on lifetimes rather than values being valid
  • Changes the help to a note, since the help+span wasn't as helpful (and sometimes more confusing) than just a note.

r? @nikomatsakis

}
//~^ borrowed value must be valid until here
//~^ NOTE temporary value needs to live until here
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: can we make this a UI test?

@nikomatsakis
Copy link
Contributor

@jonathandturner r=me if we move the "suggestions" to a ui test, which seems like a better fit :)

@sophiajt
Copy link
Contributor Author

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Aug 31, 2016

📌 Commit 5112b40 has been approved by nikomatsakis

//~| NOTE does not live long enough
//~| NOTE borrowed value only valid until here
//~| HELP consider using a `let` binding to increase its lifetime
//~| NOTE temporary value created here
Copy link
Member

Choose a reason for hiding this comment

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

Trailing whitespace. make tidy won't be happy.

@sophiajt
Copy link
Contributor Author

sophiajt commented Sep 1, 2016

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented Sep 1, 2016

📌 Commit 439afcd has been approved by nikomatsakis

@sophiajt
Copy link
Contributor Author

sophiajt commented Sep 1, 2016

@frewsxcv - thanks for the catch with tidy :)

@sophiajt
Copy link
Contributor Author

sophiajt commented Sep 2, 2016

@bors rollup

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 2, 2016
…nikomatsakis

Update lifetime errors to specifically note temporaries

This PR updates the error message we give in the case of a temporary value not living long enough.

Before:

<img width="497" alt="screen shot 2016-08-31 at 10 02 47 am" src="https://cloud.githubusercontent.com/assets/547158/18138551/27a06794-6f62-11e6-9ee2-bdf8bed75ca7.png">

Now:

<img width="488" alt="screen shot 2016-08-31 at 10 03 01 am" src="https://cloud.githubusercontent.com/assets/547158/18138557/2e5cf322-6f62-11e6-9047-4a78abf3d78c.png">

Specifically, it makes the following changes:

* Detects if a temporary is being used.  If so, it changes the labels to mention that a temporary value specifically is in question
* Simplifies wording of the existing labels to focus on lifetimes rather than values being valid
* Changes the help to a note, since the help+span wasn't as helpful (and sometimes more confusing) than just a note.

r? @nikomatsakis
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 2, 2016
…nikomatsakis

Update lifetime errors to specifically note temporaries

This PR updates the error message we give in the case of a temporary value not living long enough.

Before:

<img width="497" alt="screen shot 2016-08-31 at 10 02 47 am" src="https://cloud.githubusercontent.com/assets/547158/18138551/27a06794-6f62-11e6-9ee2-bdf8bed75ca7.png">

Now:

<img width="488" alt="screen shot 2016-08-31 at 10 03 01 am" src="https://cloud.githubusercontent.com/assets/547158/18138557/2e5cf322-6f62-11e6-9047-4a78abf3d78c.png">

Specifically, it makes the following changes:

* Detects if a temporary is being used.  If so, it changes the labels to mention that a temporary value specifically is in question
* Simplifies wording of the existing labels to focus on lifetimes rather than values being valid
* Changes the help to a note, since the help+span wasn't as helpful (and sometimes more confusing) than just a note.

r? @nikomatsakis
sophiajt pushed a commit to sophiajt/rust that referenced this pull request Sep 2, 2016
…nikomatsakis

Update lifetime errors to specifically note temporaries

This PR updates the error message we give in the case of a temporary value not living long enough.

Before:

<img width="497" alt="screen shot 2016-08-31 at 10 02 47 am" src="https://cloud.githubusercontent.com/assets/547158/18138551/27a06794-6f62-11e6-9ee2-bdf8bed75ca7.png">

Now:

<img width="488" alt="screen shot 2016-08-31 at 10 03 01 am" src="https://cloud.githubusercontent.com/assets/547158/18138557/2e5cf322-6f62-11e6-9047-4a78abf3d78c.png">

Specifically, it makes the following changes:

* Detects if a temporary is being used.  If so, it changes the labels to mention that a temporary value specifically is in question
* Simplifies wording of the existing labels to focus on lifetimes rather than values being valid
* Changes the help to a note, since the help+span wasn't as helpful (and sometimes more confusing) than just a note.

r? @nikomatsakis
bors added a commit that referenced this pull request Sep 3, 2016
Rollup of 12 pull requests

- Successful merges: #35754, #35793, #36099, #36160, #36171, #36178, #36180, #36190, #36198, #36205, #36210, #36223
- Failed merges:
@bors bors merged commit 439afcd into rust-lang:master Sep 3, 2016
@nikomatsakis
Copy link
Contributor

Yay :)

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.

4 participants