Remove RegionExt; move methods to Region in rustc_type_ir - #160509
Remove RegionExt; move methods to Region in rustc_type_ir#160509Jamesbarford wants to merge 2 commits into
RegionExt; move methods to Region in rustc_type_ir#160509Conversation
|
HIR ty lowering was modified cc @fmease |
generics_of_early_param_region_def_idhmm, without looking much at the code, I feel like we should move |
| // Use a pre-interned one when possible. | ||
| interner | ||
| .get_re_var_lifetime(v.as_usize()) | ||
| .unwrap_or_else(|| interner.intern_region(RegionKind::ReVar(v))) |
There was a problem hiding this comment.
instead have interner, intern_re_var feel like the current thing has a bit too much impl detail of the way rustc does things
| self, | ||
| def_id: Self::DefId, | ||
| ebr: Self::EarlyParamRegion, | ||
| ) -> Self::DefId; |
There was a problem hiding this comment.
ah yeah, definitely add this as a method on GenericsOf instead
There was a problem hiding this comment.
Sure thing, moving Generics into rustc_type_ir would result in a similar PR to this where some extra methods would either need to be added to a trait and/or the Interner (19 at a quick count). Moreover there is GenericParamDef with it's own methods (which I didn't count) and and finally GenericParamDefKind which is a trivial enum.
This comment has been minimized.
This comment has been minimized.
d2eb2a2 to
78adf31
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. |
Removes
RegionExtfromrustc_middlewith all methods onRegion.Some changes I think are worth pointing out (of which are all in the first commit -> f949bb7) ;
Region::new_late_paramto accept aI::LateParamRegionwhere previously it was able to construct aLateParamRegionfrom some method parameters.added to interner:
fn span_delayed_bug(self, span: Self::Span, msg: impl ToString) -> Self::ErrorGuaranteed;which could be useful elsewhere when porting things across torustc_type_irfn generics_of_early_param_region_def_id(self, def_id: Self::DefId, ebr: Self::EarlyParamRegion) -> Self::DefId;which is quite nasty but callinggenerics_ofreturned another type that I would have possibly create a trait for which felt more messy.fn get_re_var_lifetime(self, var_idx: usize) -> Option<Region<'tcx>>need to get a region inRegion::new_var.traits added to inherent
RegionNameso we can get the names ofLateParamRegionandEarlyParamRegionwith aget_name()and alsois_named().DefIdGetterso we can get theDefIdofkindinLateParamRegionr? lcnr