-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
removing new_from_def_id and alias_ty_kind_from_def_id methods, small refactor to TypeRelativePath::AssocItem
#155323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -298,7 +298,7 @@ pub enum PermitVariants { | |||||||||||
|
|
||||||||||||
| #[derive(Debug, Clone, Copy)] | ||||||||||||
| enum TypeRelativePath<'tcx> { | ||||||||||||
| AssocItem(DefId, GenericArgsRef<'tcx>), | ||||||||||||
| AssocItem(ty::AliasTyKind<'tcx>, GenericArgsRef<'tcx>), | ||||||||||||
| Variant { adt: Ty<'tcx>, variant_did: DefId }, | ||||||||||||
| Ctor { ctor_def_id: DefId, args: GenericArgsRef<'tcx> }, | ||||||||||||
| } | ||||||||||||
|
|
@@ -1400,12 +1400,9 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { | |||||||||||
| span, | ||||||||||||
| LowerTypeRelativePathMode::Type(permit_variants), | ||||||||||||
| )? { | ||||||||||||
| TypeRelativePath::AssocItem(def_id, args) => { | ||||||||||||
| let alias_ty = ty::AliasTy::new_from_args( | ||||||||||||
| tcx, | ||||||||||||
| ty::AliasTyKind::new_from_def_id(tcx, def_id), | ||||||||||||
| args, | ||||||||||||
| ); | ||||||||||||
| TypeRelativePath::AssocItem(alias_kind, args) => { | ||||||||||||
| let def_id = alias_kind.def_id(); | ||||||||||||
| let alias_ty = ty::AliasTy::new_from_args(tcx, alias_kind, args); | ||||||||||||
| let ty = Ty::new_alias(tcx, alias_ty); | ||||||||||||
|
Comment on lines
+1404
to
1407
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| let ty = self.check_param_uses_if_mcg(ty, span, false); | ||||||||||||
| Ok((ty, tcx.def_kind(def_id), def_id)) | ||||||||||||
|
|
@@ -1440,7 +1437,8 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { | |||||||||||
| span, | ||||||||||||
| LowerTypeRelativePathMode::Const, | ||||||||||||
| )? { | ||||||||||||
| TypeRelativePath::AssocItem(def_id, args) => { | ||||||||||||
| TypeRelativePath::AssocItem(alias_kind, args) => { | ||||||||||||
| let def_id = alias_kind.def_id(); | ||||||||||||
| self.require_type_const_attribute(def_id, span)?; | ||||||||||||
| let ct = Const::new_unevaluated(tcx, ty::UnevaluatedConst::new(def_id, args)); | ||||||||||||
| let ct = self.check_param_uses_if_mcg(ct, span, false); | ||||||||||||
|
|
@@ -1572,15 +1570,15 @@ impl<'tcx> dyn HirTyLowerer<'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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you make Additionally you could make |
||||||||||||
| segment, | ||||||||||||
| adt_def.did(), | ||||||||||||
| self_ty, | ||||||||||||
| qpath_hir_id, | ||||||||||||
| span, | ||||||||||||
| mode.assoc_tag(), | ||||||||||||
| )? { | ||||||||||||
| return Ok(TypeRelativePath::AssocItem(did, args)); | ||||||||||||
| return Ok(TypeRelativePath::AssocItem(ty::Inherent { def_id }, args)); | ||||||||||||
|
fmease marked this conversation as resolved.
Outdated
|
||||||||||||
| } | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
|
|
@@ -1614,7 +1612,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ { | |||||||||||
| ); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| Ok(TypeRelativePath::AssocItem(item_def_id, args)) | ||||||||||||
| Ok(TypeRelativePath::AssocItem(ty::Projection { def_id: item_def_id }, args)) | ||||||||||||
|
fmease marked this conversation as resolved.
Outdated
|
||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| /// Resolve a [type-relative](hir::QPath::TypeRelative) (and type-level) path. | ||||||||||||
|
|
||||||||||||
Uh oh!
There was an error while loading. Please reload this page.