Skip to content

Use special DefIds for aliases#155981

Open
ChayimFriedman2 wants to merge 1 commit intorust-lang:mainfrom
ChayimFriedman2:alias-def-id
Open

Use special DefIds for aliases#155981
ChayimFriedman2 wants to merge 1 commit intorust-lang:mainfrom
ChayimFriedman2:alias-def-id

Conversation

@ChayimFriedman2
Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 commented Apr 30, 2026

View all comments

Renewal of #155025, after AliasTermKind was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the AliasTyKind and AliasTermKind contains the DefId.

It does require a few try_into().unwrap()s since in the solver's consider_X_candidate() only get an untyped DefId. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr

@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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Apr 30, 2026
Comment thread compiler/rustc_next_trait_solver/src/solve/normalizes_to/inherent.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs
Comment thread compiler/rustc_next_trait_solver/src/solve/normalizes_to/mod.rs
Err(TypeError::ProjectionMismatched(ExpectedFound::new(
a.def_id.into(),
b.def_id.into(),
)))
Copy link
Copy Markdown
Contributor

@lcnr lcnr Apr 30, 2026

Choose a reason for hiding this comment

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

can you update TypeError instead?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can't because unlike the name the def id can be any alias; see <AliasTy as Relate>::relate().

Copy link
Copy Markdown
Contributor

@lcnr lcnr May 5, 2026

Choose a reason for hiding this comment

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

ah, we also need to update the Relate<I> for AliasTy impl 👍 #154758

Comment thread compiler/rustc_next_trait_solver/src/delegate.rs Outdated
@rustbot

This comment has been minimized.

@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

@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 May 4, 2026
rust-bors Bot pushed a commit that referenced this pull request May 4, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 4, 2026

❗ There is currently no auto build in progress on this PR.

Hint: There is a pending try build on this PR. Maybe you meant to cancel it? You can do that using @bors try cancel.

@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

@bors try cancel

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 4, 2026

Try build cancelled. Cancelled workflows:

@ChayimFriedman2 ChayimFriedman2 removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 4, 2026
@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

How do I request a perf run with -Znext-solver=globally?

@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

Seems like there is no way to do that, so at least...

@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 May 4, 2026
@ChayimFriedman2 ChayimFriedman2 added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 4, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 4, 2026

☀️ Try build successful (CI)
Build commit: a2fdd5d (a2fdd5dc4e99453080f5bb2070e5875c96f113b2, parent: 1d72d7e8136faaebad3a85eeed432e6ea1b2ffab)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (a2fdd5d): comparison URL.

Overall result: ✅ improvements - 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
Improvements ✅
(primary)
-0.1% [-0.1%, -0.1%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.1% [-0.1%, -0.1%] 1

Max RSS (memory usage)

Results (secondary 3.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)
3.0% [0.4%, 8.2%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results (secondary -5.1%)

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.9% [0.7%, 1.2%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-8.1% [-23.7%, -0.4%] 6
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 494.198s -> 495.332s (0.23%)
Artifact size: 394.42 MiB -> 394.45 MiB (0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label May 4, 2026
@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

@bors r=lcnr rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 6, 2026

📌 Commit 7a798fd has been approved by lcnr

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. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 6, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 6, 2026
Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 6, 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.

@ChayimFriedman2
Copy link
Copy Markdown
Contributor Author

@bors r=lcnr rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 6, 2026

📌 Commit ff25d8a has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 6, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 6, 2026
Use special DefIds for aliases

Renewal of rust-lang#155025, after `AliasTermKind` was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr
rust-bors Bot pushed a commit that referenced this pull request May 6, 2026
…uwer

Rollup of 3 pull requests

Successful merges:

 - #156061 (Support `-Cpanic=unwind` on WASI targets)
 - #156236 (resolve: Remove `MacroData`)
 - #155981 (Use special DefIds for aliases)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 6, 2026
Use special DefIds for aliases

Renewal of rust-lang#155025, after `AliasTermKind` was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr
rust-bors Bot pushed a commit that referenced this pull request May 6, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #156061 (Support `-Cpanic=unwind` on WASI targets)
 - #146273 (lint ImproperCTypes: refactor linting architecture (part 2))
 - #149509 (Lint unused pub items in binary crates)
 - #156173 (Fewer global node_id_to_def_id lookups)
 - #155961 (Deny warnings in the test for crates that are available on stable)
 - #155981 (Use special DefIds for aliases)
 - #156130 (Fold/visit tweaks)
 - #156131 (Metadata macro/query cleanups)
 - #156202 (llvm: Use correct type for splat mask)

Failed merges:

 - #156236 (resolve: Remove `MacroData`)
jhpratt added a commit to jhpratt/rust that referenced this pull request May 7, 2026
Use special DefIds for aliases

Renewal of rust-lang#155025, after `AliasTermKind` was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr
jhpratt added a commit to jhpratt/rust that referenced this pull request May 7, 2026
Use special DefIds for aliases

Renewal of rust-lang#155025, after `AliasTermKind` was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr
jhpratt added a commit to jhpratt/rust that referenced this pull request May 7, 2026
Use special DefIds for aliases

Renewal of rust-lang#155025, after `AliasTermKind` was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr
rust-bors Bot pushed a commit that referenced this pull request May 7, 2026
Rollup of 14 pull requests

Successful merges:

 - #146273 (lint ImproperCTypes: refactor linting architecture (part 2))
 - #149509 (Lint unused pub items in binary crates)
 - #156173 (Fewer global node_id_to_def_id lookups)
 - #156177 (windows/time: avoid being too close to 0)
 - #155961 (Deny warnings in the test for crates that are available on stable)
 - #155981 (Use special DefIds for aliases)
 - #156109 (Migrate libraries from ptr::slice_from_raw_parts to .cast_slice)
 - #156130 (Fold/visit tweaks)
 - #156131 (Metadata macro/query cleanups)
 - #156202 (llvm: Use correct type for splat mask)
 - #156227 (Add Trusty OS to the generic error implementation.)
 - #156237 (compiletest: prevent directives from having multiple revisions)
 - #156241 (Move tests coercion)
 - #156258 (Document wasi-sdk minimum versions for WASI targets)
jhpratt added a commit to jhpratt/rust that referenced this pull request May 7, 2026
Use special DefIds for aliases

Renewal of rust-lang#155025, after `AliasTermKind` was also ported.

Like we do for other things for better experience in rust-analyzer.

It's possible now that the `AliasTyKind` and `AliasTermKind` contains the DefId.

It does require a few `try_into().unwrap()`s since in the solver's `consider_X_candidate()` only get an untyped `DefId`. It's possible to reduce that considerably if we'd pass them the typed def id as a parameter, but I don't know what will be the impact on perf. Should I try to pursue that?

r? lcnr
rust-bors Bot pushed a commit that referenced this pull request May 7, 2026
Rollup of 12 pull requests

Successful merges:

 - #156173 (Fewer global node_id_to_def_id lookups)
 - #156177 (windows/time: avoid being too close to 0)
 - #155961 (Deny warnings in the test for crates that are available on stable)
 - #155981 (Use special DefIds for aliases)
 - #156130 (Fold/visit tweaks)
 - #156131 (Metadata macro/query cleanups)
 - #156202 (llvm: Use correct type for splat mask)
 - #156223 (Refactor `Type::size` field to `TypeId::size` method for `type_info`)
 - #156227 (Add Trusty OS to the generic error implementation.)
 - #156237 (compiletest: prevent directives from having multiple revisions)
 - #156241 (Move tests coercion)
 - #156258 (Document wasi-sdk minimum versions for WASI targets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants