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

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 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
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.

@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
Copy link
Contributor

rust-bors bot commented Feb 17, 2026

☔ The latest upstream changes (presumably #152755) made this pull request unmergeable. Please resolve the merge conflicts.

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-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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants