Skip to content

Commit 513d392

Browse files
committed
rustc: Replace &'a TyCtxt<'tcx> with a TyCtxt<'a, 'tcx> wrapper.
1 parent 8fc2c46 commit 513d392

File tree

147 files changed

+1331
-1338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

147 files changed

+1331
-1338
lines changed

src/librustc/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use syntax::ptr::P;
1919
use hir::{self, PatKind};
2020

2121
struct CFGBuilder<'a, 'tcx: 'a> {
22-
tcx: &'a TyCtxt<'tcx>,
22+
tcx: TyCtxt<'a, 'tcx>,
2323
graph: CFGGraph,
2424
fn_exit: CFGIndex,
2525
loop_scopes: Vec<LoopScope>,
@@ -32,7 +32,7 @@ struct LoopScope {
3232
break_index: CFGIndex, // where to go on a `break
3333
}
3434

35-
pub fn construct(tcx: &TyCtxt,
35+
pub fn construct(tcx: TyCtxt,
3636
blk: &hir::Block) -> CFG {
3737
let mut graph = graph::Graph::new();
3838
let entry = graph.add_node(CFGNodeData::Entry);

src/librustc/cfg/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
5858
pub type CFGEdge = graph::Edge<CFGEdgeData>;
5959

6060
impl CFG {
61-
pub fn new(tcx: &TyCtxt,
61+
pub fn new(tcx: TyCtxt,
6262
blk: &hir::Block) -> CFG {
6363
construct::construct(tcx, blk)
6464
}

src/librustc/dep_graph/visit.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ use super::dep_node::DepNode;
2222
/// read edge from the corresponding AST node. This is used in
2323
/// compiler passes to automatically record the item that they are
2424
/// working on.
25-
pub fn visit_all_items_in_krate<'tcx,V,F>(tcx: &TyCtxt<'tcx>,
26-
mut dep_node_fn: F,
27-
visitor: &mut V)
25+
pub fn visit_all_items_in_krate<'a, 'tcx, V, F>(tcx: TyCtxt<'a, 'tcx>,
26+
mut dep_node_fn: F,
27+
visitor: &mut V)
2828
where F: FnMut(DefId) -> DepNode<DefId>, V: Visitor<'tcx>
2929
{
3030
struct TrackingVisitor<'visit, 'tcx: 'visit, F: 'visit, V: 'visit> {
31-
tcx: &'visit TyCtxt<'tcx>,
31+
tcx: TyCtxt<'visit, 'tcx>,
3232
dep_node_fn: &'visit mut F,
3333
visitor: &'visit mut V
3434
}

src/librustc/hir/pat_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ pub fn simple_name<'a>(pat: &'a hir::Pat) -> Option<ast::Name> {
209209
}
210210
}
211211

212-
pub fn def_to_path(tcx: &TyCtxt, id: DefId) -> hir::Path {
212+
pub fn def_to_path(tcx: TyCtxt, id: DefId) -> hir::Path {
213213
let name = tcx.item_name(id);
214214
hir::Path::from_ident(DUMMY_SP, hir::Ident::from_name(name))
215215
}

src/librustc/infer/bivariate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'a, 'tcx> Bivariate<'a, 'tcx> {
4545
impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Bivariate<'a, 'tcx> {
4646
fn tag(&self) -> &'static str { "Bivariate" }
4747

48-
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.tcx() }
48+
fn tcx(&self) -> TyCtxt<'a, 'tcx> { self.fields.tcx() }
4949

5050
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
5151

src/librustc/infer/combine.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ fn unify_float_variable(&self,
151151
}
152152

153153
impl<'a, 'tcx> CombineFields<'a, 'tcx> {
154-
pub fn tcx(&self) -> &'a TyCtxt<'tcx> {
154+
pub fn tcx(&self) -> TyCtxt<'a, 'tcx> {
155155
self.infcx.tcx
156156
}
157157

@@ -300,7 +300,7 @@ struct Generalizer<'cx, 'tcx:'cx> {
300300
}
301301

302302
impl<'cx, 'tcx> ty::fold::TypeFolder<'tcx> for Generalizer<'cx, 'tcx> {
303-
fn tcx(&self) -> &TyCtxt<'tcx> {
303+
fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx> {
304304
self.infcx.tcx
305305
}
306306

src/librustc/infer/equate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a, 'tcx> Equate<'a, 'tcx> {
3636
impl<'a, 'tcx> TypeRelation<'a,'tcx> for Equate<'a, 'tcx> {
3737
fn tag(&self) -> &'static str { "Equate" }
3838

39-
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.tcx() }
39+
fn tcx(&self) -> TyCtxt<'a, 'tcx> { self.fields.tcx() }
4040

4141
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
4242

src/librustc/infer/error_reporting.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ use syntax::codemap::{self, Pos, Span};
9595
use syntax::parse::token;
9696
use syntax::ptr::P;
9797

98-
impl<'tcx> TyCtxt<'tcx> {
99-
pub fn note_and_explain_region(&self,
98+
impl<'a, 'tcx> TyCtxt<'a, 'tcx> {
99+
pub fn note_and_explain_region(self,
100100
err: &mut DiagnosticBuilder,
101101
prefix: &str,
102102
region: ty::Region,
@@ -112,7 +112,7 @@ impl<'tcx> TyCtxt<'tcx> {
112112
}
113113
}
114114

115-
fn explain_span(tcx: &TyCtxt, heading: &str, span: Span)
115+
fn explain_span(tcx: TyCtxt, heading: &str, span: Span)
116116
-> (String, Option<Span>) {
117117
let lo = tcx.sess.codemap().lookup_char_pos_adj(span.lo);
118118
(format!("the {} at {}:{}", heading, lo.line, lo.col.to_usize()),
@@ -474,7 +474,7 @@ impl<'a, 'tcx> ErrorReporting<'tcx> for InferCtxt<'a, 'tcx> {
474474
}
475475
}
476476

477-
fn free_regions_from_same_fn(tcx: &TyCtxt,
477+
fn free_regions_from_same_fn(tcx: TyCtxt,
478478
sub: Region,
479479
sup: Region)
480480
-> Option<FreeRegionsFromSameFn> {
@@ -1109,7 +1109,7 @@ struct RebuildPathInfo<'a> {
11091109
}
11101110

11111111
struct Rebuilder<'a, 'tcx: 'a> {
1112-
tcx: &'a TyCtxt<'tcx>,
1112+
tcx: TyCtxt<'a, 'tcx>,
11131113
fn_decl: &'a hir::FnDecl,
11141114
expl_self_opt: Option<&'a hir::ExplicitSelf_>,
11151115
generics: &'a hir::Generics,
@@ -1125,7 +1125,7 @@ enum FreshOrKept {
11251125
}
11261126

11271127
impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
1128-
fn new(tcx: &'a TyCtxt<'tcx>,
1128+
fn new(tcx: TyCtxt<'a, 'tcx>,
11291129
fn_decl: &'a hir::FnDecl,
11301130
expl_self_opt: Option<&'a hir::ExplicitSelf_>,
11311131
generics: &'a hir::Generics,
@@ -1929,7 +1929,7 @@ impl<'tcx> Resolvable<'tcx> for ty::PolyTraitRef<'tcx> {
19291929
}
19301930
}
19311931

1932-
fn lifetimes_in_scope(tcx: &TyCtxt,
1932+
fn lifetimes_in_scope(tcx: TyCtxt,
19331933
scope_id: ast::NodeId)
19341934
-> Vec<hir::LifetimeDef> {
19351935
let mut taken = Vec::new();

src/librustc/infer/freshen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
7878
}
7979

8080
impl<'a, 'tcx> TypeFolder<'tcx> for TypeFreshener<'a, 'tcx> {
81-
fn tcx<'b>(&'b self) -> &'b TyCtxt<'tcx> {
81+
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'tcx> {
8282
self.infcx.tcx
8383
}
8484

src/librustc/infer/glb.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a, 'tcx> Glb<'a, 'tcx> {
3636
impl<'a, 'tcx> TypeRelation<'a, 'tcx> for Glb<'a, 'tcx> {
3737
fn tag(&self) -> &'static str { "Glb" }
3838

39-
fn tcx(&self) -> &'a TyCtxt<'tcx> { self.fields.tcx() }
39+
fn tcx(&self) -> TyCtxt<'a, 'tcx> { self.fields.tcx() }
4040

4141
fn a_is_expected(&self) -> bool { self.fields.a_is_expected }
4242

0 commit comments

Comments
 (0)