Skip to content

Commit ca52c7d

Browse files
---
yaml --- r: 276443 b: refs/heads/master c: 60259b9 h: refs/heads/master i: 276441: 7cb4985 276439: 71886a6
1 parent df4b278 commit ca52c7d

File tree

3 files changed

+66
-66
lines changed

3 files changed

+66
-66
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: b2ea54d2c6277f90312ae6a5de5f9165def99ffe
2+
refs/heads/master: 60259b9d90d977659c19644260f729adc3e43d75
33
refs/heads/snap-stage3: 235d77457d80b549dad3ac36d94f235208a1eafb
44
refs/heads/try: 49312a405e14a449b98fe0056b12a40ac128be4a
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

trunk/src/librustc_trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2964,7 +2964,7 @@ fn collect_translation_items<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>) {
29642964
let mut item_keys: Vec<_> = items
29652965
.iter()
29662966
.map(|i| {
2967-
let mut output = i.to_string(ccx);
2967+
let mut output = i.to_string(ccx.tcx());
29682968
output.push_str(" @@");
29692969
let mut empty = Vec::new();
29702970
let mut cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);

trunk/src/librustc_trans/collector.rs

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(ccx: &CrateContext<'a, 'tcx>,
378378
// We've been here already, no need to search again.
379379
return;
380380
}
381-
debug!("BEGIN collect_items_rec({})", starting_point.to_string(ccx));
381+
debug!("BEGIN collect_items_rec({})", starting_point.to_string(ccx.tcx()));
382382

383383
let mut neighbors = Vec::new();
384384
let recursion_depth_reset;
@@ -430,7 +430,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(ccx: &CrateContext<'a, 'tcx>,
430430
recursion_depths.insert(def_id, depth);
431431
}
432432

433-
debug!("END collect_items_rec({})", starting_point.to_string(ccx));
433+
debug!("END collect_items_rec({})", starting_point.to_string(ccx.tcx()));
434434
}
435435

436436
fn record_references<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
@@ -657,7 +657,7 @@ fn find_drop_glue_neighbors<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
657657
}
658658
};
659659

660-
debug!("find_drop_glue_neighbors: {}", type_to_string(ccx, ty));
660+
debug!("find_drop_glue_neighbors: {}", type_to_string(ccx.tcx(), ty));
661661

662662
// Make sure the exchange_free_fn() lang-item gets translated if
663663
// there is a boxed value.
@@ -786,7 +786,7 @@ fn do_static_dispatch<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
786786
param_substs: &'tcx Substs<'tcx>)
787787
-> Option<(DefId, &'tcx Substs<'tcx>)> {
788788
debug!("do_static_dispatch(fn_def_id={}, fn_substs={:?}, param_substs={:?})",
789-
def_id_to_string(ccx, fn_def_id),
789+
def_id_to_string(ccx.tcx(), fn_def_id),
790790
fn_substs,
791791
param_substs);
792792

@@ -834,8 +834,8 @@ fn do_static_trait_method_dispatch<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
834834
trait_id={}, \
835835
callee_substs={:?}, \
836836
param_substs={:?}",
837-
def_id_to_string(ccx, trait_method.def_id),
838-
def_id_to_string(ccx, trait_id),
837+
def_id_to_string(ccx.tcx(), trait_method.def_id),
838+
def_id_to_string(ccx.tcx(), trait_id),
839839
callee_substs,
840840
param_substs);
841841

@@ -968,7 +968,7 @@ fn create_fn_trans_item<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
968968
-> TransItem<'tcx>
969969
{
970970
debug!("create_fn_trans_item(def_id={}, fn_substs={:?}, param_substs={:?})",
971-
def_id_to_string(ccx, def_id),
971+
def_id_to_string(ccx.tcx(), def_id),
972972
fn_substs,
973973
param_substs);
974974

@@ -1079,7 +1079,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
10791079

10801080
if self.mode == TransItemCollectionMode::Eager {
10811081
debug!("RootCollector: ADT drop-glue for {}",
1082-
def_id_to_string(self.ccx,
1082+
def_id_to_string(self.ccx.tcx(),
10831083
self.ccx.tcx().map.local_def_id(item.id)));
10841084

10851085
let ty = glue::get_drop_glue_type(self.ccx, ty);
@@ -1089,7 +1089,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
10891089
}
10901090
hir::ItemStatic(..) => {
10911091
debug!("RootCollector: ItemStatic({})",
1092-
def_id_to_string(self.ccx,
1092+
def_id_to_string(self.ccx.tcx(),
10931093
self.ccx.tcx().map.local_def_id(item.id)));
10941094
self.output.push(TransItem::Static(item.id));
10951095
}
@@ -1099,7 +1099,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
10991099
let def_id = self.ccx.tcx().map.local_def_id(item.id);
11001100

11011101
debug!("RootCollector: ItemFn({})",
1102-
def_id_to_string(self.ccx, def_id));
1102+
def_id_to_string(self.ccx.tcx(), def_id));
11031103

11041104
let instance = Instance::mono(self.ccx.tcx(), def_id);
11051105
self.output.push(TransItem::Fn(instance));
@@ -1136,7 +1136,7 @@ impl<'b, 'a, 'v> hir_visit::Visitor<'v> for RootCollector<'b, 'a, 'v> {
11361136
let def_id = self.ccx.tcx().map.local_def_id(ii.id);
11371137

11381138
debug!("RootCollector: MethodImplItem({})",
1139-
def_id_to_string(self.ccx, def_id));
1139+
def_id_to_string(self.ccx.tcx(), def_id));
11401140

11411141
let instance = Instance::mono(self.ccx.tcx(), def_id);
11421142
self.output.push(TransItem::Fn(instance));
@@ -1167,7 +1167,7 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
11671167
let impl_def_id = tcx.map.local_def_id(item.id);
11681168

11691169
debug!("create_trans_items_for_default_impls(item={})",
1170-
def_id_to_string(ccx, impl_def_id));
1170+
def_id_to_string(ccx.tcx(), impl_def_id));
11711171

