Skip to content

Commit f3f9d6d

Browse files
committed
Unify all uses of 'gcx and 'tcx.
1 parent 0e4a56b commit f3f9d6d

File tree

341 files changed

+3109
-3327
lines changed

Some content is hidden

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

341 files changed

+3109
-3327
lines changed

Diff for: src/librustc/cfg/construct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::hir::{self, PatKind};
88
use crate::hir::def_id::DefId;
99

1010
struct CFGBuilder<'a, 'tcx: 'a> {
11-
tcx: TyCtxt<'tcx, 'tcx>,
11+
tcx: TyCtxt<'tcx>,
1212
owner_def_id: DefId,
1313
tables: &'a ty::TypeckTables<'tcx>,
1414
graph: CFGGraph,
@@ -30,7 +30,7 @@ struct LoopScope {
3030
break_index: CFGIndex, // where to go on a `break`
3131
}
3232

33-
pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG {
33+
pub fn construct<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
3434
let mut graph = graph::Graph::new();
3535
let entry = graph.add_node(CFGNodeData::Entry);
3636

Diff for: src/librustc/cfg/graphviz.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
1212
pub type Edge<'a> = &'a cfg::CFGEdge;
1313

1414
pub struct LabelledCFG<'a, 'tcx: 'a> {
15-
pub tcx: TyCtxt<'tcx, 'tcx>,
15+
pub tcx: TyCtxt<'tcx>,
1616
pub cfg: &'a cfg::CFG,
1717
pub name: String,
1818
/// `labelled_edges` controls whether we emit labels on the edges

Diff for: src/librustc/cfg/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
4949
pub type CFGEdge = graph::Edge<CFGEdgeData>;
5050

5151
impl CFG {
52-
pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG {
52+
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG {
5353
construct::construct(tcx, body)
5454
}
5555

Diff for: src/librustc/dep_graph/dep_node.rs

+29-29
Original file line numberDiff line numberDiff line change
@@ -204,10 +204,10 @@ macro_rules! define_dep_nodes {
204204
impl DepNode {
205205
#[allow(unreachable_code, non_snake_case)]
206206
#[inline(always)]
207-
pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>,
208-
dep: DepConstructor<'gcx>)
207+
pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx>,
208+
dep: DepConstructor<'tcx>)
209209
-> DepNode
210-
where 'gcx: 'a + 'tcx,
210+
where 'tcx: 'a,
211211
'tcx: 'a
212212
{
213213
match dep {
@@ -307,7 +307,7 @@ macro_rules! define_dep_nodes {
307307
/// refers to something from the previous compilation session that
308308
/// has been removed.
309309
#[inline]
310-
pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_>) -> Option<DefId> {
310+
pub fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId> {
311311
if self.kind.can_reconstruct_query_key() {
312312
let def_path_hash = DefPathHash(self.hash);
313313
tcx.def_path_hash_to_def_id.as_ref()?
@@ -400,7 +400,7 @@ impl DefPathHash {
400400

401401
impl DefId {
402402
#[inline(always)]
403-
pub fn to_dep_node(self, tcx: TyCtxt<'_, '_>, kind: DepKind) -> DepNode {
403+
pub fn to_dep_node(self, tcx: TyCtxt<'_>, kind: DepKind) -> DepNode {
404404
DepNode::from_def_path_hash(kind, tcx.def_path_hash(self))
405405
}
406406
}
@@ -442,50 +442,50 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
442442
]);
443443

444444
pub trait RecoverKey<'tcx>: Sized {
445-
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self>;
445+
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self>;
446446
}
447447

448448
impl RecoverKey<'tcx> for CrateNum {
449-
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
449+
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
450450
dep_node.extract_def_id(tcx).map(|id| id.krate)
451451
}
452452
}
453453

454454
impl RecoverKey<'tcx> for DefId {
455-
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
455+
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
456456
dep_node.extract_def_id(tcx)
457457
}
458458
}
459459

460460
impl RecoverKey<'tcx> for DefIndex {
461-
fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
461+
fn recover(tcx: TyCtxt<'tcx>, dep_node: &DepNode) -> Option<Self> {
462462
dep_node.extract_def_id(tcx).map(|id| id.index)
463463
}
464464
}
465465

466-
trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug {
466+
trait DepNodeParams<'tcx>: fmt::Debug {
467467
const CAN_RECONSTRUCT_QUERY_KEY: bool;
468468

469469
/// This method turns the parameters of a DepNodeConstructor into an opaque
470470
/// Fingerprint to be used in DepNode.
471471
/// Not all DepNodeParams support being turned into a Fingerprint (they
472472
/// don't need to if the corresponding DepNode is anonymous).
473-
fn to_fingerprint(&self, _: TyCtxt<'gcx, 'tcx>) -> Fingerprint {
473+
fn to_fingerprint(&self, _: TyCtxt<'tcx>) -> Fingerprint {
474474
panic!("Not implemented. Accidentally called on anonymous node?")
475475
}
476476

477-
fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String {
477+
fn to_debug_str(&self, _: TyCtxt<'tcx>) -> String {
478478
format!("{:?}", self)
479479
}
480480
}
481481

482-
impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
482+
impl<'tcx, T> DepNodeParams<'tcx> for T
483483
where
484484
T: HashStable<StableHashingContext<'tcx>> + fmt::Debug,
485485
{
486486
default const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
487487

488-
default fn to_fingerprint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Fingerprint {
488+
default fn to_fingerprint(&self, tcx: TyCtxt<'tcx>) -> Fingerprint {
489489
let mut hcx = tcx.create_stable_hashing_context();
490490
let mut hasher = StableHasher::new();
491491

@@ -494,58 +494,58 @@ where
494494
hasher.finish()
495495
}
496496

497-
default fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String {
497+
default fn to_debug_str(&self, _: TyCtxt<'tcx>) -> String {
498498
format!("{:?}", *self)
499499
}
500500
}
501501

502-
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId {
502+
impl<'tcx> DepNodeParams<'tcx> for DefId {
503503
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
504504

505-
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
505+
fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint {
506506
tcx.def_path_hash(*self).0
507507
}
508508

509-
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
509+
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
510510
tcx.def_path_str(*self)
511511
}
512512
}
513513

514-
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex {
514+
impl<'tcx> DepNodeParams<'tcx> for DefIndex {
515515
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
516516

517-
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
517+
fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint {
518518
tcx.hir().definitions().def_path_hash(*self).0
519519
}
520520

521-
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
521+
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
522522
tcx.def_path_str(DefId::local(*self))
523523
}
524524
}
525525

526-
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum {
526+
impl<'tcx> DepNodeParams<'tcx> for CrateNum {
527527
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;
528528

529-
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
529+
fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint {
530530
let def_id = DefId {
531531
krate: *self,
532532
index: CRATE_DEF_INDEX,
533533
};
534534
tcx.def_path_hash(def_id).0
535535
}
536536

537-
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
537+
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
538538
tcx.crate_name(*self).as_str().to_string()
539539
}
540540
}
541541

542-
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) {
542+
impl<'tcx> DepNodeParams<'tcx> for (DefId, DefId) {
543543
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
544544

545545
// We actually would not need to specialize the implementation of this
546546
// method but it's faster to combine the hashes than to instantiate a full
547547
// hashing context and stable-hashing state.
548-
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
548+
fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint {
549549
let (def_id_0, def_id_1) = *self;
550550

551551
let def_path_hash_0 = tcx.def_path_hash(def_id_0);
@@ -554,7 +554,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) {
554554
def_path_hash_0.0.combine(def_path_hash_1.0)
555555
}
556556

557-
fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String {
557+
fn to_debug_str(&self, tcx: TyCtxt<'tcx>) -> String {
558558
let (def_id_0, def_id_1) = *self;
559559

560560
format!("({}, {})",
@@ -563,13 +563,13 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) {
563563
}
564564
}
565565

566-
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId {
566+
impl<'tcx> DepNodeParams<'tcx> for HirId {
567567
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
568568

569569
// We actually would not need to specialize the implementation of this
570570
// method but it's faster to combine the hashes than to instantiate a full
571571
// hashing context and stable-hashing state.
572-
fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint {
572+
fn to_fingerprint(&self, tcx: TyCtxt<'_>) -> Fingerprint {
573573
let HirId {
574574
owner,
575575
local_id,

Diff for: src/librustc/dep_graph/graph.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ impl DepGraph {
557557
/// a node index can be found for that node.
558558
pub fn try_mark_green_and_read(
559559
&self,
560-
tcx: TyCtxt<'_, '_>,
560+
tcx: TyCtxt<'_>,
561561
dep_node: &DepNode,
562562
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
563563
self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| {
@@ -569,7 +569,7 @@ impl DepGraph {
569569

570570
pub fn try_mark_green(
571571
&self,
572-
tcx: TyCtxt<'_, '_>,
572+
tcx: TyCtxt<'_>,
573573
dep_node: &DepNode,
574574
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
575575
debug_assert!(!dep_node.kind.is_eval_always());
@@ -603,7 +603,7 @@ impl DepGraph {
603603
/// Try to mark a dep-node which existed in the previous compilation session as green.
604604
fn try_mark_previous_green<'tcx>(
605605
&self,
606-
tcx: TyCtxt<'tcx, 'tcx>,
606+
tcx: TyCtxt<'tcx>,
607607
data: &DepGraphData,
608608
prev_dep_node_index: SerializedDepNodeIndex,
609609
dep_node: &DepNode,
@@ -790,7 +790,7 @@ impl DepGraph {
790790
#[inline(never)]
791791
fn emit_diagnostics<'tcx>(
792792
&self,
793-
tcx: TyCtxt<'tcx, 'tcx>,
793+
tcx: TyCtxt<'tcx>,
794794
data: &DepGraphData,
795795
dep_node_index: DepNodeIndex,
796796
did_allocation: bool,
@@ -841,7 +841,7 @@ impl DepGraph {
841841
//
842842
// This method will only load queries that will end up in the disk cache.
843843
// Other queries will not be executed.
844-
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) {
844+
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx>) {
845845
let green_nodes: Vec<DepNode> = {
846846
let data = self.data.as_ref().unwrap();
847847
data.colors.values.indices().filter_map(|prev_index| {

Diff for: src/librustc/dep_graph/safe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ impl DepGraphSafe for DefId {
3333

3434
/// The type context itself can be used to access all kinds of tracked
3535
/// state, but those accesses should always generate read events.
36-
impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {}
36+
impl<'tcx> DepGraphSafe for TyCtxt<'tcx> {}
3737

3838
/// Tuples make it easy to build up state.
3939
impl<A, B> DepGraphSafe for (A, B)

Diff for: src/librustc/hir/check_attr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ impl Target {
8888
}
8989

9090
struct CheckAttrVisitor<'tcx> {
91-
tcx: TyCtxt<'tcx, 'tcx>,
91+
tcx: TyCtxt<'tcx>,
9292
}
9393

9494
impl CheckAttrVisitor<'tcx> {
@@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool {
347347
}
348348
}
349349

350-
fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) {
350+
fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
351351
tcx.hir().visit_item_likes_in_module(
352352
module_def_id,
353353
&mut CheckAttrVisitor { tcx }.as_deep_visitor()

Diff for: src/librustc/hir/def_id.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl DefId {
177177
LocalDefId::from_def_id(self)
178178
}
179179

180-
pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_>) -> String {
180+
pub fn describe_as_module(&self, tcx: TyCtxt<'_>) -> String {
181181
if self.is_local() && self.index == CRATE_DEF_INDEX {
182182
format!("top-level module")
183183
} else {

0 commit comments

Comments
 (0)