-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix naming conventions for new lints #50879
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
This also needs to be backported to beta. |
☔ The latest upstream changes (presumably #50763) made this pull request unmergeable. Please resolve the merge conflicts. |
Sigh, good catch. Also, it's sort of odd that we always have lints available without feature gates. @bors r+ |
📌 Commit 253948c has been approved by |
Hm, this actually needs a rebase. |
@bors r=nikomatsakis |
📌 Commit e60eaf5 has been approved by |
Fix naming conventions for new lints We actually have an RFC from Oct 2014 specifying naming conventions for lints that is still relevant - https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints. Unfortunately, human memory doesn't work for such prolonged periods of time, so a number of recently added edition-related lints don't follow the conventions. This PR fixes names for those lints. Unstable lints, simply renamed: - `unused_lifetime` -> `unused_lifetimes` - `absolute_path_not_starting_with_crate` -> `absolute_paths_not_starting_with_crate` - `unnecessary_extern_crate` -> `unnecessary_extern_crates` New lints stabilized in the last couple of releases, registered as renamed (old names still work with a warning): - `single_use_lifetime` -> `single_use_lifetimes` - `elided_lifetime_in_path` -> `elided_lifetimes_in_paths` - `bare_trait_object` -> `bare_trait_objects` - `unstable_name_collision` -> `unstable_name_collisions` - `unused_doc_comment` -> `unused_doc_comments` NOT changed, too old to rename: - `const_err` -> `const_errors` - `unused_allocation` -> `unused_allocations` NOT changed, deprecation lints, no need to rename, they are going to be removed anyway: - `invalid_type_param_default` -> `invalid_type_param_defaults` - `missing_fragment_specifier` -> `missing_fragment_specifiers` - `tyvar_behind_raw_pointer` -> `tyvars_behind_raw_pointer` - `illegal_floating_point_literal_pattern` -> `illegal_floating_point_literal_patterns`
☀️ Test successful - status-appveyor, status-travis |
[beta] Process backports Merged and approved: * #50812: Fix issue #50811 (`NaN > NaN` was true). * #50827: Update LLVM to `56c931901cfb85cd6f7ed44c7d7520a8de1edf97` * #50879: Fix naming conventions for new lints * #51011: rustdoc: hide macro export statements from docs * #51051: prohibit turbofish in `impl Trait` methods * #51052: restore emplacement syntax (obsolete) * #51146: typeck: Do not pass the field check on field error * #51235: remove notion of Implicit derefs from mem-cat r? @ghost
[beta] Process backports Merged and approved: * #50812: Fix issue #50811 (`NaN > NaN` was true). * #50879: Fix naming conventions for new lints * #51011: rustdoc: hide macro export statements from docs * #51051: prohibit turbofish in impl Trait methods * #51052: restore emplacement syntax (obsolete) * #51146: typeck: Do not pass the field check on field error * #51235: remove notion of Implicit derefs from mem-cat r? @ghost
It's only with reluctance and sadness that we rename a lint that has already been renamed once (rust-lang#50879), but it seems worth it to pick the best name now because since the lint is relatively new and has heretofore been allow-by-default, the ecosystem breakage should be minimal. (And—also sadly—the fact that the original implementation was so buggy for so long testifies that not very many people are tuning up the allow-by-default lints. Also, as always, lint capping prevents lint changes from spreading contagiously to dependencies.) The rationales here are that— • "hidden" is less potentially ambiguous than "elided", because this lint is specifically about angle-bracketed lifetime parameters, whereas the term "elided" has a strong precedent for also encompassing omitted lifetime names in reference ('&') types, which is not the concern of this lint, and • "types" is a more specific description of where the lint fires than "paths" (indeed, previous implementations of the lint used to fire on non-type paths in ways that proved to be erroneous false-positives, as evidenced by applications of the suggestion to use an anonymous lifetime (`'_`) resulting in code that didn't even parse) This comes from discussion on rust-lang#52069.
…_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) ![elided_states](https://user-images.githubusercontent.com/1076988/42302137-2bf9479c-7fce-11e8-8bd0-f29aefc802b6.png) r? @nikomatsakis cc @nrc @petrochenkov
We actually have an RFC from Oct 2014 specifying naming conventions for lints that is still relevant - https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#lints.
Unfortunately, human memory doesn't work for such prolonged periods of time, so a number of recently added edition-related lints don't follow the conventions.
This PR fixes names for those lints.
Unstable lints, simply renamed:
unused_lifetime
->unused_lifetimes
absolute_path_not_starting_with_crate
->absolute_paths_not_starting_with_crate
unnecessary_extern_crate
->unnecessary_extern_crates
New lints stabilized in the last couple of releases, registered as renamed (old names still work with a warning):
single_use_lifetime
->single_use_lifetimes
elided_lifetime_in_path
->elided_lifetimes_in_paths
bare_trait_object
->bare_trait_objects
unstable_name_collision
->unstable_name_collisions
unused_doc_comment
->unused_doc_comments
NOT changed, too old to rename:
const_err
->const_errors
unused_allocation
->unused_allocations
NOT changed, deprecation lints, no need to rename, they are going to be removed anyway:
invalid_type_param_default
->invalid_type_param_defaults
missing_fragment_specifier
->missing_fragment_specifiers
tyvar_behind_raw_pointer
->tyvars_behind_raw_pointer
illegal_floating_point_literal_pattern
->illegal_floating_point_literal_patterns