Skip to content

refactor TypeRelativePath::AssocItem to use AliasTerm#155323

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
josetorrs:remove-new-from-def-id
Jun 11, 2026
Merged

refactor TypeRelativePath::AssocItem to use AliasTerm#155323
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
josetorrs:remove-new-from-def-id

Conversation

@josetorrs

@josetorrs josetorrs commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

View all comments

r? @WaffleLapkin

related issue: #154941

tackling the task:

  • remove calls to new_from_def_id and alias_ty_kind_from_def_id and replace them with calls to e.g. new_projection directly

also doing:

  • probe_inherent_assoc_item returns AliasTerm<'tcx>

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 15, 2026
@rustbot

rustbot commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

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

Comment thread compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated
Comment thread compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated
Comment thread compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated
@rustbot

rustbot commented Apr 15, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@josetorrs josetorrs marked this pull request as ready for review April 16, 2026 01:31
@rustbot

rustbot commented Apr 16, 2026

Copy link
Copy Markdown
Collaborator

HIR ty lowering was modified

cc @fmease

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 16, 2026
@WaffleLapkin

Copy link
Copy Markdown
Member

r? fmease

@rustbot rustbot assigned fmease and unassigned WaffleLapkin May 1, 2026
@josetorrs josetorrs requested a review from fmease May 3, 2026 16:09

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

Sorry for the delay! Could you apply my suggestions, update PR title and the PR description which seem to be outdated and squash all commits into one? Thanks!

View changes since this review

Comment thread compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated
Comment thread compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated

// FIXME(inherent_associated_types, #106719): Support self types other than ADTs.
if let Some((did, args)) = self.probe_inherent_assoc_item(
if let Some((def_id, args)) = self.probe_inherent_assoc_item(

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.

Could you make probe_inherent_assoc_item return an AliasTerm? So return a Result<Option<ty::AliasTerm<'tcx>>, ErrorGuaranteed>?

Additionally you could make lower_assoc_item_path return an AliasTerm directly to mirror the inherent counterpart but it's probably not worth it.

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.

okay I think I got everything. I looked at implementing the lower_assoc_item_path suggestion and personally prefer the type clarity with AliasTerm but like you said not sure if it's worth it. though if you have second thoughts, then I would be happy to make the change

@josetorrs josetorrs May 15, 2026

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.

fmease after rebasing, a test from #155341 failed I think due to the AliasTerm return type change. I added a require_type_const_attribute check but admittedly not sure where this fits in now with #156181

@fmease fmease added 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-review Status: Awaiting review from the assignee but also interested parties. labels May 7, 2026
@rust-log-analyzer

This comment has been minimized.

@josetorrs josetorrs force-pushed the remove-new-from-def-id branch from 7c65730 to 1d2a312 Compare May 9, 2026 16:09
@rustbot

This comment has been minimized.

@josetorrs josetorrs changed the title removing new_from_def_id and alias_ty_kind_from_def_id methods, small refactor to TypeRelativePath::AssocItem refactor TypeRelativePath::AssocItem to use AliasTerm May 9, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented May 15, 2026

Copy link
Copy Markdown
Collaborator

The Clippy subtree was changed

cc @rust-lang/clippy

@rust-bors

This comment has been minimized.

@josetorrs josetorrs force-pushed the remove-new-from-def-id branch from 08738f1 to 0863e17 Compare June 10, 2026 02:37
@rustbot

rustbot commented Jun 10, 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.

@josetorrs

Copy link
Copy Markdown
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 10, 2026
Comment thread compiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated
@fmease

fmease commented Jun 10, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 24c895a has been approved by fmease

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 Jun 10, 2026
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 11, 2026
…r=fmease

refactor `TypeRelativePath::AssocItem` to use `AliasTerm`

r? @WaffleLapkin

related issue: rust-lang#154941

tackling the task:

- [ ] remove calls to `new_from_def_id` and `alias_ty_kind_from_def_id` and replace them with calls to e.g. `new_projection` directly

also doing:
- `probe_inherent_assoc_item` returns `AliasTerm<'tcx>`
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 11, 2026
…r=fmease

refactor `TypeRelativePath::AssocItem` to use `AliasTerm`

r? @WaffleLapkin

related issue: rust-lang#154941

tackling the task:

- [ ] remove calls to `new_from_def_id` and `alias_ty_kind_from_def_id` and replace them with calls to e.g. `new_projection` directly

also doing:
- `probe_inherent_assoc_item` returns `AliasTerm<'tcx>`
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 11, 2026
…r=fmease

refactor `TypeRelativePath::AssocItem` to use `AliasTerm`

r? @WaffleLapkin

related issue: rust-lang#154941

tackling the task:

- [ ] remove calls to `new_from_def_id` and `alias_ty_kind_from_def_id` and replace them with calls to e.g. `new_projection` directly

also doing:
- `probe_inherent_assoc_item` returns `AliasTerm<'tcx>`
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 11, 2026
…r=fmease

refactor `TypeRelativePath::AssocItem` to use `AliasTerm`

r? @WaffleLapkin

related issue: rust-lang#154941

tackling the task:

- [ ] remove calls to `new_from_def_id` and `alias_ty_kind_from_def_id` and replace them with calls to e.g. `new_projection` directly

also doing:
- `probe_inherent_assoc_item` returns `AliasTerm<'tcx>`
rust-bors Bot pushed a commit that referenced this pull request Jun 11, 2026
Rollup of 31 pull requests

Successful merges:

 - #141030 (Expand free alias types during variance computation)
 - #154853 (mgca: Register `ConstArgHasType` when normalizing projection consts)
 - #155527 (Replace printables table with `unicode_data.rs` tables)
 - #156629 (Stabilize `core::range::{legacy, RangeFull, RangeTo}`)
 - #157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
 - #157282 (Fix post-monomorphization error note race in the parallel frontend)
 - #157352 (Make the retained dep graph deterministic under the parallel frontend)
 - #157601 (Emit error for unused target expression in glob and list delegations)
 - #157611 (Update `browser-ui-test` version to `0.24.0`)
 - #157620 (Add a strategy FnMut to inject behavior into the flush cycle)
 - #157645 (Windows TLS - Only register the `atexit` hook when `cleanup` can be unloaded)
 - #157646 (Keep rename-imported main alive in dead-code analysis under `--test`)
 - #157647 (Start using comptime for reflection intrinsics and their wrapper functions)
 - #157719 (resolve: Partially revert "Remove a special case for dummy imports")
 - #155153 (Ensure Send/Sync is not implemented for std::env::Vars{,Os})
 - #155198 (fix(mgca): Allow specifying generic args (of enum) on enum itself in unit & tuple variant constructions in (direct) const args)
 - #155323 (refactor `TypeRelativePath::AssocItem` to use `AliasTerm`)
 - #156497 (fix-155516: Don't suggest wrong unwrap expect)
 - #156583 (Support defaults for static EIIs)
 - #157013 (Ensure inferred let pattern types are well-formed)
 - #157196 (Only suggest reborrowing a moved value where the reborrow is valid)
 - #157230 (borrowck: avoid ICE describing fields on generic params)
 - #157288 (platform support: add SNaN erratum to MIPS targets)
 - #157330 (remove `IsTypeConst` from `hir::TraitItemKind`)
 - #157350 (compiletest: ignore SVG `y` offset in by-lines comparison)
 - #157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
 - #157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust 2015 when used in `dyn + dyn`)
 - #157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
 - #157691 (Move symbol hiding code to a new file)
 - #157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
 - #157703 (Fix doc link to Instant sub in saturating caveat)

Failed merges:

 - #157699 (Arg splat experiment - hir FnDecl impl)
@rust-bors rust-bors Bot merged commit 334687c into rust-lang:main Jun 11, 2026
12 checks passed
@rustbot rustbot added this to the 1.98.0 milestone Jun 11, 2026
rust-timer added a commit that referenced this pull request Jun 11, 2026
Rollup merge of #155323 - josetorrs:remove-new-from-def-id, r=fmease

refactor `TypeRelativePath::AssocItem` to use `AliasTerm`

r? @WaffleLapkin

related issue: #154941

tackling the task:

- [ ] remove calls to `new_from_def_id` and `alias_ty_kind_from_def_id` and replace them with calls to e.g. `new_projection` directly

also doing:
- `probe_inherent_assoc_item` returns `AliasTerm<'tcx>`
LaneAsade pushed a commit to LaneAsade/rust that referenced this pull request Jun 11, 2026
Rollup of 31 pull requests

Successful merges:

 - rust-lang#141030 (Expand free alias types during variance computation)
 - rust-lang#154853 (mgca: Register `ConstArgHasType` when normalizing projection consts)
 - rust-lang#155527 (Replace printables table with `unicode_data.rs` tables)
 - rust-lang#156629 (Stabilize `core::range::{legacy, RangeFull, RangeTo}`)
 - rust-lang#157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
 - rust-lang#157282 (Fix post-monomorphization error note race in the parallel frontend)
 - rust-lang#157352 (Make the retained dep graph deterministic under the parallel frontend)
 - rust-lang#157601 (Emit error for unused target expression in glob and list delegations)
 - rust-lang#157611 (Update `browser-ui-test` version to `0.24.0`)
 - rust-lang#157620 (Add a strategy FnMut to inject behavior into the flush cycle)
 - rust-lang#157645 (Windows TLS - Only register the `atexit` hook when `cleanup` can be unloaded)
 - rust-lang#157646 (Keep rename-imported main alive in dead-code analysis under `--test`)
 - rust-lang#157647 (Start using comptime for reflection intrinsics and their wrapper functions)
 - rust-lang#157719 (resolve: Partially revert "Remove a special case for dummy imports")
 - rust-lang#155153 (Ensure Send/Sync is not implemented for std::env::Vars{,Os})
 - rust-lang#155198 (fix(mgca): Allow specifying generic args (of enum) on enum itself in unit & tuple variant constructions in (direct) const args)
 - rust-lang#155323 (refactor `TypeRelativePath::AssocItem` to use `AliasTerm`)
 - rust-lang#156497 (fix-155516: Don't suggest wrong unwrap expect)
 - rust-lang#156583 (Support defaults for static EIIs)
 - rust-lang#157013 (Ensure inferred let pattern types are well-formed)
 - rust-lang#157196 (Only suggest reborrowing a moved value where the reborrow is valid)
 - rust-lang#157230 (borrowck: avoid ICE describing fields on generic params)
 - rust-lang#157288 (platform support: add SNaN erratum to MIPS targets)
 - rust-lang#157330 (remove `IsTypeConst` from `hir::TraitItemKind`)
 - rust-lang#157350 (compiletest: ignore SVG `y` offset in by-lines comparison)
 - rust-lang#157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
 - rust-lang#157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust 2015 when used in `dyn + dyn`)
 - rust-lang#157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
 - rust-lang#157691 (Move symbol hiding code to a new file)
 - rust-lang#157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
 - rust-lang#157703 (Fix doc link to Instant sub in saturating caveat)

Failed merges:

 - rust-lang#157699 (Arg splat experiment - hir FnDecl impl)
LaneAsade pushed a commit to LaneAsade/rust that referenced this pull request Jun 11, 2026
Rollup of 31 pull requests

Successful merges:

 - rust-lang#141030 (Expand free alias types during variance computation)
 - rust-lang#154853 (mgca: Register `ConstArgHasType` when normalizing projection consts)
 - rust-lang#155527 (Replace printables table with `unicode_data.rs` tables)
 - rust-lang#156629 (Stabilize `core::range::{legacy, RangeFull, RangeTo}`)
 - rust-lang#157280 (traits: Allow escaping self types in ExistentialTraitRef::with_self_ty)
 - rust-lang#157282 (Fix post-monomorphization error note race in the parallel frontend)
 - rust-lang#157352 (Make the retained dep graph deterministic under the parallel frontend)
 - rust-lang#157601 (Emit error for unused target expression in glob and list delegations)
 - rust-lang#157611 (Update `browser-ui-test` version to `0.24.0`)
 - rust-lang#157620 (Add a strategy FnMut to inject behavior into the flush cycle)
 - rust-lang#157645 (Windows TLS - Only register the `atexit` hook when `cleanup` can be unloaded)
 - rust-lang#157646 (Keep rename-imported main alive in dead-code analysis under `--test`)
 - rust-lang#157647 (Start using comptime for reflection intrinsics and their wrapper functions)
 - rust-lang#157719 (resolve: Partially revert "Remove a special case for dummy imports")
 - rust-lang#155153 (Ensure Send/Sync is not implemented for std::env::Vars{,Os})
 - rust-lang#155198 (fix(mgca): Allow specifying generic args (of enum) on enum itself in unit & tuple variant constructions in (direct) const args)
 - rust-lang#155323 (refactor `TypeRelativePath::AssocItem` to use `AliasTerm`)
 - rust-lang#156497 (fix-155516: Don't suggest wrong unwrap expect)
 - rust-lang#156583 (Support defaults for static EIIs)
 - rust-lang#157013 (Ensure inferred let pattern types are well-formed)
 - rust-lang#157196 (Only suggest reborrowing a moved value where the reborrow is valid)
 - rust-lang#157230 (borrowck: avoid ICE describing fields on generic params)
 - rust-lang#157288 (platform support: add SNaN erratum to MIPS targets)
 - rust-lang#157330 (remove `IsTypeConst` from `hir::TraitItemKind`)
 - rust-lang#157350 (compiletest: ignore SVG `y` offset in by-lines comparison)
 - rust-lang#157355 (Add `or_try_*` variants for `HashMap` and `BTreeMap` Entry APIs)
 - rust-lang#157577 (Fix parser error recovery treating 'dyn' as a strict keyword in Rust 2015 when used in `dyn + dyn`)
 - rust-lang#157670 (Rename `errors.rs` file to `diagnostics.rs` (4/N))
 - rust-lang#157691 (Move symbol hiding code to a new file)
 - rust-lang#157700 (Rename `errors.rs` file to `diagnostics.rs` (5/N))
 - rust-lang#157703 (Fix doc link to Instant sub in saturating caveat)

Failed merges:

 - rust-lang#157699 (Arg splat experiment - hir FnDecl impl)
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-clippy Relevant to the Clippy team. 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