Commit Graph

19321 Commits

Author SHA1 Message Date
bors
379342cf7a Auto merge of #12331 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: none
2024-02-22 15:38:27 +00:00
Philipp Krones
8a58b7613d
Update i686 asm test stderr 2024-02-22 16:27:24 +01:00
Philipp Krones
cc6dcaae57
Use Level::from_symbol in unnecessary_clippy_cfg 2024-02-22 16:07:28 +01:00
Philipp Krones
6591dc683e
Bump nightly version -> 2024-02-22 2024-02-22 15:59:39 +01:00
Philipp Krones
dc0bb69e66
Merge remote-tracking branch 'upstream/master' into rustup 2024-02-22 15:59:29 +01:00
bors
d554bcad79 Auto merge of #12303 - GuillaumeGomez:unneedeed_clippy_cfg_attr, r=flip1995
Add `unnecessary_clippy_cfg` lint

Follow-up of https://github.com/rust-lang/rust-clippy/pull/12292.

r? `@flip1995`

changelog: Add `unnecessary_clippy_cfg` lint
2024-02-22 11:00:52 +00:00
Guillaume Gomez
cf6a14cea1 Add ui test for unneeded_clippy_cfg_attr 2024-02-22 11:55:31 +01:00
Guillaume Gomez
f35d87f211 Add unneeded_clippy_cfg_attr lint 2024-02-22 11:52:58 +01:00
bors
422f9c5b65 Auto merge of #12317 - CBSpeir:issue_12291, r=y21
Add check for 'in_external_macro' and 'is_from_proc_macro' inside

changelog: Fix #12291 #[tracing::instrument()] triggers infinite_loop

Added an in_external_macro and is_from_proc_macro check to the [infinite_loop] lint
2024-02-21 22:53:46 +00:00
Christopher B. Speir
b72996e322 Add check for 'in_external_macro' and 'is_from_proc_macro' inside [infinite_loop] lint. 2024-02-21 16:34:07 -06:00
bors
250fd09405 Auto merge of #12324 - GuillaumeGomez:useless_allocation2, r=y21
Extend `unnecessary_to_owned` to handle `Borrow` trait in map types

Fixes https://github.com/rust-lang/rust-clippy/issues/8088.

Alternative to #12315.

r? `@y21`

changelog: Extend `unnecessary_to_owned` to handle `Borrow` trait in map types
2024-02-21 21:38:41 +00:00
Guillaume Gomez
635acb6804 Fix newly detected lint issues 2024-02-21 19:32:08 +01:00
Guillaume Gomez
d28146133c Add more ui tests for unnecessary_to_owned 2024-02-21 19:32:08 +01:00
bors
a056ff37c7 Auto merge of #12323 - not-elm:fix/issue-12279, r=y21
Fix: no_effect_underscore_binding fires on ignored parameters of async fns

Fixes #12279
changelog: Fix [`no_effect_underscore_binding`])

The warning is no longer displayed when an underscore is given in the parameter name of an asynchronous function.
2024-02-21 16:08:37 +00:00
Guillaume Gomez
9cde201ba1 Extend unnecessary_to_owned to handle Borrow trait in map types 2024-02-21 16:23:54 +01:00
taiga.watanabe
672bd5e387 DELETE: Known problems Section
The `Known problems` section was removed because it is old information.
2024-02-21 23:26:30 +09:00
taiga.watanabe
aa8a82ec26 FIX: issue-12279
----
UPDATE: add async block into test.

FIX: no_effect

Fixed asynchronous function parameter names with underscores so that warnings are not displayed when underscores are added to parameter names

ADD: test case
2024-02-21 23:26:29 +09:00
Seo Sanghyeon
cd45d5a81c Be careful with expressions with attributes 2024-02-20 22:18:49 +09:00
bors
31b551fee9 Auto merge of #120576 - nnethercote:merge-Diagnostic-DiagnosticBuilder, r=davidtwco
Overhaul `Diagnostic` and `DiagnosticBuilder`

Implements the first part of https://github.com/rust-lang/compiler-team/issues/722, which moves functionality and use away from `Diagnostic`, onto `DiagnosticBuilder`.

