Skip to content

Better errors when rustc cannot derive lifetimes #30102

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

Merged
merged 3 commits into from
Dec 5, 2015

Conversation

jFransham
Copy link
Contributor

Fixes #30086

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @arielb1 (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@jFransham
Copy link
Contributor Author

r? @Manishearth

@rust-highfive rust-highfive assigned Manishearth and unassigned arielb1 Nov 29, 2015
@Manishearth
Copy link
Member

@bors r+ force

Thanks!

@bors
Copy link
Collaborator

bors commented Nov 29, 2015

📌 Commit 9569c63 has been approved by Manishearth

@Manishearth
Copy link
Member

@bors r-

@sanxiyn
Copy link
Member

sanxiyn commented Nov 29, 2015

This needs a test.

@Manishearth
Copy link
Member

Wait, sorry, we should add a test for this. Could you add one to tests/compile-fail which verifies that the error messages are shown correctly? Check out the other tests in that folder (or ask me on IRC) for pointers on how to write one.

fileline_help!(tcx.sess, default_span,
"this function's return type contains a borrowed value, but \
there is no value for it to be borrowed from");
fileline_help!(tcx.sess, default_span,
"consider giving it a 'static lifetime");
} else if !any_lifetimes {
fileline_help!(tcx.sess, default_span,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the error message different between this case and the previous one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking the previous message implied that there were no arguments to draw from, and I was hoping to make the message as explicit as possible; I think if they were made the same they would be slightly more confusing. I don't feel strongly on this or anything, I'd be happy to change it so they have the same message if that's the consensus.

Also yeah, I'll do the tests.

@Manishearth
Copy link
Member

@bors r+

Sorry, didn't notice the new commit.

Thanks!

@bors
Copy link
Collaborator

bors commented Dec 5, 2015

📌 Commit 829e8bf has been approved by Manishearth

@bors
Copy link
Collaborator

bors commented Dec 5, 2015

⌛ Testing commit 829e8bf with merge d75f861...

bors added a commit that referenced this pull request Dec 5, 2015
@bors bors merged commit 829e8bf into rust-lang:master Dec 5, 2015
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.

6 participants