Skip to content

Conversation

@flip1995
Copy link
Member

profetia and others added 30 commits October 11, 2025 03:02
Their meanings, and the way they're handled in `get_attr`, are pretty
similar
- Move it and its helper function `parse_attrs` together to the end
  of the file, because it's surprising to see front-and-center a struct
  that's only really used in one place (`cognitive_complexity`).
- Avoid panic path in `LimitStack::limit`
- Replace `assert` with `debug_assert` to avoid panics in release builds
Now we don't touch, and thus don't break, whatever path `Rc`/`Arc` was
specified with
Move `unused_enumerate_index.rs` to `methods`.
Fix rust-lang/rust-clippy#14350

Co-authored-by: Timo <30553356+y21@users.noreply.github.com>
…dead

Constify trait aliases

Allow `const trait Foo = Bar + [const] Baz;` trait alias declarations. Their rules are the same as with super traits of const traits. So `[const] Baz` or `const Baz` is only required for `[const] Foo` or `const Foo` bounds respectively.

tracking issue rust-lang#41517 (part of the general trait alias feature gate, but I can split it out into a separate const trait alias feature gate. I just assumed that const traits would stabilize before trait aliases, and we'd want to stabilize trait aliases together with const trait aliases at the same time)

r? ``@compiler-errors`` ``@fee1-dead``
@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2025

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. labels Nov 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 15, 2025

⚠️ Warning ⚠️

@flip1995
Copy link
Member Author

@madsmtm could you take a look at the Cargo.lock update here, please? A bit surprising that Clippy just added the tikv allocator in Cargo.lock 🤔

Comment on lines +121 to +123
// FIXME: This should not be affected by the attribute on the function above.
fn bloo() {
//~^ cognitive_complexity
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't have started linting. But it is too late here and I'm pretty exhausted from this week to try to look into what changed in the check_attributes_after behavior of a restriction lint...

@flip1995
Copy link
Member Author

flip1995 commented Nov 15, 2025

cc @RalfJung This syncs the MSRV fixes, that you need. Sorry for the 1+ day delay.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/ui/should_impl_trait/method_list_1.rs (revision `edition2021`) ... ok
tests/ui/size_of_in_element_count/functions.rs ... ok

FAILED TEST: tests/ui/cognitive_complexity.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--test" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/cognitive_complexity.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/cognitive_complexity.stderr` to the actual output
--- tests/ui/cognitive_complexity.stderr
+++ <stderr output>
---

error: the function has a cognitive complexity of (7/1)
##[error]  --> tests/ui/cognitive_complexity.rs:98:4
   |
LL | fn kaboom() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:264:4
   |
LL | fn barrrr() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (3/1)
##[error]  --> tests/ui/cognitive_complexity.rs:276:4
   |
LL | fn barrrr2() {
   |    ^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:339:4
   |
LL | fn void(void: Void) {
   |    ^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (8/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:415:13
   |
LL |     let x = |a: i32, b: i32| -> i32 {
   |             ^^^^^^^^^^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (7/1)
##[error]  --> tests/ui/cognitive_complexity.rs:98:4
   |
LL | fn kaboom() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:264:4
   |
LL | fn barrrr() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (3/1)
##[error]  --> tests/ui/cognitive_complexity.rs:276:4
   |
LL | fn barrrr2() {
   |    ^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:339:4
   |
LL | fn void(void: Void) {
   |    ^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (8/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:415:13
   |
LL |     let x = |a: i32, b: i32| -> i32 {
   |             ^^^^^^^^^^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)

@Manishearth
Copy link
Member

@bors r+ p=1 rollup=never

@bors
Copy link
Collaborator

bors commented Nov 15, 2025

📌 Commit ea43cab has been approved by Manishearth

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 15, 2025
@bors
Copy link
Collaborator

bors commented Nov 15, 2025

⌛ Testing commit ea43cab with merge 0cd2ee4...

bors added a commit that referenced this pull request Nov 15, 2025
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
tests/ui/crashes/third-party/conf_allowlisted.rs ... ok
tests/ui/size_of_in_element_count/functions.rs ... ok

FAILED TEST: tests/ui/cognitive_complexity.rs
command: CLIPPY_CONF_DIR="tests" RUSTC_ICE="0" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/release/clippy-driver" "--error-format=json" "--emit=metadata" "-Aunused" "-Ainternal_features" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Dwarnings" "-Ldependency=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/release/deps" "--sysroot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2" "--test" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/ui_test/0/tests/ui" "tests/ui/cognitive_complexity.rs" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rlib" "--extern" "futures=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libfutures-a8bf6f69c9b80e37.rmeta" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rlib" "--extern" "itertools=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libitertools-2d82d3ce68d9c3ee.rmeta" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rlib" "--extern" "libc=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/liblibc-e86cd1a7c22fc60c.rmeta" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rlib" "--extern" "parking_lot=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libparking_lot-a94abfa769f04e5d.rmeta" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rlib" "--extern" "quote=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libquote-22b65b7753b00e23.rmeta" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rlib" "--extern" "regex=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libregex-4368476ea091f8ef.rmeta" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rlib" "--extern" "serde=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libserde-978a92b8a77cdf3d.rmeta" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rlib" "--extern" "syn=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libsyn-fdddf18d670fbd00.rmeta" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rlib" "--extern" "tokio=/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps/libtokio-1fc6a815de90452d.rmeta" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/debug/deps" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2-tools/x86_64-unknown-linux-gnu/debug/deps" "--edition" "2024"

error: actual output differed from expected
Execute `./x test src/tools/clippy --bless` to update `tests/ui/cognitive_complexity.stderr` to the actual output
--- tests/ui/cognitive_complexity.stderr
+++ <stderr output>
---

error: the function has a cognitive complexity of (7/1)
##[error]  --> tests/ui/cognitive_complexity.rs:98:4
   |
LL | fn kaboom() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:264:4
   |
LL | fn barrrr() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (3/1)
##[error]  --> tests/ui/cognitive_complexity.rs:276:4
   |
LL | fn barrrr2() {
   |    ^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:339:4
   |
LL | fn void(void: Void) {
   |    ^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (8/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:415:13
   |
LL |     let x = |a: i32, b: i32| -> i32 {
   |             ^^^^^^^^^^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (7/1)
##[error]  --> tests/ui/cognitive_complexity.rs:98:4
   |
LL | fn kaboom() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:264:4
   |
LL | fn barrrr() {
   |    ^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (3/1)
##[error]  --> tests/ui/cognitive_complexity.rs:276:4
   |
LL | fn barrrr2() {
   |    ^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:339:4
   |
LL | fn void(void: Void) {
   |    ^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (8/1)
---

error: the function has a cognitive complexity of (2/1)
##[error]  --> tests/ui/cognitive_complexity.rs:415:13
   |
LL |     let x = |a: i32, b: i32| -> i32 {
   |             ^^^^^^^^^^^^^^^^
   |
   = help: you could split it up into multiple smaller functions

error: the function has a cognitive complexity of (2/1)

@bors
Copy link
Collaborator

bors commented Nov 15, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.