Commit graph

19484 commits

Author SHA1 Message Date
bors
64054693eb Auto merge of #12322 - sanxiyn:expression-with-attribute, r=llogiq
Be careful with expressions with attributes

Fix #9949.

changelog: [`unused_unit`]: skip expressions with attributes
2024-02-24 10:52:55 +00:00
bors
0597838892 Auto merge of #12260 - Jarcho:issue_12255, r=llogiq
Take lifetime extension into account in `ref_as_ptr`

fixes #12255

This should be merged upstream as well. Changing `let x = &temp as *const _` into `let x = from_ref(&temp)` is UB.

changelog: `ref_as_ptr`: Take lifetime extension into account
2024-02-24 04:28:53 +00:00
Jason Newcomb
5ab42d8e6a Take lifetime extension into account in ref_as_ptr 2024-02-23 21:33:53 -05:00
Guillaume Gomez
762448bc55 Update ui tests 2024-02-23 17:38:39 +01:00
J-ZhengLi
929f746b5c fix the actual bug 2024-02-24 00:35:48 +08:00
Guillaume Gomez
6955a8ac4e Add ui test for multiple_bound_locations lint 2024-02-23 16:40:21 +01:00
Guillaume Gomez
d654acd554 Add new multiple_bound_locations lint 2024-02-23 13:22:21 +01:00
J-ZhengLi
0d83a3a18b re-orgnize [useless_vec]'s code 2024-02-23 16:51:07 +08:00
bors
5a52c8aee9 Auto merge of #12333 - MarcusGrass:issue-12223, r=Manishearth
Allow unused_imports, and unused_import_braces on `use`

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

Both `unused_import_braces` and `unused_imports` are valid on `use`-items, additional to the two previously allowed.

changelog: [`useless_attribute`]: Allow `rustc_lint` `unused_import_braces` and `unused_imports` on `use`-items
2024-02-22 22:47:03 +00:00
MarcusGrass
f1974593c9
Remove double unused_imports check 2024-02-22 23:12:38 +01:00
MarcusGrass
97a3ac5b86
Allow unused_imports, and unused_import_braces on use 2024-02-22 21:53:04 +01:00
bors
341ae30a85 Auto merge of #12332 - blyxyas:not-on-vacation, r=blyxyas
Coming back to reviewer rotation

After this current CPP period, in which I set myself as on-vacation to focus on performance, I'm now available again. I'd love if my vacation status wasn't present in version control

changelog:none
r? ghost
2024-02-22 16:06:38 +00:00
blyxyas
c6a720f2f2
Coming back to reviewer rotation 2024-02-22 16:41:01 +01:00
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