Skip to content

Commit 28be695

Browse files
committed
rustc: fix fallout from the addition of a 'tcx lifetime on tcx.
1 parent 22f8b84 commit 28be695

Some content is hidden

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

65 files changed

+742
-759
lines changed

src/librustc/driver/pretty.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,25 +262,25 @@ impl pprust::PpAnn for HygieneAnnotation {
262262
}
263263

264264

265-
struct TypedAnnotation {
266-
analysis: CrateAnalysis,
265+
struct TypedAnnotation<'tcx> {
266+
analysis: CrateAnalysis<'tcx>,
267267
}
268268

269-
impl PrinterSupport for TypedAnnotation {
269+
impl<'tcx> PrinterSupport for TypedAnnotation<'tcx> {
270270
fn pp_ann<'a>(&'a self) -> &'a pprust::PpAnn { self as &pprust::PpAnn }
271271
}
272272

273-
impl SessionCarrier for TypedAnnotation {
273+
impl<'tcx> SessionCarrier for TypedAnnotation<'tcx> {
274274
fn sess<'a>(&'a self) -> &'a Session { &self.analysis.ty_cx.sess }
275275
}
276276

277-
impl AstMapCarrier for TypedAnnotation {
277+
impl<'tcx> AstMapCarrier for TypedAnnotation<'tcx> {
278278
fn ast_map<'a>(&'a self) -> Option<&'a ast_map::Map> {
279279
Some(&self.analysis.ty_cx.map)
280280
}
281281
}
282282