Likely follow-ups:
- Move things around, because this PR was written to minimize diff size, so some things end up in sub-optimal places. E.g. `DiagnosticBuilder` has impls in both `diagnostic.rs` and `diagnostic_builder.rs`.
- Rename `Diagnostic` as `DiagInner` and `DiagnosticBuilder` as `Diag`.

r? `@davidtwco`
2024-02-20 12:05:09 +00:00
bors
ba2139afd6 Auto merge of #121087 - oli-obk:eager_const_failures, r=lcnr
Always evaluate free constants and statics, even if previous errors occurred

work towards https://github.com/rust-lang/rust/issues/79738

We will need to evaluate static items before the `definitions.freeze()` below, as we will start creating new `DefId`s (for nested allocations) within the `eval_static_initializer` query.

But even without that motivation, this is a good change. Hard errors should always be reported and not silenced if other errors happened earlier.
2024-02-20 09:02:34 +00:00
Nicholas Nethercote
86cb711b96 Reduce capabilities of Diagnostic.
Currently many diagnostic modifier methods are available on both
`Diagnostic` and `DiagnosticBuilder`. This commit removes most of them
from `Diagnostic`. To minimize the diff size, it keeps them within
`diagnostic.rs` but changes the surrounding `impl Diagnostic` block to
`impl DiagnosticBuilder`. (I intend to move things around later, to give
a more sensible code layout.)

`Diagnostic` keeps a few methods that it still needs, like `sub`,
`arg`, and `replace_args`.

The `forward!` macro, which defined two additional methods per call
(e.g. `note` and `with_note`), is replaced by the `with_fn!` macro,
which defines one additional method per call (e.g. `with_note`). It's
now also only used when necessary -- not all modifier methods currently
need a `with_*` form. (New ones can be easily added as necessary.)

All this also requires changing `trait AddToDiagnostic` so its methods
take `DiagnosticBuilder` instead of `Diagnostic`, which leads to many
mechanical changes. `SubdiagnosticMessageOp` gains a type parameter `G`.

There are three subdiagnostics -- `DelayedAtWithoutNewline`,
`DelayedAtWithNewline`, and `InvalidFlushedDelayedDiagnosticLevel` --
that are created within the diagnostics machinery and appended to
external diagnostics. These are handled at the `Diagnostic` level, which
means it's now hard to construct them via `derive(Diagnostic)`, so
instead we construct them by hand. This has no effect on what they look
like when printed.

There are lots of new `allow` markers for `untranslatable_diagnostics`
and `diagnostics_outside_of_impl`. This is because
`#[rustc_lint_diagnostics]` annotations were present on the `Diagnostic`
modifier methods, but missing from the `DiagnosticBuilder` modifier
methods. They're now present.
2024-02-20 13:22:17 +11:00
Oli Scherer
d136b05c1b Always evaluate free constants and statics, even if previous errors occurred 2024-02-19 22:11:13 +00:00
teor
6bc7c96bb3 cargo bless 2024-02-20 07:53:04 +10:00
teor
367a403367 Add test coverage for cast_sign_loss changes 2024-02-20 07:52:40 +10:00
teor
f40279ff7d Add some more test cases 2024-02-20 07:52:35 +10:00
teor
6670acd287 Check for all-positive or all-negative sums 2024-02-20 07:51:21 +10:00
teor
1cbb58bd06 Fix divmul peeling 2024-02-20 07:51:21 +10:00
teor
d109e68178 Add some TODO comments 2024-02-20 07:51:21 +10:00
teor
6dfff19090 clippy_dogfood 2024-02-20 07:51:21 +10:00
teor
740441fd98 Use the visitor pattern instead of recusive functions 2024-02-20 07:51:21 +10:00
teor
4ab2ed33a0 Put muldiv peeling in its own method 2024-02-20 07:51:21 +10:00
teor
11e0d6acca Move muldiv peeling into expr_sign 2024-02-20 07:51:21 +10:00
teor
8b615af760 Fix clippy_dogfood 2024-02-20 07:51:21 +10:00
teor
e74fe4362a Check for both signed and unsigned constant expressions 2024-02-20 07:51:21 +10:00
teor
c5e8487d63 Fix pow() to return more known signs 2024-02-20 07:51:21 +10:00
teor
47339d01f8 Bless fixed cast_sign_loss false negatives 2024-02-20 07:50:56 +10:00
teor
28f247e16c Use the expanded method lists 2024-02-20 07:45:46 +10:00
teor
e51fcd03dc Make pow_call_result_sign compile 2024-02-20 07:45:46 +10:00
teor
02214f2ac0 Expand method lists 2024-02-20 07:45:46 +10:00
teor
ee8fd82f4c Fix uncertain sign and remainder op handling in cast_sign_loss.rs 2024-02-20 07:45:46 +10:00
Santiago Pastorino
16d5a2be3d Remove suspicious auto trait lint 2024-02-19 17:41:48 -03:00
bors
6aa5f1ac6f Auto merge of #12314 - Alexendoo:output-conflict-handling, r=flip1995
Default test output conflict handling to error

