refactor TypeRelativePath::AssocItem to use AliasTerm#155323
refactor TypeRelativePath::AssocItem to use AliasTerm#155323josetorrs wants to merge 1 commit intorust-lang:mainfrom
TypeRelativePath::AssocItem to use AliasTerm#155323Conversation
|
|
|
Reminder, once the PR becomes ready for a review, use |
|
HIR ty lowering was modified cc @fmease |
|
r? fmease |
| 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)); |
There was a problem hiding this comment.
| 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( |
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.
There was a problem hiding this comment.
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
This comment has been minimized.
This comment has been minimized.
…erent_assoc_item` returns `AliasTerm` based fmease suggestins
7c65730 to
1d2a312
Compare
|
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. |
new_from_def_id and alias_ty_kind_from_def_id methods, small refactor to TypeRelativePath::AssocItemTypeRelativePath::AssocItem to use AliasTerm
|
The job Click to see the possible cause of the failure (guessed by this bot) |
r? @WaffleLapkin
related issue: #154941tackling the task:remove calls tonew_from_def_idandalias_ty_kind_from_def_idand replace them with calls to e.g.new_projectiondirectlylower_type_relative_ty_pathnows usesalias_term.expect_ty(tcx).to_ty(tcx)lower_type_relative_const_pathusesalias_term.expect_ct(tcx).probe_inherent_assoc_itemreturnsAliasTerm<'tcx>