Commit Graph

310 Commits

Author SHA1 Message Date
bors
a04a7cd9f9 Auto merge of #7779 - rust-lang:test_module, r=flip1995
make test module detection more strict

I started with some small improvements to clippy_utils/src/lib.rs, but then found that our "test" module detection would also catch words containing "test" like e.g. "attestation". So I made this a bit more strict (splitting by `'_'` and checking for `test` or `tests`), adding a test case as I went.

---

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none
2021-10-07 09:36:51 +00:00
flip1995
9613df9c85
Allow invalid-paths for regex paths 2021-10-07 11:12:02 +02:00
flip1995
1f955158dd
Merge remote-tracking branch 'upstream/master' into rustup 2021-10-07 11:11:23 +02:00
Andre Bogus
86811e9b1b make test module detection more strict 2021-10-07 00:14:06 +02:00
Klim Tsoutsman
8b37928131
Fix typos
I'm not sure whether I should add links to `bool`, `char`, and `str`. `slice` could also be linked to.
2021-10-06 23:32:22 +11:00
dswij
42f2304ce4 Drop exponent suggestion when 0
This commit changes numeric literal formatting to drop exponent when
exponent is 0.
2021-10-06 15:02:38 +08:00
hkalbasi
388a3d0983 Implement equatable if let lint 2021-10-04 22:16:42 +03:30
Cameron Steffen
e165c12932 Make diangostic item names consistent 2021-10-02 19:38:19 -05:00
Manish Goregaokar
6bf5c0b185 Correctly handle signs in exponents in numeric_literal::format() 2021-10-01 17:27:47 -07:00
Manish Goregaokar
6d18c9912f Rollup merge of #88963 - fee1-dead:const-iterator, r=oli-obk
Coerce const FnDefs to implement const Fn traits

You can now pass a FnDef to a function expecting `F` where `F: ~const FnTrait`.

r? ``@oli-obk``

``@rustbot`` label T-compiler F-const_trait_impl
2021-10-01 14:46:48 -07:00
Cameron Steffen
a17359c696 Remove shadow allows 2021-09-30 14:07:58 -05:00
bors
ab99eec15f Auto merge of #7684 - surechen:solve_derivable_impls, r=flip1995
fix for issue #7683

Fixes #7683.

For Repeat  [x; y] (x is the type and y is the times to repeat) . When y > 32, the compiler will report an error:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=7148558162685e91056e0550797ea74c

Because 6cdd42f9f8/library/std/src/primitive_docs.rs (L538)
/// Arrays of sizes from 0 to 32 (inclusive) implement [`Default`] trait
/// if the element type allows it. As a stopgap, trait implementations are
/// statically generated up to size 32.

So here to detect this situation.

changelog: [`derivable_impls`]: No longer lints when arrays bigger than 32 elements are involved
2021-09-30 08:19:58 +00:00
surechen
a3d3735515 Arrays of sizes from 0 to 32 (inclusive) implement [Default] trait, edit method is_default_equivalent() to satisfy with this. 2021-09-30 10:41:36 +08:00
flip1995
23d5457e6d Merge commit 'cb7915b00c235e9b5861564f3be78dba330980ee' into clippyup 2021-09-28 18:03:12 +01:00
flip1995
ec38746b4a
Allow internal lint INVALID_PATHS for itertools path
Since clippy_utils doesn't depend on the itertools crate anymore, the
lint can't find the path.
2021-09-28 17:07:51 +01:00
flip1995
707494eca9
Merge remote-tracking branch 'upstream/master' into rustup 2021-09-28 10:52:31 +01:00
Matthias Krüger
c3515c301d bump clippy crates to edition 2021 2021-09-25 22:40:58 +02:00
bors
aef45770f8 Auto merge of #89030 - nbdd0121:box2, r=jonas-schievink
Introduce `Rvalue::ShallowInitBox`

Polished version of #88700.

Implements MCP rust-lang/compiler-team#460, and should allow #43596 to go forward.

In short, creating an empty box is split from a nullary-op `NullOp::Box` into two steps, first a call to `exchange_malloc`, then a `Rvalue::ShallowInitBox` which transmutes `*mut u8` to a shallow-initialized `Box<T>`. This allows the `exchange_malloc` call to unwind. Details can be found in the MCP.

`NullOp::Box` is not yet removed, purely to make reverting easier in case anything goes wrong as the result of this PR. If revert is needed a reversion of "Use Rvalue::ShallowInitBox for box expression" commit followed by a test bless should be sufficient.

Experiments in #88700 showed a very slight compile-time perf regression due to (supposedly) slightly more time spent in LLVM. We could omit unwind edge generation (in non-`oom=panic` case) in box expression MIR construction to restore perf; but I don't think it's necessary since runtime perf isn't affected and perf difference is rather small.
2021-09-25 11:01:13 +00:00
Gary Guo
fc8edf12cd Introduce Rvalue::ShallowInitBox 2021-09-25 01:08:41 +01:00
Labelray
543b638dbe Add new lint if_then_panic 2021-09-24 22:14:20 +08:00
bors
edaeacfbbb Auto merge of #89139 - camsteffen:write-perf, r=Mark-Simulacrum
Use ZST for fmt unsafety