https://github.com/oli-obk/ui_test/pull/175 got rid of the `bool` that controlled the default handling so we need to specify it ourselves

r? `@flip1995`

changelog: none
2024-02-19 14:30:35 +00:00
Alex Macleod
f67c3f4bd8 Default test output conflict handling to error 2024-02-19 14:20:11 +00:00
bors
fa2a3c5208 Auto merge of #12059 - roife:fix/issue-11223, r=Alexendoo
Fix issue 11223: add check for identical guards in lint `match_same_arms`

fixes #11223

In the current `match_same_arms` implementation, if arms have guards, they are considered different. This commit adds equality checking for guards: arms are now considered equivalent only when they either both have no guards or their guards are identical.

The portion responsible for checking guard equality is refactored to reuse the existing code for checking body equality. This is abstracted into a function called `check_eq_with_pat`. To optimize performance, `check_same_guard` and `check_same_body` here use closures for lazy evaluation, ensuring that the calculation is only performed when `!(backwards_blocking_idxs...)` is true.

changelog: [`match_same_arms`]: Add check for identical guards
2024-02-19 14:03:56 +00:00
roife
087c7c828d Add check for same guards in match_same_arms 2024-02-19 13:49:32 +00:00
Nicholas Nethercote
a16dbd7339 Prefer DiagnosticBuilder over Diagnostic in diagnostic modifiers.
There are lots of functions that modify a diagnostic. This can be via a
`&mut Diagnostic` or a `&mut DiagnosticBuilder`, because the latter type
wraps the former and impls `DerefMut`.

This commit converts all the `&mut Diagnostic` occurrences to `&mut
DiagnosticBuilder`. This is a step towards greatly simplifying
`Diagnostic`. Some of the relevant function are made generic, because
they deal with both errors and warnings. No function bodies are changed,
because all the modifier methods are available on both `Diagnostic` and
`DiagnosticBuilder`.
2024-02-19 20:23:20 +11:00
bors
74f611f7fc Auto merge of #12306 - Alexendoo:dir-replacement, r=flip1995
Remove `$DIR` replacement

This won't cause problems because the old `$DIR` replacement was based on the parent of the test path, which for us is relative: 5471e0645a/tests/compile-test.rs (L122)

The new pattern being `"tests/{test_dir}"` is more clearly relative

That's why we have custom filters applied to the toml/cargo tests where absolute paths do appear in the output 5471e0645a/tests/compile-test.rs (L198-L202)

Removing it allows clicking the paths in the terminal

changelog: none

r? `@flip1995`
2024-02-19 09:20:07 +00:00
bors
2a3c0334f7 Auto merge of #12313 - alex:patch-1, r=Alexendoo
Upgrade anstream to 0.6.0

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

changelog: none
2024-02-19 00:13:28 +00:00
Alex Gaynor
98e26b3483
Upgrade anstream to 0.6.0 2024-02-18 15:18:21 -05:00
bors
5a50481411 Auto merge of #12309 - Tyrubias:fix-allow-pub-under, r=y21
fix: make `#[allow]` work on field for `pub_underscore_fields`

Closes #12286

changelog: `#[allow(clippy::pub_underscore_fields)]` now works on linted field
2024-02-18 11:58:57 +00:00