Arena allocate the result of mir_borrowck
This commit is contained in:
parent
378b5b4ca0
commit
43a3348fd9
@ -35,7 +35,8 @@ macro_rules! arena_types {
|
||||
rustc::mir::Promoted,
|
||||
rustc::mir::BodyAndCache<$tcx>
|
||||
>,
|
||||
[] tables: rustc::ty::TypeckTables<$tcx>,
|
||||
[decode] tables: rustc::ty::TypeckTables<$tcx>,
|
||||
[decode] borrowck_result: rustc::mir::BorrowCheckResult<$tcx>,
|
||||
[] const_allocs: rustc::mir::interpret::Allocation,
|
||||
[] vtable_method: Option<(
|
||||
rustc_hir::def_id::DefId,
|
||||
|
@ -419,13 +419,6 @@ rustc_queries! {
|
||||
query typeck_tables_of(key: DefId) -> &'tcx ty::TypeckTables<'tcx> {
|
||||
desc { |tcx| "type-checking `{}`", tcx.def_path_str(key) }
|
||||
cache_on_disk_if { key.is_local() }
|
||||
load_cached(tcx, id) {
|
||||
let typeck_tables: Option<ty::TypeckTables<'tcx>> = tcx
|
||||
.queries.on_disk_cache
|
||||
.try_load_query_result(tcx, id);
|
||||
|
||||
typeck_tables.map(|tables| &*tcx.arena.alloc(tables))
|
||||
}
|
||||
}
|
||||
query diagnostic_only_typeck_tables_of(key: DefId) -> &'tcx ty::TypeckTables<'tcx> {
|
||||
cache_on_disk_if { key.is_local() }
|
||||
@ -456,9 +449,13 @@ rustc_queries! {
|
||||
BorrowChecking {
|
||||
/// Borrow-checks the function body. If this is a closure, returns
|
||||
/// additional requirements that the closure's creator must verify.
|
||||
query mir_borrowck(key: DefId) -> mir::BorrowCheckResult<'tcx> {
|
||||
query mir_borrowck(key: DefId) -> &'tcx mir::BorrowCheckResult<'tcx> {
|
||||
desc { |tcx| "borrow-checking `{}`", tcx.def_path_str(key) }
|
||||
cache_on_disk_if(tcx, _) { key.is_local() && tcx.is_closure(key) }
|
||||
cache_on_disk_if(tcx, opt_result) {
|
||||
key.is_local()
|
||||
&& (tcx.is_closure(key)
|
||||
|| opt_result.map_or(false, |r| !r.concrete_opaque_types.is_empty()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ pub fn provide(providers: &mut Providers<'_>) {
|
||||
*providers = Providers { mir_borrowck, ..*providers };
|
||||
}
|
||||
|
||||
fn mir_borrowck(tcx: TyCtxt<'_>, def_id: DefId) -> BorrowCheckResult<'_> {
|
||||
fn mir_borrowck(tcx: TyCtxt<'_>, def_id: DefId) -> &BorrowCheckResult<'_> {
|
||||
let (input_body, promoted) = tcx.mir_validated(def_id);
|
||||
debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id));
|
||||
|
||||
@ -101,7 +101,7 @@ fn mir_borrowck(tcx: TyCtxt<'_>, def_id: DefId) -> BorrowCheckResult<'_> {
|
||||
});
|
||||
debug!("mir_borrowck done");
|
||||
|
||||
opt_closure_req
|
||||
tcx.arena.alloc(opt_closure_req)
|
||||
}
|
||||
|
||||
fn do_mir_borrowck<'a, 'tcx>(
|
||||
|
@ -2512,7 +2512,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
substs: SubstsRef<'tcx>,
|
||||
location: Location,
|
||||
) -> ty::InstantiatedPredicates<'tcx> {
|
||||
if let Some(closure_region_requirements) = tcx.mir_borrowck(def_id).closure_requirements {
|
||||
if let Some(ref closure_region_requirements) = tcx.mir_borrowck(def_id).closure_requirements
|
||||
{
|
||||
let closure_constraints = QueryRegionConstraints {
|
||||
outlives: closure_region_requirements.apply_requirements(tcx, def_id, substs),
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user