Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upShould the rust_2018_idioms lint group be mentioned in documentation? #52679
Comments
alexcrichton
added
the
A-edition-2018-lints
label
Jul 24, 2018
alexcrichton
added this to the Rust 2018 Preview 2 milestone
Jul 24, 2018
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
IIRC one of the original plans was something like:
|
This comment has been minimized.
This comment has been minimized.
That seems reasonable; on the other hand, you'll get less testing on the lint group if you do that... |
This comment has been minimized.
This comment has been minimized.
|
I think it's worth distinguishing what behavior we want from something like I think the bare-trait-objects and elided-lifetimes-in-paths lints should Just Work (absent macro shenanigans) and ellipsis-inclusive-range-patterns can easily be made to Just Work once we have pattern parentheses. It would be a shame to not autofix what we definitely can, just because other lints in the same lint-group are harder to solve. |
This comment has been minimized.
This comment has been minimized.
|
We can recommend --idioms to be something you run multiple times? While cargo fix for migration should report unfixed warnings, --idioms doesn't have to -- so we can have this transition by gradually marking more suggestions as applicable, and in the end just recommend a single pass (but folks following along can run it multiple times) |
This comment has been minimized.
This comment has been minimized.
|
@zackmdavis that's a good point yeah, if the experience is "pretty good" I think we can definitely turn it on by default. This may just be a case where we're more selective about lints in the If we trim down the lint group I think it'd also be a good solution to this problem, and then we could add more lints once they've been vetted and are known to have good suggestions. |
This comment has been minimized.
This comment has been minimized.
It also seems unfortunate to conflate "unidiomatic code that we can lint for" with "unidiomatic code that we can lint for and have an autofixable suggestion for". There may just be cases where the fix requires human judgment. (I fear Should |
This comment has been minimized.
This comment has been minimized.
That sounds appealing to me |
Manishearth
referenced this issue
Jul 26, 2018
Closed
Tracking issue for "macro naming and modularisation" (RFC #1561) #35896
This comment has been minimized.
This comment has been minimized.
|
I agree that
Having made that division, we need to ask if this is a problem for 2018 if the set of lints in the first group is not big enough, if there are critical lints that we currently don't automatically fix. |
This comment has been minimized.
This comment has been minimized.
|
That doesn't quite work. There already is an existing distinction of lints:
Some lints, like dyn trait, can belong in either group; but for many there's only one logical category. This distinction must be made because the idiom lints cannot be applied on 2015, and the migration lints cannot be applied on 2018 (if you're triggering migration lints your code will not compile on 2018). This can't all be handled by cargo fix because there's the step of bumping the crate edition in between. And that can only be done once all the edition migration fixes have been applied, which won't always be the case -- there's a bit of manual work here for some crates especially whenever macros are involved. What we can do is make It's not overcomplicated; some complication here is necessary. We can make the common case smooth but we definitely need this distinction. TBH I'm getting a bit frustrated here, because this is the third time we're having this discussion. When we started this whole edition lint work I pointed out we would need the migration/idiom category split, folks disagreed, and eventually independently came to the conclusion that yes, we do need these two categories (or something roughly similar). That we're back on that discussion, starting from scratch, is frustrating. |
This comment has been minimized.
This comment has been minimized.
|
FWIW there is no As @Manishearth mentioned we won't be able to lump everything in with the initial That all means that we're required to have two "fixing steps" (before and after the edition switch). Orchestrating this all automatically is the subject of rust-lang/cargo#5778 to hopefully make it less confusing. I'm personally a fan of adding a So to summarize:
and... that's it! Otherwise we'd continue to mention the idioms lint, just as |
alexcrichton
closed this
Jul 26, 2018
alexcrichton
reopened this
Jul 26, 2018
alexcrichton
self-assigned this
Jul 31, 2018
alexcrichton
referenced this issue
Jul 31, 2018
Merged
Add a `--edition-idioms` flag to `cargo fix` #5843
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Jul 31, 2018
alexcrichton
referenced this issue
Jul 31, 2018
Merged
rustc: Trim down the `rust_2018_idioms` lint group #52926
This comment has been minimized.
This comment has been minimized.
|
I've opened rust-lang/cargo#5843 for Cargo to add a |
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Aug 1, 2018
pietroalbini
added a commit
to pietroalbini/rust
that referenced
this issue
Aug 1, 2018
bors
added a commit
to rust-lang/cargo
that referenced
this issue
Aug 2, 2018
This comment has been minimized.
This comment has been minimized.
|
I believe this is now done and good to go! |
alexcrichton commentedJul 24, 2018
Enabling the
rust_2018_idiomslint group right now is a pretty brutal experience. Once enabled a slew of warnings show up thatcargo fixoften isn't very well to prepared. Furthermore, not all lints have automatic suggestions! This runs the risk of making the 2018 edition feel like a "big breaking change" because it takes so much effort to quelch all the lints.Should we completely not mention the
rust_2018_idiomslint group for the edition? For the preview?I'd personally think that we should avoid talking about this lint group at all until it's received a lot more polish. Until that time it's probably best if it's left only for compiler developers and the extra intrepid who go poking around in history. Curious to hear what others think though!