Skip to content

Remove RegionExt; move methods to Region in rustc_type_ir - #160509

Open
Jamesbarford wants to merge 2 commits into
rust-lang:mainfrom
Jamesbarford:chore/shrink-region-ext-triats-pt2
Open

Remove RegionExt; move methods to Region in rustc_type_ir#160509
Jamesbarford wants to merge 2 commits into
rust-lang:mainfrom
Jamesbarford:chore/shrink-region-ext-triats-pt2

Conversation

@Jamesbarford

@Jamesbarford Jamesbarford commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Removes RegionExt from rustc_middle with all methods on Region.

Some changes I think are worth pointing out (of which are all in the first commit -> f949bb7) ;

  • Changed the signature of Region::new_late_param to accept a I::LateParamRegion where previously it was able to construct a LateParamRegion from 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 to rustc_type_ir
  • fn generics_of_early_param_region_def_id(self, def_id: Self::DefId, ebr: Self::EarlyParamRegion) -> Self::DefId; which is quite nasty but calling generics_of returned 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 in Region::new_var.

traits added to inherent

  • RegionName so we can get the names of LateParamRegion and EarlyParamRegion with a get_name() and also is_named().
  • DefIdGetter so we can get the DefId of kind in LateParamRegion

r? lcnr

Part of #159654

@rustbot

rustbot commented Aug 4, 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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 4, 2026
Comment thread compiler/rustc_middle/src/ty/context/impl_interner.rs Outdated
@lcnr

lcnr commented Aug 4, 2026

Copy link
Copy Markdown
Contributor
generics_of_early_param_region_def_id

hmm, without looking much at the code, I feel like we should move Generics into rustc_type_ir instead 🤔 how much effort is that/actually make it an inherent trait to make that transition easier in the future

Comment thread compiler/rustc_type_ir/src/sty/mod.rs Outdated
Comment thread compiler/rustc_type_ir/src/interner.rs Outdated
@rust-bors

This comment has been minimized.

@Jamesbarford
Jamesbarford force-pushed the chore/shrink-region-ext-triats-pt2 branch from d2eb2a2 to 78adf31 Compare August 6, 2026 08:05
@rustbot

rustbot commented Aug 6, 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.

@rust-bors

rust-bors Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #160627) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants