Overhaul RegionKind
and Region
.
Specifically, change `Region` from this: ``` pub type Region<'tcx> = &'tcx RegionKind; ``` to this: ``` pub struct Region<'tcx>(&'tcx Interned<RegionKind>); ``` This now matches `Ty` and `Predicate` more closely. Things to note - Regions have always been interned, but we haven't been using pointer-based `Eq` and `Hash`. This is now happening. - I chose to impl `Deref` for `Region` because it makes pattern matching a lot nicer, and `Region` can be viewed as just a smart wrapper for `RegionKind`. - Various methods are moved from `RegionKind` to `Region`. - There is a lot of tedious sigil changes. - A couple of types like `HighlightBuilder`, `RegionHighlightMode` now have a `'tcx` lifetime because they hold a `Ty<'tcx>`, so they can call `mk_region`. - A couple of test outputs change slightly, I'm not sure why, but the new outputs are a little better.
This commit is contained in:
parent
925ec0d3c7
commit
7024dc523a
80 changed files with 443 additions and 346 deletions
|
@ -3,10 +3,11 @@
|
|||
|
||||
use crate::MirPass;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_index::bit_set::BitSet;
|
||||
use rustc_index::vec::IndexVec;
|
||||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::{self, TyCtxt};
|
||||
use rustc_middle::ty::{self, ReErased, Region, TyCtxt};
|
||||
|
||||
const MAX_NUM_BLOCKS: usize = 800;
|
||||
const MAX_NUM_LOCALS: usize = 3000;
|
||||
|
@ -231,11 +232,15 @@ fn normalize_array_len_call<'tcx>(
|
|||
// current way of patching doesn't allow to work with `mut`
|
||||
(
|
||||
ty::Ref(
|
||||
ty::RegionKind::ReErased,
|
||||
Region(Interned(ReErased, _)),
|
||||
operand_ty,
|
||||
Mutability::Not,
|
||||
),
|
||||
ty::Ref(ty::RegionKind::ReErased, cast_ty, Mutability::Not),
|
||||
ty::Ref(
|
||||
Region(Interned(ReErased, _)),
|
||||
cast_ty,
|
||||
Mutability::Not,
|
||||
),
|
||||
) => {
|
||||
match (operand_ty.kind(), cast_ty.kind()) {
|
||||
// current way of patching doesn't allow to work with `mut`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue