Uh oh!
There was an error while loading. Please reload this page.
Revamp the support for "future incompatible" lints - #30787
Conversation
nagisa
commented
Jan 8, 2016
IMO “see *” should be a HELP or HINT.
And this – a warning. |
solson
commented
Jan 8, 2016
Can we include the actual URL for issues and PRs? |
brson
commented
Jan 8, 2016
OK, as I understand it, this adds additional metadata for future-incompatible lints, resulting in 3 lines displayed, the 'normal' lint message, the future-incompatible explanation with either PR/issue/RFC, and a boilerplate HARD ERROR warning. I'm a bit confused about the exabmple in the OP. It looks to me like it was not generated with the commit in the PR. In particular: I think the errors described are two separate future-incompatible errors, but the first is an error' and the second is a note which makes me think the two are connected. Based on the code I expected to see an error with no issue number, then an extended note with an error number. Based on what I see here and what I think I understand of this PR I might suggest the following tweak:
Combining the two custom messages reduces duplication. With that and the expanded note for the URL I feel like switching the order of the 'hard error' and url notes. I think it could still be more clear that 1) this is a new error for a pattern that used to be valid, 2) it's breaking is part of an intentional transition strategy. I couldn't come with a simple and clear way to say those though. I do think we should spring for the URL, do everything we can to help hapless users - they may not know where to look for RFCs e.g. |
nikomatsakis
commented
Jan 9, 2016
@brson those messages were indeed generated by this code and are all connected. Right now there 3 pieces:
I agree it's too much. I also had a hard time though trying to pithily explain:
|
nikomatsakis
commented
Jan 9, 2016
So it seems like you are suggesting:
I'd love any suggestions as to good wordings ;) |
nikomatsakis
commented
Jan 9, 2016
@nagisa unfortunately I can't make the "HARD ERROR" part a warning -- or at least not easily -- because the diagnostic builder doesn't support that. You can only append notes, helps, etc. |
nikomatsakis
commented
Jan 9, 2016
Hmm, but that might be easy to change :) |
nikomatsakis
commented
Jan 9, 2016
OK, here is the newer output. For the invalid type parameter case: For private types in public APIs: |
bors
commented
Jan 11, 2016
☔ The latest upstream changes (presumably #30753) made this pull request unmergeable. Please resolve the merge conflicts. |
brson
commented
Jan 12, 2016
Maybe the thing that confused me was the first error message contained an issue number, while the future-incompatible explanation also contained a PR #. The error message issue # I think must have been just hardcoded in the message string, which is weird when compared to the PR # that has its own field in the extended future-incompatible data.
Well, after reading your example again I'm not sure. As you've phrased it it does make sense to have two sentences at least. The first says what the error is, the second says why. I guess what I was thinking was that the 'why' could just be a standard 'this is a future-incompatible error, for more info see...' message and not try to justify it inline. |
brson
commented
Jan 12, 2016
I like the new iteration better, I think, but "defaults for type parameters were only intended to be allowed on In this example: Is this lint emitting an error because of Which brings up the question to me of what happens to these after they do become hard errors. I would hope that they continue carrying this metadata, saying 'this used to work, but doesn't now because {URL}', for those that skipped a few cycles. Here's another attempt at writing the three lines about first error: It says what the error is (not why); that you aren't crazy, it used to work, but will not work soon; see link for further info. |
There was a problem hiding this comment.
struct or enum?
what about type, trait, impl? They all don't generate the warning currently.
nikomatsakis
commented
Jan 12, 2016
It is an error because of |
nikomatsakis
commented
Jan 12, 2016
seems good. |
nikomatsakis
commented
Jan 12, 2016
true, I will rephrase. |
nikomatsakis
commented
Jan 12, 2016
Do you think it is worth saying when it was changed? Maybe it doesn't matter. |
nikomatsakis
commented
Jan 12, 2016
I am inclined to change the wording of "previously valid Rust" to "previously accepted by the compiler", since frequently these fixes are the results of compiler bugs, and only very infrequently are they a genuine shift in policy. |
eaf533b to
7098cfdComparenikomatsakis
commented
Jan 12, 2016
OK, revised per suggestions. The current output:
UPDATE: Edited example to use |
nikomatsakis
commented
Jan 12, 2016
(ping @brson to take a look again) |
a0ca6e6 to
0254f69Comparebrson
commented
Jan 15, 2016
I do, but I also want it to be concise. |
brson
commented
Jan 15, 2016
@bors r+ |
bors
commented
Jan 15, 2016
📌 Commit 0704279 has been approved by |
…nt, r=brson
There is now more structure to the report, so that you can specify e.g. an RFC/PR/issue number and other explanatory details.
Example message:
```
type-parameter-invalid-lint.rs:14:8: 14:9 error: defaults for type parameters are only allowed on type definitions, like `struct` or `enum`
type-parameter-invalid-lint.rs:14 fn avg<T=i32>(_: T) {}
^
type-parameter-invalid-lint.rs:14:8: 14:9 warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
type-parameter-invalid-lint.rs:14:8: 14:9 note: for more information, see PR 30742 <rust-lang#30724>
type-parameter-invalid-lint.rs:11:9: 11:28 note: lint level defined here
type-parameter-invalid-lint.rs:11 #![deny(future_incompatible)]
^~~~~~~~~~~~~~~~~~~
error: aborting due to previous error
```
r? @brson
I would really like feedback also on the specific messages!
Fixesrust-lang#30746
There is now more structure to the report, so that you can specify e.g. an RFC/PR/issue number and other explanatory details.
Example message:
r? @brson
I would really like feedback also on the specific messages!
Fixes#30746