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 |
This comment has been minimized.
This comment has been minimized.
d2eb2a2 to
78adf31
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
78adf31 to
1625ceb
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1625ceb to
21fdb0a
Compare
This comment has been minimized.
This comment has been minimized.
| let r = ty::Region::new_late_param(self.infcx.tcx, self.mir_def.to_def_id(), kind); | ||
| let r = ty::Region::new_late_param( | ||
| self.infcx.tcx, | ||
| ty::LateParamRegion { scope: self.mir_def.to_def_id(), kind }, |
There was a problem hiding this comment.
alternative, rustc and rustc_type_ir agree on LateParamRegion except that they represent the actual region differently, which tbh, they shouldn't do 🤣 could we just move LateParamRegion into rustc_type_ir and then keep the current fn sig here?
There was a problem hiding this comment.
I'm a bit slow on the uptake here, what do you mean by "just move"? Make a;
struct LateParamRegion<I: Interner> {
pub scope: I::DefId,
pub kind: I::LateParamRegionKind,
}And possibly port across; pub enum LateParamRegionKind { too ?
There was a problem hiding this comment.
exactly. LateParamRegionKind should prolly also be moved even if r-a currently slightly differs, I think it's easier for them to just use the same type
There was a problem hiding this comment.
with late param region being uplifted, you can keep this as two separate function arguments
This comment has been minimized.
This comment has been minimized.
21fdb0a to
c7e93c1
Compare
This comment has been minimized.
This comment has been minimized.
…-region, r=lcnr Move `LateParamRegion` to `rustc_type_ir` Move `LateParamRegion` to `rustc_type_ir`. As per feedback, I created a `TrivialLiftImpls!` mirroring `rustc_middle`'s variant which is creates an identity function for `lift_to_interner(...)`. Spun off from; rust-lang#160509 r? @lcnr
…-region, r=lcnr Move `LateParamRegion` to `rustc_type_ir` Move `LateParamRegion` to `rustc_type_ir`. As per feedback, I created a `TrivialLiftImpls!` mirroring `rustc_middle`'s variant which is creates an identity function for `lift_to_interner(...)`. Spun off from; rust-lang#160509 r? @lcnr
Rollup merge of #160986 - Jamesbarford:chore/move-late-param-region, r=lcnr Move `LateParamRegion` to `rustc_type_ir` Move `LateParamRegion` to `rustc_type_ir`. As per feedback, I created a `TrivialLiftImpls!` mirroring `rustc_middle`'s variant which is creates an identity function for `lift_to_interner(...)`. Spun off from; #160509 r? @lcnr
This comment has been minimized.
This comment has been minimized.
c7e93c1 to
d38ad3c
Compare
…r=lcnr Move `LateParamRegion` to `rustc_type_ir` Move `LateParamRegion` to `rustc_type_ir`. As per feedback, I created a `TrivialLiftImpls!` mirroring `rustc_middle`'s variant which is creates an identity function for `lift_to_interner(...)`. Spun off from; rust-lang/rust#160509 r? @lcnr
4b48828 to
f3cf30d
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. |
|
@bors r=lcnr |
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
Rollup of 25 pull requests Successful merges: - #159074 ([PAC] FnAbi, llvm.ptrauth.resign and Session API change (2/8)) - #159792 (A more readable debug map for IndexMaps) - #161895 (std::sys::pal::sgx: fix mismatched alloc/free alignment) - #161900 (bootstrap: Include feature-gated items in bootstrap tool docs) - #161940 (Promote `wasm32-wasip3` to a tier 2 target) - #162072 (Add new Tier-3 target: `powerpc64-sony-ps3`) - #162179 (type system const items via direct rhs) - #162277 (Introduce `rustc_middle::middel::resolve`) - #162285 (box: fixup map/try_map deallocate calls) - #162286 (string: don't unwind prematurely) - #162289 (alloc: a bunch of safety comments) - #162292 (Update `askama` version to `0.16.1`) - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`) - #160906 (Suggest usize instead of placeholder type for array length constants) - #160936 (traits: Represent live alias arguments as bitsets) - #161400 (Improve diagnostics for references to closures) - #161656 (Suggest mutable references for FnMut closure arguments) - #161711 (Add more splat fn type tests) - #161786 (Make `tcx.def_id_partial_cmp` public) - #161953 (sanitizers: Implicitly disable mutually exclusive sanitizers) - #162155 (add suggestion for `rustc_allowed_through_unstable_modules` attribute) - #162212 (Implement `Rng` for `Box`) - #162246 (Fix incorrect meta span) - #162266 (std: fix typo) - #162291 (Add regression test from 1.98.1)
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
Rollup of 25 pull requests Successful merges: - #159074 ([PAC] FnAbi, llvm.ptrauth.resign and Session API change (2/8)) - #159792 (A more readable debug map for IndexMaps) - #160745 (make closures act like MaybeDangling) - #161895 (std::sys::pal::sgx: fix mismatched alloc/free alignment) - #161940 (Promote `wasm32-wasip3` to a tier 2 target) - #162072 (Add new Tier-3 target: `powerpc64-sony-ps3`) - #162179 (type system const items via direct rhs) - #162277 (Introduce `rustc_middle::middel::resolve`) - #162285 (box: fixup map/try_map deallocate calls) - #162286 (string: don't unwind prematurely) - #162289 (alloc: a bunch of safety comments) - #162292 (Update `askama` version to `0.16.1`) - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`) - #160906 (Suggest usize instead of placeholder type for array length constants) - #160936 (traits: Represent live alias arguments as bitsets) - #161400 (Improve diagnostics for references to closures) - #161656 (Suggest mutable references for FnMut closure arguments) - #161711 (Add more splat fn type tests) - #161786 (Make `tcx.def_id_partial_cmp` public) - #161953 (sanitizers: Implicitly disable mutually exclusive sanitizers) - #162155 (add suggestion for `rustc_allowed_through_unstable_modules` attribute) - #162212 (Implement `Rng` for `Box`) - #162246 (Fix incorrect meta span) - #162266 (std: fix typo) - #162291 (Add regression test from 1.98.1)
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
Rollup of 27 pull requests Successful merges: - #159074 ([PAC] FnAbi, llvm.ptrauth.resign and Session API change (2/8)) - #159792 (A more readable debug map for IndexMaps) - #160745 (make closures act like MaybeDangling) - #161940 (Promote `wasm32-wasip3` to a tier 2 target) - #162030 (Prevent `--test` to be used in `rustdoc-html` testsuite) - #162072 (Add new Tier-3 target: `powerpc64-sony-ps3`) - #162179 (type system const items via direct rhs) - #162262 (Avoid manually instantiating some binders in error reporting with `-Znext-solver`) - #162277 (Introduce `rustc_middle::middel::resolve`) - #162285 (box: fixup map/try_map deallocate calls) - #162286 (string: don't unwind prematurely) - #162289 (alloc: a bunch of safety comments) - #162290 (abby test DSL: AliasTyOutlivesViaEnv) - #162292 (Update `askama` version to `0.16.1`) - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`) - #160906 (Suggest usize instead of placeholder type for array length constants) - #160936 (traits: Represent live alias arguments as bitsets) - #161400 (Improve diagnostics for references to closures) - #161656 (Suggest mutable references for FnMut closure arguments) - #161711 (Add more splat fn type tests) - #161786 (Make `tcx.def_id_partial_cmp` public) - #161953 (sanitizers: Implicitly disable mutually exclusive sanitizers) - #162155 (add suggestion for `rustc_allowed_through_unstable_modules` attribute) - #162212 (Implement `Rng` for `Box`) - #162246 (Fix incorrect meta span) - #162266 (std: fix typo) - #162291 (Add regression test from 1.98.1)
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
…uwer Rollup of 25 pull requests Successful merges: - #162072 (Add new Tier-3 target: `powerpc64-sony-ps3`) - #162179 (type system const items via direct rhs) - #162255 (let people change rustc-dev-guide in-tree) - #162262 (Avoid manually instantiating some binders in error reporting with `-Znext-solver`) - #162277 (Introduce `rustc_middle::middel::resolve`) - #162285 (box: fixup map/try_map deallocate calls) - #162286 (string: don't unwind prematurely) - #162289 (alloc: a bunch of safety comments) - #162290 (abby test DSL: AliasTyOutlivesViaEnv) - #162292 (Update `askama` version to `0.16.1`) - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`) - #160906 (Suggest usize instead of placeholder type for array length constants) - #160936 (traits: Represent live alias arguments as bitsets) - #161394 (fix `is_homogeneous_aggregate`: use unit size, not total size ) - #161400 (Improve diagnostics for references to closures) - #161656 (Suggest mutable references for FnMut closure arguments) - #161711 (Add more splat fn type tests) - #161786 (Make `tcx.def_id_partial_cmp` public) - #161953 (sanitizers: Implicitly disable mutually exclusive sanitizers) - #162155 (add suggestion for `rustc_allowed_through_unstable_modules` attribute) - #162212 (Implement `Rng` for `Box`) - #162246 (Fix incorrect meta span) - #162266 (std: fix typo) - #162291 (Add regression test from 1.98.1) - #162303 (Fix a minor spelling error in `library/std/src/sys/fs/unix.rs`)
…xt-triats-pt2, r=lcnr Remove `RegionExt`; move methods to `Region` in `rustc_type_ir` 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 rust-lang#159654
…uwer Rollup of 25 pull requests Successful merges: - #162072 (Add new Tier-3 target: `powerpc64-sony-ps3`) - #162179 (type system const items via direct rhs) - #162255 (let people change rustc-dev-guide in-tree) - #162262 (Avoid manually instantiating some binders in error reporting with `-Znext-solver`) - #162277 (Introduce `rustc_middle::middel::resolve`) - #162285 (box: fixup map/try_map deallocate calls) - #162286 (string: don't unwind prematurely) - #162289 (alloc: a bunch of safety comments) - #162290 (abby test DSL: AliasTyOutlivesViaEnv) - #162292 (Update `askama` version to `0.16.1`) - #160509 (Remove `RegionExt`; move methods to `Region` in `rustc_type_ir`) - #160906 (Suggest usize instead of placeholder type for array length constants) - #160936 (traits: Represent live alias arguments as bitsets) - #161394 (fix `is_homogeneous_aggregate`: use unit size, not total size ) - #161400 (Improve diagnostics for references to closures) - #161656 (Suggest mutable references for FnMut closure arguments) - #161711 (Add more splat fn type tests) - #161786 (Make `tcx.def_id_partial_cmp` public) - #161953 (sanitizers: Implicitly disable mutually exclusive sanitizers) - #162155 (add suggestion for `rustc_allowed_through_unstable_modules` attribute) - #162212 (Implement `Rng` for `Box`) - #162246 (Fix incorrect meta span) - #162266 (std: fix typo) - #162291 (Add regression test from 1.98.1) - #162303 (Fix a minor spelling error in `library/std/src/sys/fs/unix.rs`)
View all comments
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
Part of #159654