removing new_from_def_id and alias_ty_kind_from_def_id methods, small refactor to TypeRelativePath::AssocItem#155323
Open
josetorrs wants to merge 2 commits intorust-lang:mainfrom
Open
removing new_from_def_id and alias_ty_kind_from_def_id methods, small refactor to TypeRelativePath::AssocItem#155323josetorrs wants to merge 2 commits intorust-lang:mainfrom
new_from_def_id and alias_ty_kind_from_def_id methods, small refactor to TypeRelativePath::AssocItem#155323josetorrs wants to merge 2 commits intorust-lang:mainfrom
Conversation
Collaborator
|
|
fmease
requested changes
Apr 15, 2026
Collaborator
|
Reminder, once the PR becomes ready for a review, use |
1 task
Collaborator
|
HIR ty lowering was modified cc @fmease |
Member
|
r? fmease |
fmease
approved these changes
May 7, 2026
Comment on lines
+1404
to
1407
| let def_id = alias_term.def_id; | ||
| let alias_kind = ty::AliasTyKind::new_from_def_id(tcx, def_id); | ||
| let alias_ty = ty::AliasTy::new_from_args(tcx, alias_kind, alias_term.args); | ||
| let ty = Ty::new_alias(tcx, alias_ty); |
Member
There was a problem hiding this comment.
Suggested change
| let def_id = alias_term.def_id; | |
| let alias_kind = ty::AliasTyKind::new_from_def_id(tcx, def_id); | |
| let alias_ty = ty::AliasTy::new_from_args(tcx, alias_kind, alias_term.args); | |
| let ty = Ty::new_alias(tcx, alias_ty); | |
| let ty = alias_term.expect_ty(tcx).to_ty(tcx); |
Comment on lines
+1442
to
+1445
| let def_id = alias_term.def_id; | ||
| self.require_type_const_attribute(def_id, span)?; | ||
| let ct = Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(def_id, args)); | ||
| let ct = | ||
| Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(def_id, alias_term.args)); |
Member
There was a problem hiding this comment.
Suggested change
| let def_id = alias_term.def_id; | |
| self.require_type_const_attribute(def_id, span)?; | |
| let ct = Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(def_id, args)); | |
| let ct = | |
| Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(def_id, alias_term.args)); | |
| self.require_type_const_attribute(alias_term.def_id, span)?; | |
| let ct = Const::new_unevaluated(tcx, alias_term.expect_ct(tcx)); |
|
|
||
| // 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( |
Member
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
r? @WaffleLapkin
related issue: #154941
tackling the task:
new_from_def_idandalias_ty_kind_from_def_idand replace them with calls to e.g.new_projectiondirectlyin
probe_inherent_assoc_itemonly searches inherent impls here, so the result is always Inherent. inresolve_type_relative_paththe result is always Projection.