Uh oh!
There was an error while loading. Please reload this page.
elided lifetime - #46254
Conversation
rust-highfive
commented
Nov 25, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @michaelwoerister (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. |
michaelwoerister
commented
Nov 27, 2017
Unassigning myself since this isn't really my area. Please make sure to make the appropriate folks from @rust-lang/compiler aware of your PR, @Dylan-DPC. |
Dylan-DPC-zz
commented
Nov 27, 2017
bors
commented
Dec 2, 2017
☔ The latest upstream changes (presumably #46430) made this pull request unmergeable. Please resolve the merge conflicts. |
eddyb
commented
Dec 3, 2017
BTW you should rebase instead of merging. |
Dylan-DPC-zz
commented
Dec 3, 2017
Yeah thanks. But i resolved the conflicts on the Github UI (since it were minor conflicts) which i assume merges by default. |
eddyb
commented
Dec 3, 2017
You can still rebase, and it will remove the merge commit. |
Dylan-DPC-zz
commented
Dec 3, 2017
Yeah sure |
bors
commented
Dec 5, 2017
☔ The latest upstream changes (presumably #46305) made this pull request unmergeable. Please resolve the merge conflicts. |
nikomatsakis
commented
Dec 6, 2017
Sorry, somehow this didn't wind up assigned to me. |
nikomatsakis
commented
Dec 6, 2017
@Dylan-DPC so it seems like you're not actually issuing the lint anywhere -- is that right? Do you need help with just how to do this? |
nikomatsakis
commented
Dec 6, 2017
Ah, actually, you're probably going to hit the same issue that @gaurikholkar hit in #46441. In particular, we can't issue lints from |
nikomatsakis
commented
Dec 6, 2017
That said, #46441 is a good PR to look at for how to issue lints in general. =) |
Dylan-DPC-zz
commented
Dec 6, 2017
Yeah i will rebase ontop of it. |
aidanhs
commented
Dec 14, 2017
Hi @Dylan-DPC, how are you doing with this? #46657 is merged so I think you can rebase on top of that now. |
09343db to
ee254cbCompareThere was a problem hiding this comment.
Missing a comma on the line above
Dylan-DPC-zz
commented
Dec 30, 2017
yeah trying to figure out how to issue. Should i just issue it when deprecated is true? |
There was a problem hiding this comment.
Add the .stderr file for the ui test
There was a problem hiding this comment.
You can run ./x.py test --stage 1 src/test/ui to get the stderr file
There was a problem hiding this comment.
Ya thanks. Just have to work on some stuff before that
nikomatsakis
left a comment
There was a problem hiding this comment.
Obviously you have to add the code that actually issues the lint =) let me know if you need any tips on that
There was a problem hiding this comment.
Let's change the message to:
elided lifetime parameters from structs, enums, or such types are deprecated; use '_ instead
There was a problem hiding this comment.
This should be //~^ ERROR: ...
That is an annotation that indicates that we expect an error on the line above. The .stderr file will give more precise information.
nikomatsakis
commented
Jan 3, 2018
Oh, I missed this comment:
Yep, I think so. |
To issue the lint (i.e., when deprecated is true), you would want something like this: rust/src/librustc/middle/resolve_lifetime.rs Lines 1228 to 1234 in 78493ed |
Dylan-DPC-zz
commented
Jan 4, 2018
Thanks. My question was do i need to do perform any other check? |
Dylan-DPC-zz
commented
Feb 1, 2018
@eddyb nice. Thanks |
Dylan-DPC-zz
commented
Feb 2, 2018
@bors r+ |
bors
commented
Feb 2, 2018
@Dylan-DPC: 🔑 Insufficient privileges: Not in reviewers |
estebank
commented
Feb 2, 2018
@bors r=nikomatsakis |
bors
commented
Feb 2, 2018
📌 Commit accd997 has been approved by |
bors
commented
Feb 2, 2018
⌛ Testing commit accd997 with merge 2575f9713fc5cbfffc83cc99ed2430d4cbba2ecd... |
bors
commented
Feb 3, 2018
💔 Test failed - status-travis |
shepmaster
commented
Feb 3, 2018
@bors retry |
bors
commented
Feb 3, 2018
⌛ Testing commit accd997 with merge d1c54614c99d7227d5ed8c15ace39887e1e8a582... |
bors
commented
Feb 3, 2018
💔 Test failed - status-travis |
kennytm
commented
Feb 3, 2018
bors
commented
Feb 3, 2018
elided lifetime Closes#45992 Hey Having a problem with my config so decided to make a WIP PR nevertheless. Will add some more tests.
bors
commented
Feb 3, 2018
☀️ Test successful - status-appveyor, status-travis |
The existing elided-lifetimes-in-paths lint (introduced in Nov. 2017's accd997 / rust-lang#46254) lacked stuctured suggestions and—much more alarmingly—produced false positives on associated functions (like `Ref::clone`) and on anonymous '_ lifetimes (!!—yes, the very anonymous lifetimes that we meant to suggest "instead"). That this went apparently unnoticed for so long maybe tells you something about how many people actually bother to flip on allow-by-default lints. After many hours of good old-fashioned American elbow grease—and a little help from expert reviewers—it turns out that getting the right answer is a lot easier if we fire the lint while lowering the Higher Intermediate Representation. The lint is promoted to the idioms-2018 group. Also, in the matter of test filenames, "elided" only has one 'l' (see, e.g., https://en.wiktionary.org/wiki/elide). Resolvesrust-lang#52041.
…_re-pub-lic, r=nikomatsakis add structured suggestions and fix false-positive for elided-lifetimes-in-paths lint This adds structured suggestions to the elided-lifetimes-in-paths lint (introduced in Nov. 2017's #46254), prevents it from emitting a false-positive on anonymous (underscore) lifetimes (!), and adds it to the idioms-2018 group (#52041). ~~As an aside, "elided-lifetimes-in-paths" seems like an unfortunate name, because it's not clear exactly what "elided" means. The motivation for this lint (see original issue #45992, and [RFC 2115](https://github.com/rust-lang/rfcs/blob/e978a8d3017a01d632f916140c98802505cd1324/text/2115-argument-lifetimes.md#motivation)) seems to be specifically about not supplying angle-bracketed lifetime arguments to non-`&` types, but (1) the phrase "lifetime elision" has historically also referred to the ability to not supply a lifetime name to `&` references, and (2) an `is_elided` method in the HIR returns true for anoymous/underscore lifetimes, which is _not_ what we're trying to lint here. (That naming confusion is almost certainly what led to the false positive addressed here.) Given that the lint is relatively new and is allow-by-default, is it too late to rename it ... um, _again_ (#50879)?~~ ~~This does _not_ address a couple of other false positives discovered in #52041 (comment)  r? @nikomatsakis cc @nrc@petrochenkov
Closes#45992
Hey
Having a problem with my config so decided to make a WIP PR nevertheless. Will add some more tests.