Update region_scope_tree

This commit is contained in:
John Kåre Alsaker 2018-11-30 17:38:31 +01:00
parent 5d67618d4c
commit b8b4ad597a
8 changed files with 10 additions and 14 deletions

View File

@ -16,6 +16,7 @@ macro_rules! arena_types {
)>,
[few] mir_keys: rustc::util::nodemap::DefIdSet,
[decode] specialization_graph: rustc::traits::specialization_graph::Graph,
[] region_scope_tree: rustc::middle::region::ScopeTree,
], $tcx);
)
}

View File

@ -12,7 +12,6 @@
use std::mem;
use std::fmt;
use rustc_data_structures::sync::Lrc;
use rustc_macros::HashStable;
use syntax::source_map;
use syntax::ast;
@ -1323,7 +1322,7 @@ fn visit_local(&mut self, l: &'tcx Local) {
}
fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
-> Lrc<ScopeTree>
-> &'tcx ScopeTree
{
let closure_base_def_id = tcx.closure_base_def_id(def_id);
if closure_base_def_id != def_id {
@ -1365,7 +1364,7 @@ fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
ScopeTree::default()
};
Lrc::new(scope_tree)
tcx.arena.alloc(scope_tree)
}
pub fn provide(providers: &mut Providers<'_>) {

View File

@ -456,7 +456,7 @@
/// Per-body `region::ScopeTree`. The `DefId` should be the owner `DefId` for the body;
/// in the case of closures, this will be redirected to the enclosing function.
query region_scope_tree(_: DefId) -> Lrc<region::ScopeTree> {}
query region_scope_tree(_: DefId) -> &'tcx region::ScopeTree {}
query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx> {
no_force

View File

@ -228,7 +228,7 @@ pub struct BorrowckCtxt<'a, 'tcx: 'a> {
// Some in `borrowck_fn` and cleared later
tables: &'a ty::TypeckTables<'tcx>,
region_scope_tree: Lrc<region::ScopeTree>,
region_scope_tree: &'tcx region::ScopeTree,
owner_def_id: DefId,

View File

@ -17,7 +17,6 @@
use rustc::ty::print::Print;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::indexed_vec::Idx;
use rustc_data_structures::sync::Lrc;
use rustc_errors::{Applicability, DiagnosticBuilder};
use syntax_pos::Span;
use syntax::source_map::CompilerDesugaringKind;
@ -811,7 +810,7 @@ fn report_local_value_does_not_live_long_enough(
&mut self,
context: Context,
name: &str,
scope_tree: &Lrc<ScopeTree>,
scope_tree: &'tcx ScopeTree,
borrow: &BorrowData<'tcx>,
drop_span: Span,
borrow_spans: UseSpans,
@ -1000,7 +999,7 @@ fn report_thread_local_value_does_not_live_long_enough(
fn report_temporary_value_does_not_live_long_enough(
&mut self,
context: Context,
scope_tree: &Lrc<ScopeTree>,
scope_tree: &'tcx ScopeTree,
borrow: &BorrowData<'tcx>,
drop_span: Span,
borrow_spans: UseSpans,

View File

@ -18,7 +18,6 @@
use syntax::attr;
use syntax::symbol::Symbol;
use rustc::hir;
use rustc_data_structures::sync::Lrc;
use crate::hair::constant::{lit_to_const, LitToConstError};
#[derive(Clone)]
@ -32,7 +31,7 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
/// Identity `InternalSubsts` for use with const-evaluation.
pub identity_substs: &'gcx InternalSubsts<'gcx>,
pub region_scope_tree: Lrc<region::ScopeTree>,
pub region_scope_tree: &'gcx region::ScopeTree,
pub tables: &'a ty::TypeckTables<'gcx>,
/// This is `Constness::Const` if we are compiling a `static`,

View File

@ -8,7 +8,6 @@
use rustc::hir::{self, Pat, PatKind, Expr};
use rustc::middle::region;
use rustc::ty::{self, Ty};
use rustc_data_structures::sync::Lrc;
use syntax_pos::Span;
use super::FnCtxt;
use crate::util::nodemap::FxHashMap;
@ -16,7 +15,7 @@
struct InteriorVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
fcx: &'a FnCtxt<'a, 'gcx, 'tcx>,
types: FxHashMap<Ty<'tcx>, usize>,
region_scope_tree: Lrc<region::ScopeTree>,
region_scope_tree: &'gcx region::ScopeTree,
expr_count: usize,
}

View File

@ -86,7 +86,6 @@
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc::hir::{self, PatKind};
use rustc_data_structures::sync::Lrc;
use std::mem;
use std::ops::Deref;
use std::rc::Rc;
@ -195,7 +194,7 @@ pub fn regionck_fn(&self, fn_id: hir::HirId, body: &'gcx hir::Body) {
pub struct RegionCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
pub fcx: &'a FnCtxt<'a, 'gcx, 'tcx>,
pub region_scope_tree: Lrc<region::ScopeTree>,
pub region_scope_tree: &'gcx region::ScopeTree,
outlives_environment: OutlivesEnvironment<'tcx>,