Commit Graph

141169 Commits

Author SHA1 Message Date
Vadim Petrochenkov b25d3ba781 ast/hir: Rename field-related structures
StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.
2021-03-16 11:41:24 +03:00
Vadim Petrochenkov 35e8be7407 ast/hir: Rename field-related structures
StructField -> FieldDef ("field definition")
Field -> ExprField ("expression field", not "field expression")
FieldPat -> PatField ("pattern field", not "field pattern")

Also rename visiting and other methods working on them.
2021-03-16 11:41:24 +03:00
Martin Habovstiak 4330268181 Filled tracking issue for path_try_exists
This adds the ID of the tracking issue to the feature.
2021-03-16 08:41:14 +01:00
bors 1a206fc4ab Auto merge of #6915 - smoelius:docs-link, r=llogiq
Do not show docs link when lint doesn't start with "clippy::"

This small change ensures that if the diagnostic functions are called from outside of Clippy, a docs link is not displayed.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*
changelog: restrict docs links
2021-03-16 07:08:48 +00:00
bors 195ad4830e Auto merge of #82898 - oli-obk:tait_🧊, r=nikomatsakis
Add a `min_type_alias_impl_trait` feature gate

This new feature gate only permits type alias impl trait to be constrained by function and trait method return types. All other possible constraining sites like const/static types, closure return types and binding types are now forbidden and gated under the `type_alias_impl_trait` and `impl_trait_in_bindings` feature gates (which are both marked as incomplete, as they have various ways to ICE the compiler or cause query cycles where they shouldn't).

r? `@nikomatsakis`

This is best reviewed commit-by-commit
2021-03-16 04:24:48 +00:00
Felix S. Klock II d6de60fb32 Make bootstrap be more informative when one does x.py test on a beta checkout without other mods.
To be clear, by default running `x.py test` on a checkout of the beta branch
currently fails, and with this change will continue to fail, because `x.py
tests` runs `x.py test src/tools/tidy` which tries to run `rustfmt` and that
will fail because the `rustfmt` binary is pinned to the current nighlty and we
do not attempt to distribute one for the beta builds.

This change gives a better error message than the current message, which is just
"./x.py fmt is not supported on this channel" without providing any hint about
what one might do about that problem.

(update: placated tidy.)
2021-03-15 23:19:35 -04:00
bors c701c301d4 Auto merge of #6889 - Y-Nak:refactor-unit-types, r=flip1995
Refactor unit types

Ref:  #6724
r? `@flip1995`

Changes:
1. Extract `unit_types` from `types` group.
2. Move lints of `unit_types` to their own modules.

Notes:
Other lints of `unit_types` is still scattered around the `clippy_lints`, e.g. `result_unit_err` or `option_map_unit_fn`.
These should be addressed in another PR.

changelog: none
2021-03-16 02:57:33 +00:00
Yoshitomo Nakanishi 5a439f5a82 Remove unit_types::utils::is_unit 2021-03-16 11:28:53 +09:00
Yoshitomo Nakanishi 6211b49ac1 Move unit_arg to its own module 2021-03-16 11:28:53 +09:00
Yoshitomo Nakanishi 1bb221243b Move unit_cmp to its own module 2021-03-16 11:27:42 +09:00
Yoshitomo Nakanishi d17f54538f Move let_unit_value to its own module 2021-03-16 11:27:02 +09:00
Yoshitomo Nakanishi 37bffb7797 Extract utility functions to utils.rs 2021-03-16 11:25:46 +09:00
Yoshitomo Nakanishi ecbef77bd7 Extract lints of unit_types group from types group 2021-03-16 11:25:46 +09:00
bors 99ecb6189d Auto merge of #6916 - camsteffen:diagnostics-util, r=Manishearth
Don't re-export `clippy_utils::diagnostics::*`

changelog: none

Continues #6907
2021-03-16 02:09:43 +00:00
Erik Desjardins 90562b401e bless tests 2021-03-15 21:58:54 -04:00
Erik Desjardins 899836306f remove assignments to ZST places 2021-03-15 21:57:52 -04:00
bors 4c10c84c63 Auto merge of #83153 - Aaron1011:eval-always-extern_mod_stmt_cnum, r=michaelwoerister
Mark `extern_mod_stmt_cnum` as `eval_always`

This query reads from global untracked state, so it always needs to be
evaluated.
2021-03-16 01:33:06 +00:00
Cameron Steffen 1c3a3e7dc6 Don't re-export clippy_utils::diagnostics::* 2021-03-15 20:06:01 -05:00
Erik Desjardins affb081fa0 revert changes from #83118 to mark zst return place as unused 2021-03-15 20:18:03 -04:00
bors d7a23112e3 Auto merge of #6914 - camsteffen:source-utils, r=Manishearth
Move some utils to `clippy_utils::source`

changelog: none

Continues #6907
2021-03-16 00:08:01 +00:00
Tomasz Miąsko 0d84e0b68c Add test case for -Zinline-mir & -Zinstrument-coverage 2021-03-16 00:00:00 +00:00
Tomasz Miąsko 335427a3db Use delay_span_bug instead of panic in layout_scalar_valid_range
83054 introduced validation of scalar range attributes, but panicking
code that uses the attribute remained reachable. Use `delay_span_bug`
instead to avoid the ICE.
2021-03-16 00:00:00 +00:00
Jack Huey ba27cae728 Make functions passed to BoundVarReplacer be optional 2021-03-15 19:00:37 -04:00
bors 0929a24d72 Auto merge of #6828 - mgacek8:issue_6758_enhance_wrong_self_convention, r=flip1995
wrong_self_convention: fix lint in case of `to_*_mut` method

fixes #6758
changelog: wrong_self_convention: fix lint in case of `to_*_mut` method. When a method starts with `to_` and ends with `_mut`, clippy expects a `&mut self` parameter, otherwise `&self`.

Any feedback is welcome. I was also thinking if shouldn't we treat `to_` the same way as `as_`. Namely to accept `self` taken:  `&self` or `&mut self`.
2021-03-15 22:36:57 +00:00
Tomasz Miąsko 4b6cc0c204 Add support for compile-flags in coverage tests 2021-03-15 23:26:03 +01:00
Tomasz Miąsko ad8f9af7cb Remove inline-instrument-coverage-fail.rs test case 2021-03-15 23:26:03 +01:00
Tomasz Miąsko 5a9538acb5 Functions inlined into reachable functions are reachable
Consider functions to be reachable for code coverage purposes, either
when they reach the code generation directly, or indirectly as inlined
part of another function.
2021-03-15 23:26:03 +01:00
Tomasz Miąsko 1796cc0e6c Make source-based code coverage compatible with MIR inlining
When codegenning code coverage use the instance that coverage data was
originally generated for, to ensure basic level of compatibility with
MIR inlining.
2021-03-15 23:26:03 +01:00
bors 9cd0f504a9 Auto merge of #6907 - camsteffen:ty-utils, r=flip1995
Move some utils to `clippy_utils::ty`

changelog: none

`clippy_utils::*` has become a giant junk drawer. This is one step to clean it up a bit. One motivation is that I believe the long import statements cause more merge conflicts.
2021-03-15 22:13:45 +00:00
Vadim Petrochenkov 09a9ea69bf Update clippy tests 2021-03-16 00:12:38 +03:00
Vadim Petrochenkov e98b7d1bcf Update clippy tests 2021-03-16 00:12:38 +03:00
Soveu 96d6f22a8e Merge branch 'master' into dedup 2021-03-15 21:51:38 +01:00
Cameron Steffen 6fc52a63d1 Move some utils to clippy_utils::source module 2021-03-15 15:34:15 -05:00
Soveu 2285f11724 Vec::dedup optimization - add test for panic 2021-03-15 21:26:22 +01:00
Aaron Hill d6a7c1d47f Extend proc_macro_back_compat lint to procedural-masquerade
We now lint on *any* use of `procedural-masquerade` crate. While this
crate still exists, its main reverse dependency (`cssparser`) no longer
depends on it. Any crates still depending off should stop doing so, as
it only exists to support very old Rust versions.

If a crate actually needs to support old versions of rustc via
`procedural-masquerade`, then they'll just need to accept the warning
until we remove it entirely (at the same time as the back-compat hack).
The latest version of `procedural-masquerade` does not work with the
latest rustc, but trying to check for the version seems like more
trouble than it's worth.

While working on this, I realized that the `proc-macro-hack` check was
never actually doing anything. The corresponding enum variant in
`proc-macro-hack` is named `Value` or `Nested` - it has never been
called `Input`. Due to a strange Crater issue, the Crater run that
tested adding this did *not* end up testing it - some of the crates that
would have failed did not actually have their tests checked, making it
seem as though the `proc-macro-hack` check was working.

The Crater issue is being discussed at
https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/Nearly.20identical.20Crater.20runs.20processed.20a.20crate.20differently/near/230406661

Despite the `proc-macro-hack` check not actually doing anything, we
haven't gotten any reports from users about their build being broken.
I went ahead and removed it entirely, since it's clear that no one is
being affected by the `proc-macro-hack` regression in practice.
2021-03-15 16:00:49 -04:00
Albin Hedman db9a53b5d7 Constify mem::transmute_copy 2021-03-15 20:45:57 +01:00
Albin Hedman 45988ee438 Constify mem::replace and ptr::replace 2021-03-15 20:45:43 +01:00
Albin Hedman 64e2248794 Constify mem::swap and ptr::swap[_nonoverlapping] 2021-03-15 20:45:22 +01:00
Albin Hedman 62cf244563 Constify copy_to and copy_from 2021-03-15 20:45:20 +01:00
Soveu afdbc9ece1 Vec::dedup optimization - finishing polishes 2021-03-15 20:36:29 +01:00
Soveu 2abab1f688 Vec::dedup optimization - add tests 2021-03-15 20:24:35 +01:00
Mara Bos 924e522d16 Deprecate RustcEncodable and RustcDecodable. 2021-03-15 20:16:16 +01:00
Julian Frimmel ff8717b56d Specify *.woff2 files as binary
This prevents older git versions to change the "line endings".
2021-03-15 20:14:56 +01:00
Vadim Petrochenkov 7e66e9d6b0 More precise spans for HIR paths 2021-03-15 22:13:45 +03:00
Michael Howell dcba95f43e Declare word outside the loop, as recommended by eslint 2021-03-15 11:58:34 -07:00
Cameron Steffen eb7f8d6089 Move some utils to ty_utils 2021-03-15 13:44:09 -05:00
Oli Scherer e67594166e Run tests in nll mode 2021-03-15 18:35:47 +00:00
bors 107896c32d Auto merge of #83121 - the8472:env-rwlock-2, r=joshtriplett
use RWlock when accessing os::env (take 2)

This reverts commit acdca316c3 (#82877) i.e. redoes #81850 since the invalid unlock attempts in the child process have been fixed in #82949

r? `@joshtriplett`
2021-03-15 18:32:10 +00:00
Oli Scherer c2683aa569 Explain each variant of TAIT usage with examples 2021-03-15 17:39:18 +00:00
Oli Scherer 6109d73112 🍼 for tidy 2021-03-15 17:39:13 +00:00