Skip to content

Commit dd46c6d

Browse files
Remove stray uses of gcx name
1 parent e992ede commit dd46c6d

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

src/librustc/traits/query/type_op/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Sized + TypeFoldable<'tcx> + 'tcx {
6666
canonicalized: Canonicalized<'tcx, ParamEnvAnd<'tcx, Self>>,
6767
) -> Fallible<CanonicalizedQueryResponse<'tcx, Self::QueryResponse>>;
6868

69-
/// Casts a lifted query result (which is in the gcx lifetime)
69+
/// Casts a lifted query result (which is in the tcx lifetime)
7070
/// into the tcx lifetime. This is always just an identity cast,
7171
/// but the generic code doesn't realize it -- put another way, in
7272
/// the generic code, we have a `Lifted<'tcx, Self::QueryResponse>`

src/librustc_typeck/check/wfcheck.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,8 @@ fn check_item_type(
366366
) {
367367
debug!("check_item_type: {:?}", item_id);
368368

369-
for_id(tcx, item_id, ty_span).with_fcx(|fcx, gcx| {
370-
let ty = gcx.type_of(gcx.hir().local_def_id(item_id));
369+
for_id(tcx, item_id, ty_span).with_fcx(|fcx, tcx| {
370+
let ty = tcx.type_of(tcx.hir().local_def_id(item_id));
371371
let item_ty = fcx.normalize_associated_types_in(ty_span, &ty);
372372

373373
let mut forbid_unsized = true;

src/librustc_typeck/coherence/builtin.rs

+24-24
Original file line numberDiff line numberDiff line change
@@ -322,29 +322,29 @@ fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: DefId) {
322322
}
323323
}
324324

325-
pub fn coerce_unsized_info<'tcx>(gcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUnsizedInfo {
325+
pub fn coerce_unsized_info<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUnsizedInfo {
326326
debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did);
327-
let coerce_unsized_trait = gcx.lang_items().coerce_unsized_trait().unwrap();
327+
let coerce_unsized_trait = tcx.lang_items().coerce_unsized_trait().unwrap();
328328

329-
let unsize_trait = gcx.lang_items().require(UnsizeTraitLangItem).unwrap_or_else(|err| {
330-
gcx.sess.fatal(&format!("`CoerceUnsized` implementation {}", err));
329+
let unsize_trait = tcx.lang_items().require(UnsizeTraitLangItem).unwrap_or_else(|err| {
330+
tcx.sess.fatal(&format!("`CoerceUnsized` implementation {}", err));
331331
});
332332

333333
// this provider should only get invoked for local def-ids
334-
let impl_hir_id = gcx.hir().as_local_hir_id(impl_did).unwrap_or_else(|| {
334+
let impl_hir_id = tcx.hir().as_local_hir_id(impl_did).unwrap_or_else(|| {
335335
bug!("coerce_unsized_info: invoked for non-local def-id {:?}", impl_did)
336336
});
337337

338-
let source = gcx.type_of(impl_did);
339-
let trait_ref = gcx.impl_trait_ref(impl_did).unwrap();
338+
let source = tcx.type_of(impl_did);
339+
let trait_ref = tcx.impl_trait_ref(impl_did).unwrap();
340340
assert_eq!(trait_ref.def_id, coerce_unsized_trait);
341341
let target = trait_ref.substs.type_at(1);
342342
debug!("visit_implementation_of_coerce_unsized: {:?} -> {:?} (bound)",
343343
source,
344344
target);
345345

346-
let span = gcx.hir().span(impl_hir_id);
347-
let param_env = gcx.param_env(impl_did);
346+
let span = tcx.hir().span(impl_hir_id);
347+
let param_env = tcx.param_env(impl_did);
348348
assert!(!source.has_escaping_bound_vars());
349349

350350
let err_info = CoerceUnsizedInfo { custom_kind: None };
@@ -353,7 +353,7 @@ pub fn coerce_unsized_info<'tcx>(gcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
353353
source,
354354
target);
355355

356-
gcx.infer_ctxt().enter(|infcx| {
356+
tcx.infer_ctxt().enter(|infcx| {
357357
let cause = ObligationCause::misc(span, impl_hir_id);
358358
let check_mutbl = |mt_a: ty::TypeAndMut<'tcx>,
359359
mt_b: ty::TypeAndMut<'tcx>,
@@ -372,24 +372,24 @@ pub fn coerce_unsized_info<'tcx>(gcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
372372
infcx.sub_regions(infer::RelateObjectBound(span), r_b, r_a);
373373
let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a };
374374
let mt_b = ty::TypeAndMut { ty: ty_b, mutbl: mutbl_b };
375-
check_mutbl(mt_a, mt_b, &|ty| gcx.mk_imm_ref(r_b, ty))
375+
check_mutbl(mt_a, mt_b, &|ty| tcx.mk_imm_ref(r_b, ty))
376376
}
377377

378378
(&ty::Ref(_, ty_a, mutbl_a), &ty::RawPtr(mt_b)) => {
379379
let mt_a = ty::TypeAndMut { ty: ty_a, mutbl: mutbl_a };
380-
check_mutbl(mt_a, mt_b, &|ty| gcx.mk_imm_ptr(ty))
380+
check_mutbl(mt_a, mt_b, &|ty| tcx.mk_imm_ptr(ty))
381381
}
382382

383383
(&ty::RawPtr(mt_a), &ty::RawPtr(mt_b)) => {
384-
check_mutbl(mt_a, mt_b, &|ty| gcx.mk_imm_ptr(ty))
384+
check_mutbl(mt_a, mt_b, &|ty| tcx.mk_imm_ptr(ty))
385385
}
386386

387387
(&ty::Adt(def_a, substs_a), &ty::Adt(def_b, substs_b)) if def_a.is_struct() &&
388388
def_b.is_struct() => {
389389
if def_a != def_b {
390-
let source_path = gcx.def_path_str(def_a.did);
391-
let target_path = gcx.def_path_str(def_b.did);
392-
span_err!(gcx.sess,
390+
let source_path = tcx.def_path_str(def_a.did);
391+
let target_path = tcx.def_path_str(def_b.did);
392+
span_err!(tcx.sess,
393393
span,
394394
E0377,
395395
"the trait `CoerceUnsized` may only be implemented \
@@ -443,9 +443,9 @@ pub fn coerce_unsized_info<'tcx>(gcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
443443
let diff_fields = fields.iter()
444444
.enumerate()
445445
.filter_map(|(i, f)| {
446-
let (a, b) = (f.ty(gcx, substs_a), f.ty(gcx, substs_b));
446+
let (a, b) = (f.ty(tcx, substs_a), f.ty(tcx, substs_b));
447447

448-
if gcx.type_of(f.did).is_phantom_data() {
448+
if tcx.type_of(f.did).is_phantom_data() {
449449
// Ignore PhantomData fields
450450
return None;
451451
}
@@ -472,22 +472,22 @@ pub fn coerce_unsized_info<'tcx>(gcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
472472
.collect::<Vec<_>>();
473473

474474
if diff_fields.is_empty() {
475-
span_err!(gcx.sess,
475+
span_err!(tcx.sess,
476476
span,
477477
E0374,
478478
"the trait `CoerceUnsized` may only be implemented \
479479
for a coercion between structures with one field \
480480
being coerced, none found");
481481
return err_info;
482482
} else if diff_fields.len() > 1 {
483-
let item = gcx.hir().expect_item(impl_hir_id);
483+
let item = tcx.hir().expect_item(impl_hir_id);
484484
let span = if let ItemKind::Impl(.., Some(ref t), _, _) = item.node {
485485
t.path.span
486486
} else {
487-
gcx.hir().span(impl_hir_id)
487+
tcx.hir().span(impl_hir_id)
488488
};
489489

490-
let mut err = struct_span_err!(gcx.sess,
490+
let mut err = struct_span_err!(tcx.sess,
491491
span,
492492
E0375,
493493
"implementing the trait \
@@ -514,7 +514,7 @@ pub fn coerce_unsized_info<'tcx>(gcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
514514
}
515515

516516
_ => {
517-
span_err!(gcx.sess,
517+
span_err!(tcx.sess,
518518
span,
519519
E0376,
520520
"the trait `CoerceUnsized` may only be implemented \
@@ -527,7 +527,7 @@ pub fn coerce_unsized_info<'tcx>(gcx: TyCtxt<'tcx>, impl_did: DefId) -> CoerceUn
527527

528528
// Register an obligation for `A: Trait<B>`.
529529
let cause = traits::ObligationCause::misc(span, impl_hir_id);
530-
let predicate = gcx.predicate_for_trait_def(param_env,
530+
let predicate = tcx.predicate_for_trait_def(param_env,
531531
cause,
532532
trait_def_id,
533533
0,

0 commit comments

Comments
 (0)