11721172
if let Some(trait_ref) = tcx.impl_trait_ref(impl_def_id) {
11731173
let default_impls = tcx.provided_trait_methods(trait_ref.def_id);
@@ -1229,9 +1229,9 @@ fn create_trans_items_for_default_impls<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
12291229

12301230
/// Same as `unique_type_name()` but with the result pushed onto the given
12311231
/// `output` parameter.
1232-
pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
1233-
t: ty::Ty<'tcx>,
1234-
output: &mut String) {
1232+
pub fn push_unique_type_name<'tcx>(tcx: &TyCtxt<'tcx>,
1233+
t: ty::Ty<'tcx>,
1234+
output: &mut String) {
12351235
match t.sty {
12361236
ty::TyBool => output.push_str("bool"),
12371237
ty::TyChar => output.push_str("char"),
@@ -1250,13 +1250,13 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
12501250
ty::TyFloat(ast::FloatTy::F64) => output.push_str("f64"),
12511251
ty::TyStruct(adt_def, substs) |
12521252
ty::TyEnum(adt_def, substs) => {
1253-
push_item_name(cx, adt_def.did, output);
1254-
push_type_params(cx, &substs.types, &[], output);
1253+
push_item_name(tcx, adt_def.did, output);
1254+
push_type_params(tcx, &substs.types, &[], output);
12551255
},
12561256
ty::TyTuple(ref component_types) => {
12571257
output.push('(');
12581258
for &component_type in component_types {
1259-
push_unique_type_name(cx, component_type, output);
1259+
push_unique_type_name(tcx, component_type, output);
12601260
output.push_str(", ");
12611261
}
12621262
if !component_types.is_empty() {
@@ -1267,7 +1267,7 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
12671267
},
12681268
ty::TyBox(inner_type) => {
12691269
output.push_str("Box<");
1270-
push_unique_type_name(cx, inner_type, output);
1270+
push_unique_type_name(tcx, inner_type, output);
12711271
output.push('>');
12721272
},
12731273
ty::TyRawPtr(ty::TypeAndMut { ty: inner_type, mutbl } ) => {
@@ -1277,30 +1277,30 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
12771277
hir::MutMutable => output.push_str("mut "),
12781278
}
12791279

1280-
push_unique_type_name(cx, inner_type, output);
1280+
push_unique_type_name(tcx, inner_type, output);
12811281
},
12821282
ty::TyRef(_, ty::TypeAndMut { ty: inner_type, mutbl }) => {
12831283
output.push('&');
12841284
if mutbl == hir::MutMutable {
12851285
output.push_str("mut ");
12861286
}
12871287

1288-
push_unique_type_name(cx, inner_type, output);
1288+
push_unique_type_name(tcx, inner_type, output);
12891289
},
12901290
ty::TyArray(inner_type, len) => {
12911291
output.push('[');
1292-
push_unique_type_name(cx, inner_type, output);
1292+
push_unique_type_name(tcx, inner_type, output);
12931293
output.push_str(&format!("; {}", len));
12941294
output.push(']');
12951295
},
12961296
ty::TySlice(inner_type) => {
12971297
output.push('[');
1298-
push_unique_type_name(cx, inner_type, output);
1298+
push_unique_type_name(tcx, inner_type, output);
12991299
output.push(']');
13001300
},
13011301
ty::TyTrait(ref trait_data) => {
1302-
push_item_name(cx, trait_data.principal.skip_binder().def_id, output);
1303-
push_type_params(cx,
1302+
push_item_name(tcx, trait_data.principal.skip_binder().def_id, output);
1303+
push_type_params(tcx,
13041304
&trait_data.principal.skip_binder().substs.types,
13051305
&trait_data.bounds.projection_bounds,
13061306
output);
@@ -1319,10 +1319,10 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
13191319

13201320
output.push_str("fn(");
13211321

1322-
let sig = cx.tcx().erase_late_bound_regions(sig);
1322+
let sig = tcx.erase_late_bound_regions(sig);
13231323
if !sig.inputs.is_empty() {
13241324
for &parameter_type in &sig.inputs {
1325-
push_unique_type_name(cx, parameter_type, output);
1325+
push_unique_type_name(tcx, parameter_type, output);
13261326
output.push_str(", ");
13271327
}
13281328
output.pop();
@@ -1343,19 +1343,19 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
13431343
ty::FnConverging(result_type) if result_type.is_nil() => {}
13441344
ty::FnConverging(result_type) => {
13451345
output.push_str(" -> ");
1346-
push_unique_type_name(cx, result_type, output);
1346+
push_unique_type_name(tcx, result_type, output);
13471347
}
13481348
ty::FnDiverging => {
13491349
output.push_str(" -> !");
13501350
}
13511351
}
13521352
},
13531353
ty::TyClosure(def_id, ref closure_substs) => {
1354-
push_item_name(cx, def_id, output);
1354+
push_item_name(tcx, def_id, output);
13551355
output.push_str("{");
13561356
output.push_str(&format!("{}:{}", def_id.krate, def_id.index.as_usize()));
13571357
output.push_str("}");
1358-
push_type_params(cx, &closure_substs.func_substs.types, &[], output);
1358+
push_type_params(tcx, &closure_substs.func_substs.types, &[], output);
13591359
}
13601360
ty::TyError |
13611361
ty::TyInfer(_) |
@@ -1367,17 +1367,17 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
13671367
}
13681368
}
13691369

1370-
fn push_item_name(ccx: &CrateContext,
1370+
fn push_item_name(tcx: &TyCtxt,
13711371
def_id: DefId,
13721372
output: &mut String) {
1373-
let def_path = ccx.tcx().def_path(def_id);
1373+
let def_path = tcx.def_path(def_id);
13741374

13751375
// some_crate::
1376-
output.push_str(&ccx.tcx().crate_name(def_path.krate));
1376+
output.push_str(&tcx.crate_name(def_path.krate));
13771377
output.push_str("::");
13781378

13791379
// foo::bar::ItemName::
1380-
for part in ccx.tcx().def_path(def_id).data {
1380+
for part in tcx.def_path(def_id).data {
13811381
output.push_str(&format!("{}[{}]::",
13821382
part.data.as_interned_str(),
13831383
part.disambiguator));
@@ -1388,18 +1388,18 @@ fn push_item_name(ccx: &CrateContext,
13881388
output.pop();
13891389
}
13901390

1391-
fn push_type_params<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
1392-
types: &'tcx subst::VecPerParamSpace<Ty<'tcx>>,
1393-
projections: &[ty::PolyProjectionPredicate<'tcx>],
1394-
output: &mut String) {
1391+
fn push_type_params<'tcx>(tcx: &TyCtxt<'tcx>,
1392+
types: &'tcx subst::VecPerParamSpace<Ty<'tcx>>,
1393+
projections: &[ty::PolyProjectionPredicate<'tcx>],
1394+
output: &mut String) {
13951395
if types.is_empty() && projections.is_empty() {
13961396
return;
13971397
}
13981398

13991399
output.push('<');
14001400

14011401
for &type_parameter in types {
1402-
push_unique_type_name(cx, type_parameter, output);
1402+
push_unique_type_name(tcx, type_parameter, output);
14031403
output.push_str(", ");
14041404
}
14051405

@@ -1408,7 +1408,7 @@ fn push_type_params<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
14081408
let name = token::get_ident_interner().get(projection.projection_ty.item_name);
14091409
output.push_str(&name[..]);
14101410
output.push_str("=");
1411-
push_unique_type_name(cx, projection.ty, output);
1411+
push_unique_type_name(tcx, projection.ty, output);
14121412
output.push_str(", ");
14131413
}
14141414

@@ -1418,24 +1418,24 @@ fn push_type_params<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
14181418
output.push('>');
14191419
}
14201420

1421-
fn push_instance_as_string<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1422-
instance: Instance<'tcx>,
1423-
output: &mut String) {
1424-
push_item_name(ccx, instance.def, output);
1425-
push_type_params(ccx, &instance.substs.types, &[], output);
1421+
fn push_instance_as_string<'tcx>(tcx: &TyCtxt<'tcx>,
1422+
instance: Instance<'tcx>,
1423+
output: &mut String) {
1424+
push_item_name(tcx, instance.def, output);
1425+
push_type_params(tcx, &instance.substs.types, &[], output);
14261426
}
14271427

1428-
pub fn def_id_to_string(ccx: &CrateContext, def_id: DefId) -> String {
1428+
pub fn def_id_to_string(tcx: &TyCtxt, def_id: DefId) -> String {
14291429
let mut output = String::new();
1430-
push_item_name(ccx, def_id, &mut output);
1430+
push_item_name(tcx, def_id, &mut output);
14311431
output
14321432
}
14331433

1434-
fn type_to_string<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1435-
ty: ty::Ty<'tcx>)
1436-
-> String {
1434+
fn type_to_string<'tcx>(tcx: &TyCtxt<'tcx>,
1435+
ty: ty::Ty<'tcx>)
1436+
-> String {
14371437
let mut output = String::new();
1438-
push_unique_type_name(ccx, ty, &mut output);
1438+
push_unique_type_name(tcx, ty, &mut output);
14391439
output
14401440
}
14411441

@@ -1492,8 +1492,8 @@ impl<'tcx> TransItem<'tcx> {
14921492
}
14931493
}
14941494

1495-
pub fn to_string<'a>(&self, ccx: &CrateContext<'a, 'tcx>) -> String {
1496-
let hir_map = &ccx.tcx().map;
1495+
pub fn to_string(&self, tcx: &TyCtxt<'tcx>) -> String {
1496+
let hir_map = &tcx.map;
14971497

14981498
return match *self {
14991499
TransItem::DropGlue(dg) => {
@@ -1502,26 +1502,26 @@ impl<'tcx> TransItem<'tcx> {
15021502
DropGlueKind::Ty(_) => s.push_str("drop-glue "),
15031503
DropGlueKind::TyContents(_) => s.push_str("drop-glue-contents "),
15041504
};
1505-
push_unique_type_name(ccx, dg.ty(), &mut s);
1505+
push_unique_type_name(tcx, dg.ty(), &mut s);
15061506
s
15071507
}
15081508
TransItem::Fn(instance) => {
1509-
to_string_internal(ccx, "fn ", instance)
1509+
to_string_internal(tcx, "fn ", instance)
15101510
},
15111511
TransItem::Static(node_id) => {
15121512
let def_id = hir_map.local_def_id(node_id);
1513-
let instance = Instance::mono(ccx.tcx(), def_id);
1514-
to_string_internal(ccx, "static ", instance)
1513+
let instance = Instance::mono(tcx, def_id);
1514+
to_string_internal(tcx, "static ", instance)
15151515
},
15161516
};
15171517

1518-
fn to_string_internal<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
1519-
prefix: &str,
1520-
instance: Instance<'tcx>)
1521-
-> String {
1518+
fn to_string_internal<'tcx>(tcx: &TyCtxt<'tcx>,
1519+
prefix: &str,
1520+
instance: Instance<'tcx>)
1521+
-> String {
15221522
let mut result = String::with_capacity(32);
15231523
result.push_str(prefix);
1524-
push_instance_as_string(ccx, instance, &mut result);
1524+
push_instance_as_string(tcx, instance, &mut result);
15251525
result
15261526
}
15271527
}
@@ -1575,7 +1575,7 @@ pub fn print_collection_results<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>) {
15751575
let mut item_keys = FnvHashMap();
15761576

15771577
for (item, item_state) in trans_items.iter() {
1578-
let k = item.to_string(&ccx);
1578+
let k = item.to_string(ccx.tcx());
15791579

15801580
if item_keys.contains_key(&k) {
15811581
let prev: (TransItem, TransItemState) = item_keys[&k];
@@ -1603,7 +1603,7 @@ pub fn print_collection_results<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>) {
16031603
let mut generated = FnvHashSet();
16041604

16051605
for (item, item_state) in trans_items.iter() {
1606-
let item_key = item.to_string(&ccx);
1606+
let item_key = item.to_string(ccx.tcx());
16071607

16081608
match *item_state {
16091609
TransItemState::PredictedAndGenerated => {

0 commit comments

Comments
 (0)