Skip to content
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

Merged
merged 1 commit into from
May 25, 2018
Merged

Conversation

petrochenkov
Copy link
Contributor

@petrochenkov petrochenkov commented May 18, 2018

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

@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 18, 2018
@petrochenkov
Copy link
Contributor Author

r? @nikomatsakis

This also needs to be backported to beta.

@bors
Copy link
Contributor

bors commented May 19, 2018

☔ The latest upstream changes (presumably #50763) made this pull request unmergeable. Please resolve the merge conflicts.

@nikomatsakis
Copy link
Contributor

Sigh, good catch. Also, it's sort of odd that we always have lints available without feature gates.

@bors r+

@bors
Copy link
Contributor

bors commented May 22, 2018

📌 Commit 253948c has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 22, 2018
@nikomatsakis nikomatsakis added the beta-nominated Nominated for backporting to the compiler in the beta channel. label May 22, 2018
@petrochenkov
Copy link
Contributor Author

Hm, this actually needs a rebase.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 24, 2018
@nikomatsakis nikomatsakis added the beta-accepted Accepted for backporting to the compiler in the beta channel. label May 24, 2018
@petrochenkov
Copy link
Contributor Author

@bors r=nikomatsakis

@bors
Copy link
Contributor

bors commented May 24, 2018

📌 Commit e60eaf5 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 24, 2018
@bors
Copy link
Contributor

bors commented May 25, 2018

⌛ Testing commit e60eaf5 with merge c8e10e3...

bors added a commit that referenced this pull request May 25, 2018
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`
@bors
Copy link
Contributor

bors commented May 25, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing c8e10e3 to master...

bors added a commit that referenced this pull request Jun 1, 2018
[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
@pietroalbini pietroalbini removed the beta-nominated Nominated for backporting to the compiler in the beta channel. label Jun 2, 2018
bors added a commit that referenced this pull request Jun 3, 2018
[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
zackmdavis added a commit to zackmdavis/rust that referenced this pull request Jul 15, 2018
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.
bors added a commit that referenced this pull request Jul 22, 2018
…_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
hcpl added a commit to hcpl/serde_mtproto that referenced this pull request Aug 6, 2018
@petrochenkov petrochenkov deleted the lintconv branch June 5, 2019 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-accepted Accepted for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants