Skip to content
Permalink
Browse files

Update region_scope_tree

  • Loading branch information...
Zoxc committed Nov 30, 2018
1 parent 5d67618 commit b8b4ad597a2eac24452e2e78f7b043805f2bb846
@@ -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);
)
}
@@ -12,7 +12,6 @@ use crate::ty;

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 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> {
}

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<'_>) {
@@ -456,7 +456,7 @@ rustc_queries! {

/// 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
@@ -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,

@@ -17,7 +17,6 @@ use rustc::ty::layout::VariantIdx;
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 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
&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 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
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,
@@ -18,7 +18,6 @@ use syntax::ast;
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`,
@@ -8,15 +8,14 @@ use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
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;

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,
}

@@ -86,7 +86,6 @@ use rustc::ty::{self, Ty};

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 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
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>,

0 comments on commit b8b4ad5

Please sign in to comment.
You can’t perform that action at this time.