283-
impl pprust::PpAnn for TypedAnnotation {
283+
impl<'tcx> pprust::PpAnn for TypedAnnotation<'tcx> {
284284
fn pre(&self,
285285
s: &mut pprust::State,
286286
node: pprust::AnnNode) -> io::IoResult<()> {

src/librustc/lint/builtin.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,11 @@ impl LintPass for TypeLimits {
340340
declare_lint!(CTYPES, Warn,
341341
"proper use of libc types in foreign modules")
342342

343-
struct CTypesVisitor<'a> {
344-
cx: &'a Context<'a>
343+
struct CTypesVisitor<'a, 'tcx: 'a> {
344+
cx: &'a Context<'a, 'tcx>
345345
}
346346

347-
impl<'a> CTypesVisitor<'a> {
347+
impl<'a, 'tcx> CTypesVisitor<'a, 'tcx> {
348348
fn check_def(&mut self, sp: Span, ty_id: ast::NodeId, path_id: ast::NodeId) {
349349
match self.cx.tcx.def_map.borrow().get_copy(&path_id) {
350350
def::DefPrimTy(ast::TyInt(ast::TyI)) => {
@@ -375,7 +375,7 @@ impl<'a> CTypesVisitor<'a> {
375375
}
376376
}
377377

378-
impl<'a> Visitor<()> for CTypesVisitor<'a> {
378+
impl<'a, 'tcx> Visitor<()> for CTypesVisitor<'a, 'tcx> {
379379
fn visit_ty(&mut self, ty: &ast::Ty, _: ()) {
380380
match ty.node {
381381
ast::TyPath(_, _, id) => self.check_def(ty.span, ty.id, id),
@@ -505,11 +505,11 @@ impl LintPass for HeapMemory {
505505
declare_lint!(RAW_POINTER_DERIVING, Warn,
506506
"uses of #[deriving] with raw pointers are rarely correct")
507507

508-
struct RawPtrDerivingVisitor<'a> {
509-
cx: &'a Context<'a>
508+
struct RawPtrDerivingVisitor<'a, 'tcx: 'a> {
509+
cx: &'a Context<'a, 'tcx>
510510
}
511511

512-
impl<'a> Visitor<()> for RawPtrDerivingVisitor<'a> {
512+
impl<'a, 'tcx> Visitor<()> for RawPtrDerivingVisitor<'a, 'tcx> {
513513
fn visit_ty(&mut self, ty: &ast::Ty, _: ()) {
514514
static MSG: &'static str = "use of `#[deriving]` with a raw pointer";
515515
match ty.node {

src/librustc/lint/context.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ impl LintStore {
231231
}
232232

233233
/// Context for lint checking.
234-
pub struct Context<'a> {
234+
pub struct Context<'a, 'tcx: 'a> {
235235
/// Type context we're checking in.
236-
pub tcx: &'a ty::ctxt,
236+
pub tcx: &'a ty::ctxt<'tcx>,
237237

238238
/// The crate being checked.
239239
pub krate: &'a ast::Crate,
@@ -345,10 +345,10 @@ pub fn raw_emit_lint(sess: &Session, lint: &'static Lint,
345345
}
346346
}
347347

348-
impl<'a> Context<'a> {
349-
fn new(tcx: &'a ty::ctxt,
348+
impl<'a, 'tcx> Context<'a, 'tcx> {
349+
fn new(tcx: &'a ty::ctxt<'tcx>,
350350
krate: &'a ast::Crate,
351-
exported_items: &'a ExportedItems) -> Context<'a> {
351+
exported_items: &'a ExportedItems) -> Context<'a, 'tcx> {
352352
// We want to own the lint store, so move it out of the session.
353353
let lint_store = mem::replace(&mut *tcx.sess.lint_store.borrow_mut(),
354354
LintStore::new());
@@ -476,8 +476,8 @@ impl<'a> Context<'a> {
476476
}
477477
}
478478

479-
impl<'a> AstConv for Context<'a>{
480-
fn tcx<'a>(&'a self) -> &'a ty::ctxt { self.tcx }
479+
impl<'a, 'tcx> AstConv<'tcx> for Context<'a, 'tcx>{
480+
fn tcx<'a>(&'a self) -> &'a ty::ctxt<'tcx> { self.tcx }
481481

482482
fn get_item_ty(&self, id: ast::DefId) -> ty::Polytype {
483483
ty::lookup_item_type(self.tcx, id)
@@ -492,7 +492,7 @@ impl<'a> AstConv for Context<'a>{
492492
}
493493
}
494494

495-
impl<'a> Visitor<()> for Context<'a> {
495+
impl<'a, 'tcx> Visitor<()> for Context<'a, 'tcx> {
496496
fn visit_item(&mut self, it: &ast::Item, _: ()) {
497497
self.with_lint_attrs(it.attrs.as_slice(), |cx| {
498498
run_lints!(cx, check_item, it);
@@ -663,7 +663,7 @@ impl<'a> Visitor<()> for Context<'a> {
663663
}
664664

665665
// Output any lints that were previously added to the session.
666-
impl<'a> IdVisitingOperation for Context<'a> {
666+
impl<'a, 'tcx> IdVisitingOperation for Context<'a, 'tcx> {
667667
fn visit_id(&self, id: ast::NodeId) {
668668
match self.tcx.sess.lints.borrow_mut().pop(&id) {
669669
None => {}

src/librustc/metadata/encoder.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ pub type EncodeInlinedItem<'a> = |ecx: &EncodeContext,
7171
rbml_w: &mut Encoder,
7272
ii: InlinedItemRef|: 'a;
7373

74-
pub struct EncodeParams<'a> {
74+
pub struct EncodeParams<'a, 'tcx: 'a> {
7575
pub diag: &'a SpanHandler,
76-
pub tcx: &'a ty::ctxt,
76+
pub tcx: &'a ty::ctxt<'tcx>,
7777
pub reexports2: &'a middle::resolve::ExportMap2,
7878
pub item_symbols: &'a RefCell<NodeMap<String>>,
7979
pub non_inlineable_statics: &'a RefCell<NodeSet>,
@@ -83,9 +83,9 @@ pub struct EncodeParams<'a> {
8383
pub reachable: &'a NodeSet,
8484
}
8585

86-
pub struct EncodeContext<'a> {
86+
pub struct EncodeContext<'a, 'tcx: 'a> {
8787
pub diag: &'a SpanHandler,
88-
pub tcx: &'a ty::ctxt,
88+
pub tcx: &'a ty::ctxt<'tcx>,
8989
pub reexports2: &'a middle::resolve::ExportMap2,
9090
pub item_symbols: &'a RefCell<NodeMap<String>>,
9191
pub non_inlineable_statics: &'a RefCell<NodeSet>,
@@ -1793,12 +1793,12 @@ fn encode_struct_field_attrs(rbml_w: &mut Encoder, krate: &Crate) {
17931793

17941794

17951795

1796-
struct ImplVisitor<'a,'b:'a,'c:'a> {
1797-
ecx: &'a EncodeContext<'b>,
1796+
struct ImplVisitor<'a, 'b:'a, 'c:'a, 'tcx:'b> {
1797+
ecx: &'a EncodeContext<'b, 'tcx>,
17981798
rbml_w: &'a mut Encoder<'c>,
17991799
}
18001800

1801-
impl<'a,'b,'c> Visitor<()> for ImplVisitor<'a,'b,'c> {
1801+
impl<'a, 'b, 'c, 'tcx> Visitor<()> for ImplVisitor<'a, 'b, 'c, 'tcx> {
18021802
fn visit_item(&mut self, item: &Item, _: ()) {
18031803
match item.node {
18041804
ItemImpl(_, Some(ref trait_ref), _, _) => {

src/librustc/metadata/tydecode.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ pub enum DefIdSource {
5959
pub type conv_did<'a> =
6060
|source: DefIdSource, ast::DefId|: 'a -> ast::DefId;
6161

62-
pub struct PState<'a> {
62+
pub struct PState<'a, 'tcx: 'a> {
6363
data: &'a [u8],
6464
krate: ast::CrateNum,
6565
pos: uint,
66-
tcx: &'a ty::ctxt
66+
tcx: &'a ty::ctxt<'tcx>
6767
}
6868

6969
fn peek(st: &PState) -> char {
@@ -105,8 +105,9 @@ fn parse_ident_(st: &mut PState, is_last: |char| -> bool) -> ast::Ident {
105105
})
106106
}
107107

108-
pub fn parse_state_from_data<'a>(data: &'a [u8], crate_num: ast::CrateNum,
109-
pos: uint, tcx: &'a ty::ctxt) -> PState<'a> {
108+
pub fn parse_state_from_data<'a, 'tcx>(data: &'a [u8], crate_num: ast::CrateNum,
109+
pos: uint, tcx: &'a ty::ctxt<'tcx>)
110+
-> PState<'a, 'tcx> {
110111
PState {
111112
data: data,
112113
krate: crate_num,

src/librustc/metadata/tyencode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ use rbml::io::SeekableMemWriter;
3131

3232
macro_rules! mywrite( ($($arg:tt)*) => ({ write!($($arg)*); }) )
3333

34-
pub struct ctxt<'a> {
34+
pub struct ctxt<'a, 'tcx: 'a> {
3535
pub diag: &'a SpanHandler,
3636
// Def -> str Callback:
3737
pub ds: fn(DefId) -> String,
3838
// The type context.
39-
pub tcx: &'a ty::ctxt,
39+
pub tcx: &'a ty::ctxt<'tcx>,
4040
pub abbrevs: &'a abbrev_map
4141
}
4242

src/librustc/middle/astencode.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ use serialize::{EncoderHelpers};
5454
#[cfg(test)] use syntax::print::pprust;
5555
#[cfg(test)] use std::gc::Gc;
5656

57-
struct DecodeContext<'a> {
57+
struct DecodeContext<'a, 'tcx: 'a> {
5858
cdata: &'a cstore::crate_metadata,
59-
tcx: &'a ty::ctxt,
59+
tcx: &'a ty::ctxt<'tcx>,
6060
}
6161

62-
struct ExtendedDecodeContext<'a> {
63-
dcx: &'a DecodeContext<'a>,
62+
struct ExtendedDecodeContext<'a, 'tcx: 'a> {
63+
dcx: &'a DecodeContext<'a, 'tcx>,
6464
from_id_range: ast_util::IdRange,
6565
to_id_range: ast_util::IdRange
6666
}
@@ -176,7 +176,7 @@ fn reserve_id_range(sess: &Session,
176176
ast_util::IdRange { min: to_id_min, max: to_id_max }
177177
}
178178

179-
impl<'a> ExtendedDecodeContext<'a> {
179+
impl<'a, 'tcx> ExtendedDecodeContext<'a, 'tcx> {
180180
pub fn tr_id(&self, id: ast::NodeId) -> ast::NodeId {
181181
/*!
182182
* Translates an internal id, meaning a node id that is known
@@ -382,11 +382,11 @@ fn decode_ast(par_doc: rbml::Doc) -> ast::InlinedItem {
382382
Decodable::decode(&mut d).unwrap()
383383
}
384384

385-
struct AstRenumberer<'a> {
386-
xcx: &'a ExtendedDecodeContext<'a>,
385+
struct AstRenumberer<'a, 'tcx: 'a> {
386+
xcx: &'a ExtendedDecodeContext<'a, 'tcx>,
387387
}
388388

389-
impl<'a> ast_map::FoldOps for AstRenumberer<'a> {
389+
impl<'a, 'tcx> ast_map::FoldOps for AstRenumberer<'a, 'tcx> {
390390
fn new_id(&self, id: ast::NodeId) -> ast::NodeId {
391391
if id == ast::DUMMY_NODE_ID {
392392
// Used by ast_map to map the NodeInlinedParent.
@@ -914,12 +914,12 @@ fn encode_vec_per_param_space<T>(rbml_w: &mut Encoder,
914914
// ______________________________________________________________________
915915
// Encoding and decoding the side tables
916916

917-
trait get_ty_str_ctxt {
918-
fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a>;
917+
trait get_ty_str_ctxt<'tcx> {
918+
fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a, 'tcx>;
919919
}
920920

921-
impl<'a> get_ty_str_ctxt for e::EncodeContext<'a> {
922-
fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a> {
921+
impl<'a, 'tcx> get_ty_str_ctxt<'tcx> for e::EncodeContext<'a, 'tcx> {
922+
fn ty_str_ctxt<'a>(&'a self) -> tyencode::ctxt<'a, 'tcx> {
923923
tyencode::ctxt {
924924
diag: self.tcx.sess.diagnostic(),
925925
ds: e::def_to_string,

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ fn owned_ptr_base_path_rc(loan_path: &Rc<LoanPath>) -> Rc<LoanPath> {
7979
}
8080
}
8181

82-
struct CheckLoanCtxt<'a> {
83-
bccx: &'a BorrowckCtxt<'a>,
84-
dfcx_loans: &'a LoanDataFlow<'a>,
85-
move_data: move_data::FlowedMoveData<'a>,
82+
struct CheckLoanCtxt<'a, 'tcx: 'a> {
83+
bccx: &'a BorrowckCtxt<'a, 'tcx>,
84+
dfcx_loans: &'a LoanDataFlow<'a, 'tcx>,
85+
move_data: move_data::FlowedMoveData<'a, 'tcx>,
8686
all_loans: &'a [Loan],
8787
}
8888

89-
impl<'a> euv::Delegate for CheckLoanCtxt<'a> {
89+
impl<'a, 'tcx> euv::Delegate for CheckLoanCtxt<'a, 'tcx> {
9090
fn consume(&mut self,
9191
consume_id: ast::NodeId,
9292
consume_span: Span,
@@ -179,12 +179,12 @@ impl<'a> euv::Delegate for CheckLoanCtxt<'a> {
179179
fn decl_without_init(&mut self, _id: ast::NodeId, _span: Span) { }
180180
}
181181

182-
pub fn check_loans(bccx: &BorrowckCtxt,
183-
dfcx_loans: &LoanDataFlow,
184-
move_data: move_data::FlowedMoveData,
185-
all_loans: &[Loan],
186-
decl: &ast::FnDecl,
187-
body: &ast::Block) {
182+
pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
183+
dfcx_loans: &LoanDataFlow<'b, 'tcx>,
184+
move_data: move_data::FlowedMoveData<'c, 'tcx>,
185+
all_loans: &[Loan],
186+
decl: &ast::FnDecl,
187+
body: &ast::Block) {
188188
debug!("check_loans(body id={:?})", body.id);
189189

190190
let mut clcx = CheckLoanCtxt {
@@ -212,8 +212,8 @@ fn compatible_borrow_kinds(borrow_kind1: ty::BorrowKind,
212212
borrow_kind1 == ty::ImmBorrow && borrow_kind2 == ty::ImmBorrow
213213
}
214214

215-
impl<'a> CheckLoanCtxt<'a> {
216-
pub fn tcx(&self) -> &'a ty::ctxt { self.bccx.tcx }
215+
impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
216+
pub fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.bccx.tcx }
217217

218218
pub fn each_issued_loan(&self, scope_id: ast::NodeId, op: |&Loan| -> bool)
219219
-> bool {

src/librustc/middle/borrowck/gather_loans/lifetime.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ pub fn guarantee_lifetime(bccx: &BorrowckCtxt,
4545
///////////////////////////////////////////////////////////////////////////
4646
// Private
4747

48-
struct GuaranteeLifetimeContext<'a> {
49-
bccx: &'a BorrowckCtxt<'a>,
48+
struct GuaranteeLifetimeContext<'a, 'tcx: 'a> {
49+
bccx: &'a BorrowckCtxt<'a, 'tcx>,
5050

5151
// the node id of the function body for the enclosing item
5252
item_scope_id: ast::NodeId,
@@ -57,7 +57,7 @@ struct GuaranteeLifetimeContext<'a> {
5757
cmt_original: mc::cmt
5858
}
5959

60-
impl<'a> GuaranteeLifetimeContext<'a> {
60+
impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
6161

6262
fn check(&self, cmt: &mc::cmt, discr_scope: Option<ast::NodeId>) -> R {
6363
//! Main routine. Walks down `cmt` until we find the "guarantor".

src/librustc/middle/borrowck/gather_loans/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ pub fn gather_loans_in_fn(bccx: &BorrowckCtxt,
5757
(all_loans, move_data)
5858
}
5959

60-
struct GatherLoanCtxt<'a> {
61-
bccx: &'a BorrowckCtxt<'a>,
60+
struct GatherLoanCtxt<'a, 'tcx: 'a> {
61+
bccx: &'a BorrowckCtxt<'a, 'tcx>,
6262
move_data: move_data::MoveData,
6363
move_error_collector: move_error::MoveErrorCollector,
6464
all_loans: Vec<Loan>,
6565
item_ub: ast::NodeId,
6666
}
6767

68-
impl<'a> euv::Delegate for GatherLoanCtxt<'a> {
68+
impl<'a, 'tcx> euv::Delegate for GatherLoanCtxt<'a, 'tcx> {
6969
fn consume(&mut self,
7070
consume_id: ast::NodeId,
7171
_consume_span: Span,
@@ -204,8 +204,8 @@ fn check_aliasability(bccx: &BorrowckCtxt,
204204
}
205205
}
206206

207-
impl<'a> GatherLoanCtxt<'a> {
208-
pub fn tcx(&self) -> &'a ty::ctxt { self.bccx.tcx }
207+
impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> {
208+
pub fn tcx(&self) -> &'a ty::ctxt<'tcx> { self.bccx.tcx }
209209

210210
fn guarantee_valid(&mut self,
211211
borrow_id: ast::NodeId,
@@ -467,11 +467,11 @@ impl<'a> GatherLoanCtxt<'a> {
467467
///
468468
/// This visitor walks static initializer's expressions and makes
469469
/// sure the loans being taken are sound.
470-
struct StaticInitializerCtxt<'a> {
471-
bccx: &'a BorrowckCtxt<'a>
470+
struct StaticInitializerCtxt<'a, 'tcx: 'a> {
471+
bccx: &'a BorrowckCtxt<'a, 'tcx>
472472
}
473473

474-
impl<'a> visit::Visitor<()> for StaticInitializerCtxt<'a> {
474+
impl<'a, 'tcx> visit::Visitor<()> for StaticInitializerCtxt<'a, 'tcx> {
475475
fn visit_expr(&mut self, ex: &Expr, _: ()) {
476476
match ex.node {
477477
ast::ExprAddrOf(mutbl, ref base) => {

src/librustc/middle/borrowck/gather_loans/restrictions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,14 @@ pub fn compute_restrictions(bccx: &BorrowckCtxt,
4444
///////////////////////////////////////////////////////////////////////////
4545
// Private
4646

47-
struct RestrictionsContext<'a> {
48-
bccx: &'a BorrowckCtxt<'a>,
47+
struct RestrictionsContext<'a, 'tcx: 'a> {
48+
bccx: &'a BorrowckCtxt<'a, 'tcx>,
4949
span: Span,
5050
loan_region: ty::Region,
5151
cause: euv::LoanCause,
5252
}
5353

54-
impl<'a> RestrictionsContext<'a> {
54+
impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
5555
fn restrict(&self,
5656
cmt: mc::cmt) -> RestrictionResult {
5757
debug!("restrict(cmt={})", cmt.repr(self.bccx.tcx));

0 commit comments

Comments
 (0)