Skip to content

Extract all instance shim variants into new ShimKind enum#158105

Open
camelid wants to merge 3 commits into
rust-lang:mainfrom
camelid:group-shims
Open

Extract all instance shim variants into new ShimKind enum#158105
camelid wants to merge 3 commits into
rust-lang:mainfrom
camelid:group-shims

Conversation

@camelid

@camelid camelid commented Jun 18, 2026

Copy link
Copy Markdown
Member

They tend to have similar handling -- e.g., they should be the only
input to the mir_shims query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying GenericArgsRef for instances that actually use it
(e.g., Item) but not others (e.g., CloneShim).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk

@rustbot

rustbot commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

@rustbot rustbot added PG-exploit-mitigations Project group: Exploit mitigations 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 18, 2026
@camelid

camelid commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

Not sure if this should get an MCP; let me know.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

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.

@rust-log-analyzer

This comment has been minimized.

Comment thread compiler/rustc_middle/src/ty/instance.rs
@oli-obk

oli-obk commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

since it touches a fairly often called query and data structure, let's perf it first

@bors try @rust-timer queue

r=me with that clean or green

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 22, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
Extract all instance shim variants into new `ShimKind` enum
@rust-bors

rust-bors Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: d347081 (d34708186d2a5b4ccbd9bb66475a209f31661214)
Base parent: cddcbec (cddcbec198760511240bf0e728193bf4d700acb4)

@rust-timer

This comment has been minimized.

camelid added 3 commits June 22, 2026 19:28
They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

Many of the shim variants still have `Shim` at the end of their names.
To make the refactoring easier and keep the diff clean, I will trim
those suffixes off in the next commit.
It used to be much more prevalent before I extracted shims as their own enum.
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (d347081): comparison URL.

Overall result: ❌ regressions - 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

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.5% [0.5%, 0.5%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary -2.6%, secondary -2.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)
- - 0
Improvements ✅
(primary)
-2.6% [-2.9%, -2.4%] 2
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) -2.6% [-2.9%, -2.4%] 2

Cycles

Results (primary -0.2%, secondary 2.3%)

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

mean range count
Regressions ❌
(primary)
2.3% [2.3%, 2.3%] 1
Regressions ❌
(secondary)
4.0% [3.3%, 4.7%] 4
Improvements ✅
(primary)
-1.5% [-1.8%, -1.2%] 2
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) -0.2% [-1.8%, 2.3%] 3

Binary size

Results (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.0% [0.0%, 0.0%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 505.379s -> 508.681s (0.65%)
Artifact size: 353.06 MiB -> 353.25 MiB (0.05%)

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

camelid commented Jun 22, 2026

Copy link
Copy Markdown
Member Author

Perf looks good, just a small regression on one scenario for a secondary benchmark. Also fixed the commit history.

@bors r=oli-obk

@rust-bors

rust-bors Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

📌 Commit d06469a has been approved by oli-obk

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 5. This pull request will be tested once the tree is reopened.

@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 Jun 22, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 22, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
Rollup of 4 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158222 (format: ignore println newline in foreign format hints)
 - #158252 (Use `cfg_select` in `std::os`)
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
Rollup of 4 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158222 (format: ignore println newline in foreign format hints)
 - #158252 (Use `cfg_select` in `std::os`)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 22, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158252 (Use `cfg_select` in `std::os`)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 23, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158274 (triagebot: Stop pinging myself)
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158274 (triagebot: Stop pinging myself)
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158274 (triagebot: Stop pinging myself)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 23, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 6 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158257 ( fix escaping placeholder check in next solver normalization folder)
 - #158274 (triagebot: Stop pinging myself)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 23, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 8 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158252 (Use `cfg_select` in `std::os`)
 - #158257 ( fix escaping placeholder check in next solver normalization folder)
 - #158274 (triagebot: Stop pinging myself)
 - #158282 (slice_split_once: bounds check optimization note)
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
Rollup of 8 pull requests

Successful merges:

 - #157960 (delegation: add support for infers in generics)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158222 (format: ignore println newline in foreign format hints)
 - #158252 (Use `cfg_select` in `std::os`)
 - #158257 ( fix escaping placeholder check in next solver normalization folder)
 - #158274 (triagebot: Stop pinging myself)
 - #158282 (slice_split_once: bounds check optimization note)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 23, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
…uwer

Rollup of 16 pull requests

Successful merges:

 - #156885 (Fix misattributed type inference error span for index expressions)
 - #157271 (simplify some `proc_macro` things)
 - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit)
 - #157921 (trait solver: Resolve region vars in max universe)
 - #157960 (delegation: add support for infers in generics)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158279 (Follow goto and drop when linting unreachable code)
 - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`)
 - #158020 (Update mingw-w64 C toolchain)
 - #158222 (format: ignore println newline in foreign format hints)
 - #158223 (Move target checking for #[lang] to the attribute parser)
 - #158252 (Use `cfg_select` in `std::os`)
 - #158257 ( fix escaping placeholder check in next solver normalization folder)
 - #158274 (triagebot: Stop pinging myself)
 - #158282 (slice_split_once: bounds check optimization note)

Failed merges:

 - #158256 (Avoid parser panics bubbling out to proc macros)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 23, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jun 23, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 23, 2026
…uwer

Rollup of 23 pull requests

Successful merges:

 - #158315 (`rust-analyzer` subtree update)
 - #155739 (Add temporary scope to assert_eq and assert_ne)
 - #156885 (Fix misattributed type inference error span for index expressions)
 - #157271 (simplify some `proc_macro` things)
 - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit)
 - #157921 (trait solver: Resolve region vars in max universe)
 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158279 (Follow goto and drop when linting unreachable code)
 - #157527 (Move derive tests into their dedicated folder)
 - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`)
 - #158020 (Update mingw-w64 C toolchain)
 - #158222 (format: ignore println newline in foreign format hints)
 - #158223 (Move target checking for #[lang] to the attribute parser)
 - #158252 (Use `cfg_select` in `std::os`)
 - #158257 ( fix escaping placeholder check in next solver normalization folder)
 - #158263 (Only load the feature list once in the entire resolver)
 - #158274 (triagebot: Stop pinging myself)
 - #158282 (slice_split_once: bounds check optimization note)
 - #158300 (Improve unknown crate_type diagnostic suggestions)
 - #158304 (mailmap: update mu001999)

