Skip to content

Bring back enum DepKind.#152747

Open
nnethercote wants to merge 5 commits intorust-lang:mainfrom
nnethercote:bring-back-enum-DepKind
Open

Bring back enum DepKind.#152747
nnethercote wants to merge 5 commits intorust-lang:mainfrom
nnethercote:bring-back-enum-DepKind

Conversation

@nnethercote
Copy link
Contributor

@nnethercote nnethercote commented Feb 17, 2026

It was removed in #115920 to enable it being moved to rustc_query_system, a move that has recently been reversed. It's much simpler as an enum.

r? @Zalathar

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 2026

Zalathar is not on the review rotation at the moment.
They may take a while to respond.

@rustbot

This comment has been minimized.

@Zalathar
Copy link
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Feb 17, 2026
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 17, 2026
@Zalathar
Copy link
Member

Looks good, r=me after perf comes back.

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

☀️ Try build successful (CI)
Build commit: 11ae63e (11ae63e43fee516d0d07042853a8a7e8d3a5c2a2, parent: 1210e9fa3ee9c9712fa694f90f7a032f2f0fd786)

@rust-timer

This comment has been minimized.

@Zalathar
Copy link
Member

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (11ae63e): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

@bors rollup=never
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.3% [-0.7%, -0.2%] 37
Improvements ✅
(secondary)
-0.3% [-0.6%, -0.2%] 10
All ❌✅ (primary) -0.3% [-0.7%, -0.2%] 37

Max RSS (memory usage)

Results (secondary -0.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.7% [1.5%, 1.9%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.3% [-2.1%, -0.7%] 4
All ❌✅ (primary) - - 0

Cycles

Results (primary 2.7%, secondary 3.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.1%, 3.7%] 8
Regressions ❌
(secondary)
3.6% [2.9%, 5.0%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.7% [2.1%, 3.7%] 8

Binary size

Results (primary -0.0%, secondary -0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.0% [-0.0%, -0.0%] 7
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 2
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 7

Bootstrap: 482.345s -> 482.424s (0.02%)
Artifact size: 397.85 MiB -> 395.78 MiB (-0.52%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Feb 17, 2026
@rust-bors

This comment has been minimized.

The next commit will bring back `enum DepKind` and there would be a
variant `DepKind::dep_kind`. This makes it impossible to have a variable
named `dep_kind`, because the `bindings_with_variant_name` lint is
overzealous. For this code:
```
let dep_kind = DepKind::dep_kind;
```
the lint will give this error:
```
pattern binding `dep_kind` is named the same as one of the variants of the type `DepKind`
```
This is arguably a bug in the lint. To work around it, this commit
renames the `dep_kind` query as `crate_dep_kind`. It is a better name
anyway given that `DepKind` and `CrateDepKind` are different things.
It was removed in rust-lang#115920 to enable it being moved to
`rustc_query_system`, a move that has recently been reversed. It's much
simpler as an enum.

Also:
- Remove the overly complicated `Debug` impl for `DepKind`.
- Remove the trivial `DepKind` associated constants (`NULL` et al.)
- Add an assertion to ensure that the number of `DepKinds` fits within a
  `u16`.
- Rename `DEP_KIND_VARIANTS` as `DEP_KIND_NUM_VARIANTS`, to make it
  clearer that it's a count, not a collection.
- Use `stringify!` in one place to make the code clearer.
There is a bunch of plumbing to record the string `"foo"` for each
variant `DepKind::foo`. But that's what the `Debug `impl` now produces.
So this commit removes the plumbing.
@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 2026

Some changes occurred in src/tools/opt-dist

cc @Kobzol

@rustbot rustbot added A-CI Area: Our Github Actions CI A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 17, 2026
@rustbot rustbot added T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Feb 17, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rustbot

This comment has been minimized.

@rustbot rustbot added has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 17, 2026
@nnethercote
Copy link
Contributor Author

wtf, something weird has happened with the commits in this PR, let me try to fix it...

@nnethercote nnethercote force-pushed the bring-back-enum-DepKind branch from 9636099 to bc99995 Compare February 17, 2026 21:10
@rustbot
Copy link
Collaborator

rustbot commented Feb 17, 2026

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@rustbot rustbot removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. has-merge-commits PR has merge commits, merge with caution. labels Feb 17, 2026
@nnethercote nnethercote removed A-testsuite Area: The testsuite used to check the correctness of rustc A-meta Area: Issues & PRs about the rust-lang/rust repository itself A-CI Area: Our Github Actions CI T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Feb 17, 2026
@nnethercote
Copy link
Contributor Author

wtf, something weird has happened with the commits in this PR, let me try to fix it...

Seems to be fixed now. No idea what went wrong, sorry for the noise.

@nnethercote
Copy link
Contributor Author

The perf improvements are undeserved but welcome. They more than make up for the similarly undeserved regressions in #152636.

@bors r=Zalathar

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

📌 Commit bc99995 has been approved by Zalathar

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants