Skip to content

Commit d540d44

Browse files
Remove global_tcx from TyCtxt
The non-global context was removed; there's only one context now. This is a noop method that only serves to confuse readers -- remove it.
1 parent a37fe2d commit d540d44

File tree

31 files changed

+59
-77
lines changed

31 files changed

+59
-77
lines changed

src/librustc/dep_graph/graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ impl DepGraph {
590590
// mark it as green by recursively marking all of its
591591
// dependencies green.
592592
self.try_mark_previous_green(
593-
tcx.global_tcx(),
593+
tcx,
594594
data,
595595
prev_index,
596596
&dep_node

src/librustc/infer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1460,7 +1460,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
14601460
// type-checking closure types are in local tables only.
14611461
if !self.in_progress_tables.is_some() || !ty.has_closure_types() {
14621462
if !(param_env, ty).has_local_value() {
1463-
return ty.is_copy_modulo_regions(self.tcx.global_tcx(), param_env, span);
1463+
return ty.is_copy_modulo_regions(self.tcx, param_env, span);
14641464
}
14651465
}
14661466

src/librustc/infer/opaque_types/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -561,15 +561,13 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
561561
def_id, instantiated_ty
562562
);
563563

564-
let gcx = self.tcx.global_tcx();
565-
566564
// Use substs to build up a reverse map from regions to their
567565
// identity mappings. This is necessary because of `impl
568566
// Trait` lifetimes are computed by replacing existing
569567
// lifetimes with 'static and remapping only those used in the
570568
// `impl Trait` return type, resulting in the parameters
571569
// shifting.
572-
let id_substs = InternalSubsts::identity_for_item(gcx, def_id);
570+
let id_substs = InternalSubsts::identity_for_item(self.tcx, def_id);
573571
let map: FxHashMap<GenericArg<'tcx>, GenericArg<'tcx>> = opaque_defn
574572
.substs
575573
.iter()
@@ -854,7 +852,7 @@ impl TypeFolder<'tcx> for ReverseMapper<'tcx> {
854852
)
855853
.emit();
856854

857-
self.tcx().global_tcx().mk_region(ty::ReStatic)
855+
self.tcx().mk_region(ty::ReStatic)
858856
},
859857
}
860858
}

src/librustc/middle/intrinsicck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl ExprVisitor<'tcx> {
8282

8383
// Special-case transmutting from `typeof(function)` and
8484
// `Option<typeof(function)>` to present a clearer error.
85-
let from = unpack_option_like(self.tcx.global_tcx(), from);
85+
let from = unpack_option_like(self.tcx, from);
8686
if let (&ty::FnDef(..), SizeSkeleton::Known(size_to)) = (&from.kind, sk_to) {
8787
if size_to == Pointer.size(&self.tcx) {
8888
struct_span_err!(self.tcx.sess, span, E0591,

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx> {
749749
.unwrap_or(ty::ClosureKind::LATTICE_BOTTOM),
750750

751751
None =>
752-
closure_substs.closure_kind(closure_def_id, self.tcx.global_tcx()),
752+
closure_substs.closure_kind(closure_def_id, self.tcx),
753753
}
754754
}
755755
_ => span_bug!(span, "unexpected type for fn in mem_categorization: {:?}", ty),

src/librustc/traits/chalk_fulfill.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
108108
goal: obligation.goal.predicate,
109109
}, &mut orig_values);
110110

111-
match infcx.tcx.global_tcx().evaluate_goal(canonical_goal) {
111+
match infcx.tcx.evaluate_goal(canonical_goal) {
112112
Ok(response) => {
113113
if response.is_proven() {
114114
making_progress = true;

src/librustc/traits/error_reporting.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
497497
4
498498
};
499499

500-
let normalize = |candidate| self.tcx.global_tcx().infer_ctxt().enter(|ref infcx| {
500+
let normalize = |candidate| self.tcx.infer_ctxt().enter(|ref infcx| {
501501
let normalized = infcx
502502
.at(&ObligationCause::dummy(), ty::ParamEnv::empty())
503503
.normalize(candidate)
@@ -783,8 +783,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
783783
}
784784

785785
ty::Predicate::ObjectSafe(trait_def_id) => {
786-
let violations = self.tcx.global_tcx()
787-
.object_safety_violations(trait_def_id);
786+
let violations = self.tcx.object_safety_violations(trait_def_id);
788787
if let Some(err) = self.tcx.report_object_safety_error(
789788
span,
790789
trait_def_id,
@@ -920,7 +919,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
920919
}
921920

922921
TraitNotObjectSafe(did) => {
923-
let violations = self.tcx.global_tcx().object_safety_violations(did);
922+
let violations = self.tcx.object_safety_violations(did);
924923
if let Some(err) = self.tcx.report_object_safety_error(span, did, violations) {
925924
err
926925
} else {

src/librustc/traits/fulfill.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
495495
} else {
496496
if !substs.has_local_value() {
497497
let instance = ty::Instance::resolve(
498-
self.selcx.tcx().global_tcx(),
498+
self.selcx.tcx(),
499499
obligation.param_env,
500500
def_id,
501501
substs,

src/librustc/traits/query/dropck_outlives.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,11 @@ impl<'cx, 'tcx> At<'cx, 'tcx> {
4040
};
4141
}
4242

43-
let gcx = tcx.global_tcx();
4443
let mut orig_values = OriginalQueryValues::default();
4544
let c_ty = self.infcx.canonicalize_query(&self.param_env.and(ty), &mut orig_values);
4645
let span = self.cause.span;
4746
debug!("c_ty = {:?}", c_ty);
48-
if let Ok(result) = &gcx.dropck_outlives(c_ty) {
47+
if let Ok(result) = &tcx.dropck_outlives(c_ty) {
4948
if result.is_proven() {
5049
if let Ok(InferOk { value, obligations }) =
5150
self.infcx.instantiate_query_response_and_region_obligations(

src/librustc/traits/query/evaluate_obligation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
5050
// Run canonical query. If overflow occurs, rerun from scratch but this time
5151
// in standard trait query mode so that overflow is handled appropriately
5252
// within `SelectionContext`.
53-
self.tcx.global_tcx().evaluate_obligation(c_pred)
53+
self.tcx.evaluate_obligation(c_pred)
5454
}
5555

5656
// Helper function that canonicalizes and runs the query. If an

0 commit comments

Comments
 (0)