as suggested here - https://github.com/rust-lang/rust/pull/83302#issuecomment-923529151.
2021-09-23 02:10:26 +00:00
Cameron Steffen
4873ebee4c Use ZST for fmt unsafety
This allows the format_args! macro to keep the pre-expansion code out of
the unsafe block without doing gymnastics with nested `match`
expressions. This reduces codegen.
2021-09-21 10:04:44 -05:00
Cameron Steffen
19a3116feb Remove needless hir Map ref 2021-09-18 15:55:34 -05:00
Deadbeef
3e5f80f009 Move is_const_fn to under TyCtxt 2021-09-15 11:27:34 +00:00
David Tolnay
c2783c1dcb
Downgrade many_single_char_names to pedantic 2021-09-14 09:59:06 -07:00
Guillaume Gomez
d37f1091e8 Update permissions path for clippy lint 2021-09-13 21:27:53 +02:00
bors
1add837c91 Auto merge of #88517 - smoelius:without-patch-versions, r=flip1995
Update Clippy dependencies without patch versions

Trial run for https://github.com/rust-lang/rust-clippy/pull/7606
2021-09-13 02:45:18 +00:00
bors
00d45fe5b7 Auto merge of #88839 - nbdd0121:alignof, r=nagisa
Introduce NullOp::AlignOf

This PR introduces `Rvalue::NullaryOp(NullOp::AlignOf, ty)`, which will be lowered from `align_of`, similar to `size_of` lowering to `Rvalue::NullaryOp(NullOp::SizeOf, ty)`.

The changes are originally part of #88700 but since it's not dependent on other changes and could have performance impact on its own, it's separated into its own PR.
2021-09-12 23:49:24 +00:00
Gary Guo
5d93d9d040 Introduce NullOp::AlignOf 2021-09-13 00:08:35 +01:00
Vadim Petrochenkov
9163ac9595 rustc: Remove local variable IDs from Exports
Local variables can never be exported.
2021-09-10 23:41:48 +03:00
Cameron Steffen
ae2a95fadc Eat dogfood 2021-09-09 17:10:59 -05:00
Samuel E. Moelius III
43ed2065cc Update dependencies 2021-09-09 07:47:16 -04:00
bors
261e34d534 Auto merge of #88615 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2021-09-08 23:52:31 +00:00
flip1995
091ed44b50 Merge commit '27afd6ade4bb1123a8bf82001629b69d23d62aff' into clippyup 2021-09-08 16:31:47 +02:00
Cameron Steffen
ffe21e58a0
Remove unused dependencies 2021-09-08 11:13:44 +02:00
flip1995
563a00b2a0
Bump Clippy Version -> 0.1.57 2021-09-08 10:59:04 +02:00
Camille GILLOT
98e8682cb4 Rename rustc_mir to rustc_const_eval. 2021-09-07 20:46:26 +02:00
Michael Wright
a7a5a5d9b0 Add TAU to approx_constant 2021-09-07 05:50:04 +02:00
bors
e5ae3f5491 Auto merge of #7629 - mikerite:fix-7623-2, r=xFrednet
Make `approx_const` MSRV aware

changelog: [`approx_const`]: Add MRSV checks for LOG10_2 and LOG2_10.

Fixes #7623
2021-09-05 13:17:02 +00:00
bors
a8c269ad50 Auto merge of #7570 - HKalbasi:derivable-impls, r=camsteffen
Add the `derivable_impls` lint

Fix #7550

changelog: Add new derivable_impls lint. mem_replace_with_default now covers non constructor cases.
2021-09-04 21:40:04 +00:00
hamidreza kalbasi
8221f9e795 add derivable impls lint 2021-09-05 01:25:59 +04:30
Michael Wright
a23af89447 Make approx_const MSRV aware
Fixes #7623.
2021-09-03 08:34:34 +02:00
Jake Goulding
b4775435e8 Adjust the output of unnecessary_unwrap and provide a suggestion 2021-09-02 20:52:16 -04:00
flip1995
01b17af108
Fix fallout from re-applying patches 2021-09-02 13:04:47 +01:00
Cameron Steffen
c2bb313e7a
Add higher docs and remove some unneeded fields 2021-09-02 12:41:30 +01:00
flip1995
c7c2036cb9
Fix remaining dogfood errors
Except for the missing docs ones
2021-09-02 12:40:52 +01:00
Cameron Steffen
588367b62e
Fix dogfood 2021-09-02 12:39:54 +01:00
Cameron Steffen
5722a7dacd
Fix manual_match with let-expressions 2021-09-02 12:38:59 +01:00
flip1995
61bb96738c
Merge remote-tracking branch 'upstream/master' into rustup2 2021-09-02 12:38:17 +01:00
Cameron Steffen
78bf4acc3a Fix clippy for let-else 2021-08-30 20:18:41 -05:00