Skip to content

Add SpecialDerives#157675

Open
makai410 wants to merge 1 commit into
rust-lang:mainfrom
makai410:merge-map
Open

Add SpecialDerives#157675
makai410 wants to merge 1 commit into
rust-lang:mainfrom
makai410:merge-map

Conversation

@makai410

@makai410 makai410 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Follow-up of #155598

Uses bitflags instead of two bools in DeriveData, and a single map instead of two in Resolver.

@rustbot

rustbot commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

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.

@rustbot rustbot added 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 Jun 9, 2026
@rustbot

rustbot commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

r? @davidtwco

rustbot has assigned @davidtwco.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

@ZuseZ4

ZuseZ4 commented Jun 10, 2026

Copy link
Copy Markdown
Member

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 10, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 10, 2026
@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: adab75e (adab75e18c5789991db93efb52e86a4f5b6a7254, parent: d56483a91d6cf5041351a3208b8d08f98f0c8b56)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (adab75e): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary 2.1%, secondary -2.4%)

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

mean range count
Regressions ❌
(primary)
3.9% [2.1%, 6.3%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.2% [-3.2%, -3.2%] 1
Improvements ✅
(secondary)
-2.4% [-2.8%, -2.1%] 2
All ❌✅ (primary) 2.1% [-3.2%, 6.3%] 4

Cycles

Results (primary -2.1%, secondary -2.2%)

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)
-2.1% [-2.1%, -2.1%] 1
Improvements ✅
(secondary)
-2.2% [-2.2%, -2.2%] 1
All ❌✅ (primary) -2.1% [-2.1%, -2.1%] 1

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%] 15
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 6
All ❌✅ (primary) -0.0% [-0.0%, -0.0%] 15

Bootstrap: 525.47s -> 516.933s (-1.62%)
Artifact size: 400.80 MiB -> 400.80 MiB (0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 10, 2026

@davidtwco davidtwco left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r=me if we want to land this - probably not worth doing if the intent was to improve performance, unless it's a stepping stone to a larger change?

View changes since this review

@jakubadamw jakubadamw left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not an official reviewer, but just a few comments.

View changes since this review

// something like what [`rustc_type_ir::flags::TypeFlags`] is doing.
has_derive_copy: bool,
has_derive_ord: bool,
has_derives: SpecialDerives,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be called has_special_derives? It doesn't relate to derives broadly, just a specific few? Or perhaps even special_derives?

if entry.has_derive_copy || self.has_derive_copy(parent_scope.expansion) {
self.containers_deriving_copy.insert(expn_id);
// the derive markers haven't been set yet.
let mut all_derives = entry.has_derives;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

all_special_derives? Again, it's just a specific subset of built-in traits.

/// Does `#[derive(...)]` attribute with the given `ExpnId` have built-in `Ord` inside it?
fn has_derive_ord(&self, expn_id: LocalExpnId) -> bool;
/// Does `#[derive(...)]` attribute with the given `ExpnId` have the given special built-in derives inside it?
fn has_derives(&self, expn_id: LocalExpnId, derives: SpecialDerives) -> bool;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be called has_special_derives() seeing it's only related to the specific subset denoted by SpecialDerives?

@petrochenkov petrochenkov self-assigned this Jun 12, 2026
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-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.

7 participants