Skip to content

Commit 4de8c6a

Browse files
committed
Update region_scope_tree
1 parent 347a623 commit 4de8c6a

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
@@ -11,6 +11,7 @@ macro_rules! arena_types {
1111
[decode] specialization_graph: rustc::traits::specialization_graph::Graph,
1212
// FIXME: We only allocate one of these. Optimize for that case?
1313
[] crate_inherent_impls: rustc::ty::CrateInherentImpls,
14+
[] region_scope_tree: rustc::middle::region::ScopeTree,
1415
], $tcx);
1516
)
1617
}

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
@@ -496,7 +496,7 @@ rustc_queries! {
496496

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

501501
}
502502

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
@@ -16,7 +16,6 @@ use rustc::ty::{self, DefIdTree};
1616
use rustc::ty::print::Print;
1717
use rustc_data_structures::fx::FxHashSet;
1818
use rustc_data_structures::indexed_vec::Idx;
19-
use rustc_data_structures::sync::Lrc;
2019
use rustc_errors::{Applicability, DiagnosticBuilder};
2120
use syntax_pos::Span;
2221
use syntax::source_map::CompilerDesugaringKind;
@@ -817,7 +816,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
817816
&mut self,
818817
context: Context,
819818
name: &str,
820-
scope_tree: &Lrc<ScopeTree>,
819+
scope_tree: &'tcx ScopeTree,
821820
borrow: &BorrowData<'tcx>,
822821
drop_span: Span,
823822
borrow_spans: UseSpans,
@@ -1006,7 +1005,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
10061005
fn report_temporary_value_does_not_live_long_enough(
10071006
&mut self,
10081007
context: Context,
1009-
scope_tree: &Lrc<ScopeTree>,
1008+
scope_tree: &'tcx ScopeTree,
10101009
borrow: &BorrowData<'tcx>,
10111010
drop_span: Span,
10121011
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)