Skip to content

Commit

Permalink
Update region_scope_tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Apr 25, 2019
1 parent 5d67618 commit b8b4ad5
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 14 deletions.
1 change: 1 addition & 0 deletions src/librustc/arena.rs
Expand Up @@ -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);
)
}
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/middle/region.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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<'_>) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/query/mod.rs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/borrowck/mod.rs
Expand Up @@ -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,

Expand Down
5 changes: 2 additions & 3 deletions src/librustc_mir/borrow_check/error_reporting.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_mir/hair/cx/mod.rs
Expand Up @@ -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)]
Expand All @@ -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`,
Expand Down
3 changes: 1 addition & 2 deletions src/librustc_typeck/check/generator_interior.rs
Expand Up @@ -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,
}

Expand Down
3 changes: 1 addition & 2 deletions src/librustc_typeck/check/regionck.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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>,

Expand Down

0 comments on commit b8b4ad5

Please sign in to comment.