Make THIR building a stealable query

This commit is contained in:
LeSeulArtichaut
2021-04-04 18:42:17 +02:00
parent bd80018159
commit 6f64eb1fe6
20 changed files with 60 additions and 42 deletions

View File

@@ -13,6 +13,7 @@ use crate::middle::resolve_lifetime::{self, LifetimeScopeForPath, ObjectLifetime
use crate::middle::stability;
use crate::mir::interpret::{self, Allocation, ConstValue, Scalar};
use crate::mir::{Body, Field, Local, Place, PlaceElem, ProjectionKind, Promoted};
use crate::thir::Thir;
use crate::traits;
use crate::ty::query::{self, OnDiskCache, TyCtxtAt};
use crate::ty::subst::{GenericArg, GenericArgKind, InternalSubsts, Subst, SubstsRef, UserSubsts};
@@ -1041,6 +1042,10 @@ impl<'tcx> TyCtxt<'tcx> {
}
}
pub fn alloc_steal_thir(self, thir: Thir<'tcx>) -> &'tcx Steal<Thir<'tcx>> {
self.arena.alloc(Steal::new(thir))
}
pub fn alloc_steal_mir(self, mir: Body<'tcx>) -> &'tcx Steal<Body<'tcx>> {
self.arena.alloc(Steal::new(mir))
}

View File

@@ -18,6 +18,7 @@ use crate::mir::interpret::GlobalId;
use crate::mir::interpret::{ConstAlloc, LitToConstError, LitToConstInput};
use crate::mir::interpret::{ConstValue, EvalToAllocationRawResult, EvalToConstValueResult};
use crate::mir::mono::CodegenUnit;
use crate::thir;
use crate::traits::query::{
CanonicalPredicateGoal, CanonicalProjectionGoal, CanonicalTyGoal,
CanonicalTypeOpAscribeUserTypeGoal, CanonicalTypeOpEqGoal, CanonicalTypeOpNormalizeGoal,

View File

@@ -669,7 +669,7 @@ impl<'tcx> GeneratorSubsts<'tcx> {
}
}
#[derive(Debug, Copy, Clone)]
#[derive(Debug, Copy, Clone, HashStable)]
pub enum UpvarSubsts<'tcx> {
Closure(SubstsRef<'tcx>),
Generator(SubstsRef<'tcx>),