Commit Graph

16128 Commits

Author SHA1 Message Date
bors
d227f18c2e Auto merge of #10225 - evantypanski:et/issue10132, r=flip1995
[`unused_io_amount`]: Lint with `is_ok` and `is_err`

Fixes #10132

changelog: Apply [`unused_io_amount`] lint to `is_ok` and `is_err` without checking read/write amount
2023-01-31 08:20:21 +00:00
bors
e1224cd4cd Auto merge of #10257 - tylerjw:issue_5283, r=flip1995
needless_lifetimes: lint local macros

fixes #5283

changelog: [`needless_lifetimes`]: lint local macros
2023-01-31 07:49:58 +00:00
Manish Goregaokar
b4e2b48270 Mark uninlined_format_args as pedantic 2023-01-30 19:28:27 -08:00
Tyler Weaver
df7cdf732d
Pull the is_external test out of the loop 2023-01-30 17:29:29 -07:00
Tyler Weaver
c531b09eb8
Check external before hidden 2023-01-30 17:29:29 -07:00
Tyler Weaver
2432e97d6a
wildcard_enum_match_arm lint takes the enum origin into account
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-30 17:29:29 -07:00
Tyler Weaver
4fde96c30e
Test needless_lifetimes within external macro
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-30 16:16:53 -07:00
Tyler Weaver
c959813bfd
needless_lifetimes: macro test
Signed-off-by: Tyler Weaver <maybe@tylerjw.dev>
2023-01-30 16:04:31 -07:00
Esteban Küber
821199c885 Modify primary span label for E0308
The previous output was unintuitive to users.
2023-01-30 20:12:19 +00:00
bors
d020fd7fe6 Auto merge of #10260 - Niki4tap:external_macro_fp, r=xFrednet
`multiple_unsafe_ops_per_block`: Don't lint in external macros

Fixes #10259

changelog: FP: [`multiple_unsafe_ops_per_block`]: No longer lints in external macros
[#10260](https://github.com/rust-lang/rust-clippy/pull/10260)
<!-- changelog_none -->
2023-01-30 20:10:19 +00:00
bors
173fac0989 Auto merge of #10255 - khayyamsaleem:issue_9520, r=Jarcho
prevents `len_without_is_empty` from yielding positive when `len` takes arguments besides `&self`

Fixes #9520

---

changelog: FP [`len_without_is_empty`]: No longer lints, if `len` as a non-default signature
[#10255](https://github.com/rust-lang/rust-clippy/pull/10255)
<!-- changelog_checked -->
2023-01-30 19:08:04 +00:00
Niki4tap
926c5e4cde multiple_unsafe_ops_per_block: don't lint in external macros 2023-01-30 20:42:40 +03:00
bors
d92070a7b9 Auto merge of #10254 - tylerjw:issue_6929, r=Manishearth
needless_range_loop: improve documentation

fixes #6929

changelog: [`needless_range_loop`]: improve documentation
2023-01-30 17:30:32 +00:00
Tyler Weaver
5ed191de6b
bless 2023-01-30 10:10:52 -07:00
Tyler Weaver
3b225e3a96
Update clippy_lints/src/loops/needless_range_loop.rs
Co-authored-by: Manish Goregaokar <manishsmail@gmail.com>
2023-01-30 09:59:26 -07:00
bors
8fb0041f47 Auto merge of #10248 - koka831:missing-config, r=xFrednet
Missing config

This PR addresses https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Some.20lints.20miss.20its.20config/near/318460000.

changelog: Documentation: Made sure that lint configurations on Clippy's lint list are all up to date
[#10248](https://github.com/rust-lang/rust-clippy/pull/10248)
<!-- changelog_checked -->

r? `@xFrednet`

---

I have tried to create [a prototype](https://github.com/koka831/rust-clippy/pull/1), but have not yet found a good way to implement it.
So I would like to put it aside for now and try again after addressing other issues so that I can understand how clippy works better:)
2023-01-30 16:40:25 +00:00
koka
a9e6b12854
fix: use correct lint name
fix
2023-01-30 20:35:35 +09:00
Sylvain Desodt
ecde2019e9 Fix version declared for semicolon_inside_block and semicolon_outside_block
As per Issue #10244, the lint were documentated
as being part of 1.66.0 but will actually be
released 1.68.0 .
2023-01-30 10:01:38 +01:00
ksaleem
2fd94a4e01 prevents len_without_is_empty from yielding positive when len takes
more than just `&self` in non-standard implementations.

changelog: Fix [`len_without_is_empty`] false positive when len has a
non-standard method signature

Fixes #9520
2023-01-29 17:35:36 -05:00
Tyler Weaver
4d266d31de
needless_range_loop: improve documentation 2023-01-29 11:41:53 -07:00
bors
96c28d1f69 Auto merge of #10231 - Alexendoo:regex-spans, r=llogiq
`invalid_regex`: Show full error when string value doesn't match source

changelog: [`invalid_regex`]: Show full error when parsing non-literals or regular strings containing escape sequences

Fixes #4170, the escape sequence there causes the span to be incorrect which will have caused most of the confusion
2023-01-29 14:13:58 +00:00
bors
17369f324c Auto merge of #106227 - bryangarza:ctfe-limit, r=oli-obk
Use stable metric for const eval limit instead of current terminator-based logic

This patch adds a `MirPass` that inserts a new MIR instruction `ConstEvalCounter` to any loops and function calls in the CFG. This instruction is used during Const Eval to count against the `const_eval_limit`, and emit the `StepLimitReached` error, replacing the current logic which uses Terminators only.

The new method of counting loops and function calls should be more stable across compiler versions (i.e., not cause crates that compiled successfully before, to no longer compile when changes to the MIR generation/optimization are made).

Also see: #103877
2023-01-29 04:11:27 +00:00
koka
af62bf95a3
fix key name of MUTABLE_KEY_TYPE 2023-01-29 03:13:30 +09:00
koka
d87a6bc9b1
add MANUAL_RETAIN to msrv
MANUAL_RETAIN uses
- msrvs::STRING_RETAIN
- msrvs::BTREE_SET_RETAIN
- msrvs::BTREE_MAP_RETAIN
- msrvs::HASH_SET_RETAIN
- msrvs::HASH_MAP_RETAIN
2023-01-29 03:07:09 +09:00
koka
2f4b047b27
add MANUAL_REM_EUCLID to msrv
MANUAL_REM_EUCLID uses msrvs::REM_EUCLID
2023-01-29 03:04:56 +09:00
koka
1766532b20
add MANUAL_IS_ASCII_CHECK to msrv
MANUAL_IS_ASCII_CHECK uses msrvs::IS_ASCII_DIGIT and msrvs::IS_ASCII_DIGIT_CONST
2023-01-29 03:02:23 +09:00
koka
25d455bd17
fix: add missing dot to suppress_restriction_lint_in_const 2023-01-29 02:54:26 +09:00
koka
e791522d35
add DERIVABLE_IMPLS to msrv
DERIVABLE_IMPLS uses msrvs::DEFAULT_ENUM_ATTRIBUTE
2023-01-29 02:39:37 +09:00
koka
fb77b02789
add NEEDLESS_BORROW to msrv
NEEDLESS_BORROW uses msrvs::ARRAY_INTO_ITERATOR
2023-01-29 02:37:00 +09:00
koka
7716d69757
fix: add missing dot to AWAIT_HOLDING_INVALID_TYPE 2023-01-29 02:27:43 +09:00
koka
e65f9f9d32
add ALMOST_COMPLETE_RANGE to msrv
ALMOST_COMPLETE_RANGE uses msrvs::RANGE_INCLUSIVE
2023-01-29 02:22:10 +09:00
koka
07a8bf15ff
add TRANSMUTE_PTR_TO_REF to msrv
TRANSMUTE_PTR_TO_REF uses msrvs::POINTER_CAST
2023-01-29 02:14:38 +09:00
koka
532841fcae
add UNNECESSARY_LAZY_EVALUATIONS to msrv
UNNECESSARY_LAZY_EVALUATIONS uses msrvs::BOOL_THEN_SOME for `then` to
`then_some`
2023-01-29 02:02:46 +09:00
koka
a05e86f5dd
add SEEK_REWIND in msrv
SEEK_REWIND uses msrvs::SEEK_REWIND
2023-01-29 01:54:31 +09:00
koka
5a9c4a0090
add SEEK_FROM_CURRENT in msrv
SEEK_FROM_CURRENT uses msrvs::SEEK_FROM_CURRENT
2023-01-29 01:52:05 +09:00
koka
a0460cf37d
add COLLAPSIBLE_STR_REPLACE in msrv
COLLAPSIBLE_STR_REPLACE uses msrvs::PATTERN_TRAIT_CHAR_ARRAY
2023-01-29 01:49:10 +09:00
bors
79475f56ec Auto merge of #107206 - cjgillot:no-h2l-map, r=WaffleLapkin
Remove HirId -> LocalDefId map from HIR.

Having this map in HIR prevents the creating of new definitions after HIR has been built.
Thankfully, we do not need it.

Based on https://github.com/rust-lang/rust/pull/103902
2023-01-28 16:11:33 +00:00
bors
75c8179c25 Auto merge of #107408 - matthiaskrgr:rollup-b5vz2ow, r=matthiaskrgr
Rollup of 9 pull requests

Successful merges:

 - #104012 (Improve unexpected close and mismatch delimiter hint in TokenTreesReader)
 - #104252 (Stabilize the const_socketaddr feature)
 - #105524 (Replace libc::{type} with crate::ffi::{type})
 - #107096 (Detect references to non-existant messages in Fluent resources)
 - #107355 (Add regression test for #60755)
 - #107384 (Remove `BOOL_TY_FOR_UNIT_TESTING`)
 - #107385 (Use `FallibleTypeFolder` for `ConstInferUnifier` not `TypeRelation`)
 - #107391 (rustdoc: remove inline javascript from copy-path button)
 - #107398 (Remove `ControlFlow::{BREAK, CONTINUE}`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-28 13:12:59 +00:00
Matthias Krüger
a493717718 Rollup merge of #107398 - scottmcm:its-their-funeral, r=dtolnay
Remove `ControlFlow::{BREAK, CONTINUE}`

Libs-API decided to remove these in #102697.

Follow-up to #107023, which removed them from `compiler/`, but a couple new ones showed up since that was merged.

r? libs
2023-01-28 11:11:09 +01:00
bors
3a68217f49 Auto merge of #106916 - lukas-code:overlapping-substs, r=estebank
Remove overlapping parts of multipart suggestions

This PR adds a debug assertion that the parts of a single substitution cannot overlap, fixes a overlapping substitution from the testsuite, and fixes https://github.com/rust-lang/rust/issues/106870.

Note that a single suggestion can still have multiple overlapping substitutions / possible edits, we just don't suggest overlapping replacements in a single edit anymore.

I've also included a fix for an unrelated bug where rustfix for `explicit_outlives_requirements` would produce multiple trailing commas for a where clause.
2023-01-28 10:00:56 +00:00
Camille GILLOT
3e32533cc2 Remove HirId -> LocalDefId map from HIR. 2023-01-28 09:55:26 +00:00
Camille GILLOT
92c4f1e2d9 Take a LocalDefId in hir::Visitor::visit_fn. 2023-01-28 09:51:50 +00:00
Scott McMurray
e65a7ff0b3 Remove from librustdoc and clippy too 2023-01-27 20:44:19 -08:00
bors
06e785548b Auto merge of #101692 - cjgillot:generator-lazy-witness, r=oli-obk
Compute generator saved locals on MIR

Generators are currently type-checked by introducing a `witness` type variable, which is unified with a `GeneratorWitness(captured types)` whose purpose is to ensure that the auto traits correctly migrate from the captured types to the `witness` type.  This requires computing the captured types on HIR during type-checking, only to re-do it on MIR later.

This PR proposes to drop the HIR-based computation, and only keep the MIR one.  This is done in 3 steps.
1. During type-checking, the `witness` type variable is never unified.  This allows to stall all the obligations that depend on it until the end of type-checking.  Then, the stalled obligations are marked as successful, and saved into the typeck results for later verification.
2. At type-checking writeback, `witness` is replaced by `GeneratorWitnessMIR(def_id, substs)`.  From this point on, all trait selection involving `GeneratorWitnessMIR` will fetch the MIR-computed locals, similar to what opaque types do.  There is no lifetime to be preserved here: we consider all the lifetimes appearing in this witness type to be higher-ranked.
3. After borrowck, the stashed obligations are verified against the actually computed types, in the `check_generator_obligations` query.  If any obligation was wrongly marked as fulfilled in step 1, it should be reported here.

There are still many issues:
- ~I am not too happy having to filter out some locals from the checked bounds, I think this is MIR building that introduces raw pointers polluting the analysis;~ solved by a check specific to static variables.
- the diagnostics for captured types don't show where they are used/dropped;
- I do not attempt to support chalk.

cc `@eholk` `@jyn514` for the drop-tracking work
r? `@oli-obk` as you warned me of potential unsoundness
2023-01-28 01:05:29 +00:00
bors
997fe0d57e Auto merge of #107386 - flip1995:clippyup, r=Manishearth
Update Clippy

r? `@Manishearth`
2023-01-27 21:20:39 +00:00
Philipp Krones
5c7a65251a Merge commit '1480cea393d0cee195e59949eabdfbcf1230f7f9' into clippyup 2023-01-27 21:09:08 +01:00
bors
1480cea393 Auto merge of #10242 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2023-01-27 19:31:37 +00:00
Philipp Krones
6f9c70a201
Bump Clippy version -> 0.1.69 2023-01-27 20:27:00 +01:00
Philipp Krones
1f403e9ab9
Bump nightly version -> 2023-01-27 2023-01-27 20:26:48 +01:00
Philipp Krones
2bc2431fd1
Merge remote-tracking branch 'upstream/master' into rustup 2023-01-27 20:26:35 +01:00