Skip to content

Commit 8f948bc

Browse files
committed
Update region_scope_tree
1 parent 9c3de34 commit 8f948bc

File tree

8 files changed

+10
-14
lines changed

8 files changed

+10
-14
lines changed

src/librustc/arena.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ macro_rules! arena_types {
1717
[few] mir_keys: rustc::util::nodemap::DefIdSet,
1818
[decode] specialization_graph: rustc::traits::specialization_graph::Graph,
1919
[few] crate_inherent_impls: rustc::ty::CrateInherentImpls,
20+
[] region_scope_tree: rustc::middle::region::ScopeTree,
2021
], $tcx);
2122
)
2223
}

src/librustc/middle/region.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ use crate::ty;
1212

1313
use std::mem;
1414
use std::fmt;
15-
use rustc_data_structures::sync::Lrc;
1615
use rustc_macros::HashStable;
1716
use syntax::source_map;
1817
use syntax::ast;
@@ -1323,7 +1322,7 @@ impl<'a, 'tcx> Visitor<'tcx> for RegionResolutionVisitor<'a, 'tcx> {
13231322
}
13241323

13251324
fn region_scope_tree<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
1326-
-> Lrc<ScopeTree>
1325+
-> &'tcx ScopeTree
13271326
{
13281327
let closure_base_def_id = tcx.closure_base_def_id(def_id);
13291328
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)
13651364
ScopeTree::default()
13661365
};
13671366

1368-
Lrc::new(scope_tree)
1367+
tcx.arena.alloc(scope_tree)
13691368
}
13701369

13711370
pub fn provide(providers: &mut Providers<'_>) {

src/librustc/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ rustc_queries! {
451451

452452
/// Per-body `region::ScopeTree`. The `DefId` should be the owner `DefId` for the body;
453453
/// in the case of closures, this will be redirected to the enclosing function.
454-
query region_scope_tree(_: DefId) -> Lrc<region::ScopeTree> {}
454+
query region_scope_tree(_: DefId) -> &'tcx region::ScopeTree {}
455455

456456
query mir_shims(key: ty::InstanceDef<'tcx>) -> &'tcx mir::Mir<'tcx> {
457457
no_force

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ pub struct BorrowckCtxt<'a, 'tcx: 'a> {
234234
// Some in `borrowck_fn` and cleared later
235235
tables: &'a ty::TypeckTables<'tcx>,
236236

237-
region_scope_tree: Lrc<region::ScopeTree>,
237+
region_scope_tree: &'tcx region::ScopeTree,
238238

239239
owner_def_id: DefId,
240240

src/librustc_mir/borrow_check/error_reporting.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use rustc::ty::layout::VariantIdx;
1717
use rustc::ty::print::Print;
1818
use rustc_data_structures::fx::FxHashSet;
1919
use rustc_data_structures::indexed_vec::Idx;
20-
use rustc_data_structures::sync::Lrc;
2120
use rustc_errors::{Applicability, DiagnosticBuilder};
2221
use syntax_pos::Span;
2322
use syntax::source_map::CompilerDesugaringKind;
@@ -812,7 +811,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
812811
&mut self,
813812
context: Context,
814813
name: &str,
815-
scope_tree: &Lrc<ScopeTree>,
814+
scope_tree: &'tcx ScopeTree,
816815
borrow: &BorrowData<'tcx>,
817816
drop_span: Span,
818817
borrow_spans: UseSpans,
@@ -1001,7 +1000,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
10011000
fn report_temporary_value_does_not_live_long_enough(
10021001
&mut self,
10031002
context: Context,
1004-
scope_tree: &Lrc<ScopeTree>,
1003+
scope_tree: &'tcx ScopeTree,
10051004
borrow: &BorrowData<'tcx>,
10061005
drop_span: Span,
10071006
borrow_spans: UseSpans,

src/librustc_mir/hair/cx/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ use syntax::ast;
1818
use syntax::attr;
1919
use syntax::symbol::Symbol;
2020
use rustc::hir;
21-
use rustc_data_structures::sync::Lrc;
2221
use crate::hair::constant::{lit_to_const, LitToConstError};
2322

2423
#[derive(Clone)]
@@ -32,7 +31,7 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
3231
/// Identity `InternalSubsts` for use with const-evaluation.
3332
pub identity_substs: &'gcx InternalSubsts<'gcx>,
3433

35-
pub region_scope_tree: Lrc<region::ScopeTree>,
34+
pub region_scope_tree: &'gcx region::ScopeTree,
3635
pub tables: &'a ty::TypeckTables<'gcx>,
3736

3837
/// This is `Constness::Const` if we are compiling a `static`,

src/librustc_typeck/check/generator_interior.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ use rustc::hir::intravisit::{self, Visitor, NestedVisitorMap};
88
use rustc::hir::{self, Pat, PatKind, Expr};
99
use rustc::middle::region;
1010
use rustc::ty::{self, Ty};
11-
use rustc_data_structures::sync::Lrc;
1211
use syntax_pos::Span;
1312
use super::FnCtxt;
1413
use crate::util::nodemap::FxHashMap;
1514

1615
struct InteriorVisitor<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
1716
fcx: &'a FnCtxt<'a, 'gcx, 'tcx>,
1817
types: FxHashMap<Ty<'tcx>, usize>,
19-
region_scope_tree: Lrc<region::ScopeTree>,
18+
region_scope_tree: &'gcx region::ScopeTree,
2019
expr_count: usize,
2120
}
2221

src/librustc_typeck/check/regionck.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ use rustc::ty::{self, Ty};
8686

8787
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
8888
use rustc::hir::{self, PatKind};
89-
use rustc_data_structures::sync::Lrc;
9089
use std::mem;
9190
use std::ops::Deref;
9291
use std::rc::Rc;
@@ -195,7 +194,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
195194
pub struct RegionCtxt<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
196195
pub fcx: &'a FnCtxt<'a, 'gcx, 'tcx>,
197196

198-
pub region_scope_tree: Lrc<region::ScopeTree>,
197+
pub region_scope_tree: &'gcx region::ScopeTree,
199198

200199
outlives_environment: OutlivesEnvironment<'tcx>,
201200

0 commit comments

Comments
 (0)