-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Warn on anon params in 2015 edition #53272
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Also, I still need to make sure tests pass... |
Also, I need to add a migration suggestion that rustfix can use. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me modulo the policy question and the rustfix unit test question
src/librustc_lint/builtin.rs
Outdated
"detects anonymous parameters", | ||
Edition::Edition2018 => Warn | ||
Warn, | ||
"detects anonymous parameters" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I think that the policy in general is that we only warn in migration mode -- but this is an unconditional warning, no? I don't really care either way, I just want to Do What's Right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We talked about this a bit yesterday on Discord; I think our conclusion was that warnings only during migration was the policy but that in this case an unconditional warning would be OK? Did you discuss this further?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe if we just wanted to warn in migration mode, we would change this back to Allow
and add it to the FutureCompatibilityLints
array. I don't really see why it should be different from the other migration lints, but I don't have a strong preference.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a strong reason to treat this differently from other migration lints either.
Well, wait, I just realized something -- isn't this supposed to be a hard error in the new Edition? I thought that was the whole idea here. =) That is, @Centril wanted to go from "just linting" to giving a "hard error", so as to make space for some other syntax changes we had in mind, so we decided to up the schedule (roughly along the lines of what I think you originally proposed, @mark-i-m)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I need to learn how to block the syntax in the new edition, whereas I already know how to change the lint. I was thinking that after this PR, we could submit another that removes the syntax in 2018 edition (I will need some help with that). In the mean time, we can at least start warning as early as possible, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could of course always do that in a follow-up PR...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway I basically don't care if we warn in 2015 always or only when migrating. I thought the typical policy was only the latter, though. The only reason to do otherwise would be to give a kind of "extra nudge" -- the fact that we accepted a separate RFC (pre-edition) which deprecated this syntax might be enough justification. This would be analogous to deprecating some API, which obviously doesn't have to occur on an edition boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I opened #53612. This might actually be a lot easier than I expected.
@@ -125,7 +125,7 @@ trait InTraitDefnReturn { | |||
// Allowed and disallowed in trait impls | |||
trait DummyTrait { | |||
type Out; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we have already have a rustfix unit test for this? if not, can we add one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by "this"? This particular file? Or the _: Type
suggestion? I had previously added https://github.com/rust-lang/rust/pull/48309/files#diff-cff76de2568555816771ee1e45d8225f in #48309. Is that what you mean?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, thanks.
8474bbd
to
c4f7289
Compare
☔ The latest upstream changes (presumably #52953) made this pull request unmergeable. Please resolve the merge conflicts. |
c4f7289
to
e1bff31
Compare
I guess maybe it's orthogonal? @bors r+ |
📌 Commit e1bff318921b3d96afcd12997aa23db175eacfaf has been approved by |
Yes, they are orthogonal. This PR enables the warning in 2015. The other PR disables anonymous params in 2018. |
⌛ Testing commit e1bff318921b3d96afcd12997aa23db175eacfaf with merge 79ce3148a8f9f5ab6c8f58a8a16e40eda0aae5fa... |
💔 Test failed - status-appveyor |
Huh? Sorry, I didn't notice that Travis failed. |
The failure is from AppVeyor (Windows), not Travis 🙃
|
…enkov Remove anonymous trait params from 2018 and beyond cc @Centril @nikomatsakis cc #41686 rust-lang/rfcs#2522 #53272 This PR removes support for anonymous trait parameters syntactically in rust 2018 and onward. TODO: - [x] Add tests
Thanks! Also, I think I forgot to change this to Allow-by-default as discussed in #53272 (comment). |
9e41e9d
to
548f28e
Compare
@bors r+ |
📌 Commit 548f28e has been approved by |
@nikomatsakis I think this should be ready for one last review. Also since #53612 merged two days ago, this is already an error in 2018 edition. |
Oh, you beat me to it! Thanks :) |
Warn on anon params in 2015 edition cc #41686 rust-lang/rfcs#2522 cc @Centril @nikomatsakis TODO: - [x] Make sure the tests pass. - [x] Make sure there is rustfix-able suggestion. Current plan is to just suggest `_ : Foo` - [x] Add a rustfix ui test. EDIT: It seems I already did the last two in #48309
☀️ Test successful - status-appveyor, status-travis |
cc #41686 rust-lang/rfcs#2522
cc @Centril @nikomatsakis
TODO:
_ : Foo
EDIT: It seems I already did the last two in #48309