Failed merges:

 - #158256 (Avoid parser panics bubbling out to proc macros)
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 24, 2026
Extract all instance shim variants into new `ShimKind` enum

They tend to have similar handling -- e.g., they should be the only
input to the `mir_shims` query -- so it's cleaner to group them
together. This will also make potential future refactorings easier, such
as only carrying `GenericArgsRef` for instances that actually use it
(e.g., `Item`) but not others (e.g., `CloneShim`).

cc https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/moving.20ty.3A.3AInstance.2Eargs.20into.20ty.3A.3AInstanceKind.20variants
r? @oli-obk
rust-bors Bot pushed a commit that referenced this pull request Jun 24, 2026
Rollup of 27 pull requests

Successful merges:

 - #158315 (`rust-analyzer` subtree update)
 - #155739 (Add temporary scope to assert_eq and assert_ne)
 - #156885 (Fix misattributed type inference error span for index expressions)
 - #157271 (simplify some `proc_macro` things)
 - #157883 (Remove strict invariant node_type on hir_type during ty privacy visit)
 - #157921 (trait solver: Resolve region vars in max universe)
 - #157960 (delegation: add support for infers in generics)
 - #157983 (Lift the same-signature restriction for `extern "tail"`)
 - #158053 (Optimize network address parser)
 - #158105 (Extract all instance shim variants into new `ShimKind` enum)
 - #158207 (Resolver: local/external split of  `resolve_ident_in_module_non_globs_unadjusted` )
 - #158279 (Follow goto and drop when linting unreachable code)
 - #157527 (Move derive tests into their dedicated folder)
 - #157807 (don't ice on non-lifetime binders under `-Zassumptions-on-binders`)
 - #158020 (Update mingw-w64 C toolchain)
 - #158039 (c-variadic: test that we use equality up to free lifetimes)
 - #158222 (format: ignore println newline in foreign format hints)
 - #158223 (Move target checking for #[lang] to the attribute parser)
 - #158252 (Use `cfg_select` in `std::os`)
 - #158257 ( fix escaping placeholder check in next solver normalization folder)
 - #158263 (Only load the feature list once in the entire resolver)
 - #158267 (FromUtf8Error::into_utf8_lossy better example and suggest use)
 - #158274 (triagebot: Stop pinging myself)
 - #158282 (slice_split_once: bounds check optimization note)
 - #158300 (Improve unknown crate_type diagnostic suggestions)
 - #158304 (mailmap: update mu001999)
 - #158309 (Update `rustc-literal-escaper` version to `0.0.8`)

Failed merges:

 - #158256 (Avoid parser panics bubbling out to proc macros)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PG-exploit-mitigations Project group: Exploit mitigations 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.

5 participants