Uh oh!
There was an error while loading. Please reload this page.
Enforce the comma after lifetime arguments and before type arguments - #24547
Conversation
rust-highfive
commented
Apr 18, 2015
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
There was a problem hiding this comment.
I'm not sure about the performance impact of this bufferring.
I see I can modify parse_lifetimes to avoid this, but that will look unnatural.
pnkfelix
commented
Apr 18, 2015
We may eventually need / want a help in the output reminding that |
There was a problem hiding this comment.
Why are these tests commented out?
pnkfelix
commented
Apr 18, 2015
Why are there nine compile-fail tests, with no header comment, that all appear similar (even duplicates?) based on a quick skim? Was that accidental? |
There was a problem hiding this comment.
Hmm, shouldn't these tests be checking (perhaps in addition) all the same cases when parsing MyOtherType<'a>, with no type argument?
There was a problem hiding this comment.
Sorry that was phrased poorly; what I meant was that cases like Box <MyOtherType <'static>> etc need checking too, with the >> token after a lifetime, right?
There was a problem hiding this comment.
Ugh never mind again, you did check that, I just missed it twice
bombless
commented
Apr 18, 2015
Because you cannot resume from parsing error, so I have to test different errors in separate files. I'll try suggesting |
bombless
commented
Apr 18, 2015
Oh yes these 9 compile-fail files are similar intentionally, the difference is just that only one parsing error is uncommented at once. I'll add comments to make this clear. |
Manishearth
commented
Apr 19, 2015
technically a breaking change, might want to edit the PR message to reflect that |
bombless
commented
Apr 20, 2015
right. fixed. I'm trying to make a different approach, which will make catching the Currently I'm using I think we cannot pretty-print a type this early, so I will just make the codemap feels right, and use the first token to generate a note, e.g. suggest "do you mean Or am I missing something? Any suggestions, @pnkfelix ? |
pnkfelix
commented
Apr 20, 2015
@bombless oh yes, I do not object to being fairly generic in the help message; this would not be the first place that we've inserted |
pnkfelix
commented
Apr 20, 2015
@bombless as for catching the leading |
bombless
commented
Apr 20, 2015
Okay I'll do that. |
bombless
commented
Apr 22, 2015
Nits fixed, @pnkfelix |
bors
commented
Apr 22, 2015
☔ The latest upstream changes (presumably #24674) made this pull request unmergeable. Please resolve the merge conflicts. |
bombless
commented
Apr 22, 2015
rebased |
bombless
commented
Apr 22, 2015
Do you mean that there's other places in parser.rs need to print a generic type? I don't really understand this, sorry. |
pnkfelix
commented
Apr 23, 2015
@bombless Yeah, sorry, I can see that my use of the phrase "GenericType" can be easily misinterpreted there; it was the name I was referring to as being generic, not the type ... That is, I was trying to say this:
The main thing I would suggest is this: If you were literally suggesting that when
then I advise that you not use ellipses in that fashion, but instead use a placeholder name for the type that you cannot print. Like so:
where Update: Then again, maybe it is not feasible to attempt to try to plug in placeholders into the type arguments for
Update 2: In some ways the english text prefixing to the two suggestions in this final example output is just as important, or perhaps more important, than the suggestion itself, in that (I hope) it makes it much clearer why there is an ambiguity here as to what the original intent of the user was. |
pnkfelix
commented
Apr 25, 2015
bors
commented
Apr 25, 2015
⌛ Testing commit 0ad48e4 with merge 00c48d3... |
Closes#20616 It breaks code such as <https://github.com/rust-lang/rust/blob/c64feb63418fd05bd6e5adc6f9ad763aa6a594b1/src/librustc_typeck/check/method/suggest.rs#L367>, so this is a [breaking-change], you have to add missing comma after the last lifetime arguement now.
bors
commented
Apr 25, 2015
Rust now enforces a comma between lifetime and type, see rust-lang/rust#24547 for the change.
pnkfelix
commented
Apr 30, 2015
(potential future cleanup: maybe just get rid of the commented out cases in all the tests...) |
pnkfelix
commented
Apr 30, 2015
accepted for beta backport. |
brson
commented
Apr 30, 2015
Backported. |
Closes#20616
It breaks code such as
rust/src/librustc_typeck/check/method/suggest.rs
Line 367 in c64feb6