Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc/cfg/construct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use crate::hir::{self, PatKind};
use crate::hir::def_id::DefId;

struct CFGBuilder<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
owner_def_id: DefId,
tables: &'a ty::TypeckTables<'tcx>,
graph: CFGGraph,
Expand All @@ -30,7 +30,7 @@ struct LoopScope {
break_index: CFGIndex, // where to go on a `break`
}

pub fn construct<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub fn construct<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
body: &hir::Body) -> CFG {
let mut graph = graph::Graph::new();
let entry = graph.add_node(CFGNodeData::Entry);
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/cfg/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub type Node<'a> = (cfg::CFGIndex, &'a cfg::CFGNode);
pub type Edge<'a> = &'a cfg::CFGEdge;

pub struct LabelledCFG<'a, 'tcx: 'a> {
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
pub cfg: &'a cfg::CFG,
pub name: String,
/// `labelled_edges` controls whether we emit labels on the edges
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/cfg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
pub type CFGEdge = graph::Edge<CFGEdgeData>;

impl CFG {
pub fn new<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
pub fn new<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
body: &hir::Body) -> CFG {
construct::construct(tcx, body)
}
Expand Down
42 changes: 21 additions & 21 deletions src/librustc/dep_graph/dep_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ macro_rules! define_dep_nodes {
impl DepNode {
#[allow(unreachable_code, non_snake_case)]
#[inline(always)]
pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>,
pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
dep: DepConstructor<'gcx>)
-> DepNode
where 'gcx: 'a + 'tcx,
Expand Down Expand Up @@ -442,49 +442,49 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx>
]);

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

impl RecoverKey<'tcx> for CrateNum {
fn recover(tcx: TyCtxt<'_, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
dep_node.extract_def_id(tcx).map(|id| id.krate)
}
}

impl RecoverKey<'tcx> for DefId {
fn recover(tcx: TyCtxt<'_, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
dep_node.extract_def_id(tcx)
}
}

impl RecoverKey<'tcx> for DefIndex {
fn recover(tcx: TyCtxt<'_, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option<Self> {
dep_node.extract_def_id(tcx).map(|id| id.index)
}
}

trait DepNodeParams<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> : fmt::Debug {
trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug {
const CAN_RECONSTRUCT_QUERY_KEY: bool;

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

fn to_debug_str(&self, _: TyCtxt<'a, 'gcx, 'tcx>) -> String {
fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
format!("{:?}", self)
}
}

impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T
where T: HashStable<StableHashingContext<'a>> + fmt::Debug
impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
where T: HashStable<StableHashingContext<'tcx>> + fmt::Debug
{
default const CAN_RECONSTRUCT_QUERY_KEY: bool = false;

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

Expand All @@ -493,36 +493,36 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T
hasher.finish()
}

default fn to_debug_str(&self, _: TyCtxt<'a, 'gcx, 'tcx>) -> String {
default fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
format!("{:?}", *self)
}
}

impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefId {
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;

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

fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
tcx.def_path_str(*self)
}
}

impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for DefIndex {
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;

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

fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
tcx.def_path_str(DefId::local(*self))
}
}

impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for CrateNum {
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum {
const CAN_RECONSTRUCT_QUERY_KEY: bool = true;

fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint {
Expand All @@ -533,12 +533,12 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for CrateNum {
tcx.def_path_hash(def_id).0
}

fn to_debug_str(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> String {
fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String {
tcx.crate_name(*self).as_str().to_string()
}
}

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

// We actually would not need to specialize the implementation of this
Expand All @@ -553,7 +553,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
def_path_hash_0.0.combine(def_path_hash_1.0)
}

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

format!("({}, {})",
Expand All @@ -562,7 +562,7 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
}
}

impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for HirId {
impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId {
const CAN_RECONSTRUCT_QUERY_KEY: bool = false;

// We actually would not need to specialize the implementation of this
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ impl DepGraph {
/// Try to mark a dep-node which existed in the previous compilation session as green.
fn try_mark_previous_green<'tcx>(
&self,
tcx: TyCtxt<'_, 'tcx, 'tcx>,
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
data: &DepGraphData,
prev_dep_node_index: SerializedDepNodeIndex,
dep_node: &DepNode
Expand Down Expand Up @@ -791,7 +791,7 @@ impl DepGraph {
#[inline(never)]
fn emit_diagnostics<'tcx>(
&self,
tcx: TyCtxt<'_, 'tcx, 'tcx>,
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
data: &DepGraphData,
dep_node_index: DepNodeIndex,
did_allocation: bool,
Expand Down Expand Up @@ -842,7 +842,7 @@ impl DepGraph {
//
// This method will only load queries that will end up in the disk cache.
// Other queries will not be executed.
pub fn exec_cache_promotions<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) {
pub fn exec_cache_promotions<'a, 'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) {
let green_nodes: Vec<DepNode> = {
let data = self.data.as_ref().unwrap();
data.colors.values.indices().filter_map(|prev_index| {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/dep_graph/safe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl DepGraphSafe for DefId {

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

/// Tuples make it easy to build up state.
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/hir/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@ impl Target {
}
}

struct CheckAttrVisitor<'a, 'tcx: 'a> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
struct CheckAttrVisitor<'tcx> {
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
}

impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
impl CheckAttrVisitor<'tcx> {
/// Checks any attribute.
fn check_attributes(&self, item: &hir::Item, target: Target) {
if target == Target::Fn || target == Target::Const {
Expand Down Expand Up @@ -310,7 +310,7 @@ impl<'a, 'tcx> CheckAttrVisitor<'a, 'tcx> {
}
}

impl<'a, 'tcx> Visitor<'tcx> for CheckAttrVisitor<'a, 'tcx> {
impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
fn nested_visit_map<'this>(&'this mut self) -> NestedVisitorMap<'this, 'tcx> {
NestedVisitorMap::OnlyBodies(&self.tcx.hir())
}
Expand Down Expand Up @@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool {
}
}

fn check_mod_attrs<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>, module_def_id: DefId) {
fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(
module_def_id,
&mut CheckAttrVisitor { tcx }.as_deep_visitor()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/upvars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Visitor<'tcx> for LocalCollector {
}

struct CaptureCollector<'a, 'tcx> {
tcx: TyCtxt<'a, 'tcx, 'tcx>,
tcx: TyCtxt<'tcx, 'tcx, 'tcx>,
locals: &'a FxHashSet<HirId>,
upvars: FxIndexMap<HirId, hir::Upvar>,
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ich/hcx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ for &'b mut T {
}
}

impl<'a, 'gcx, 'lcx> StableHashingContextProvider<'a> for TyCtxt<'a, 'gcx, 'lcx> {
fn get_stable_hashing_context(&self) -> StableHashingContext<'a> {
impl StableHashingContextProvider<'lcx> for TyCtxt<'lcx, 'gcx, 'lcx> {
fn get_stable_hashing_context(&self) -> StableHashingContext<'lcx> {
(*self).create_stable_hashing_context()
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/infer/canonical/canonicalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic {

struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
infcx: Option<&'cx InferCtxt<'cx, 'gcx, 'tcx>>,
tcx: TyCtxt<'cx, 'gcx, 'tcx>,
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
variables: SmallVec<[CanonicalVarInfo; 8]>,
query_state: &'cx mut OriginalQueryValues<'tcx>,
// Note that indices is only used once `var_values` is big enough to be
Expand All @@ -290,7 +290,7 @@ struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> {
}

impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Canonicalizer<'cx, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> {
fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
self.tcx
}

Expand Down Expand Up @@ -501,7 +501,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> {
fn canonicalize<V>(
value: &V,
infcx: Option<&InferCtxt<'_, 'gcx, 'tcx>>,
tcx: TyCtxt<'_, 'gcx, 'tcx>,
tcx: TyCtxt<'tcx, 'gcx, 'tcx>,
canonicalize_region_mode: &dyn CanonicalizeRegionMode,
query_state: &mut OriginalQueryValues<'tcx>,
) -> Canonicalized<'gcx, V>
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/canonical/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ impl<'tcx> CanonicalVarValues<'tcx> {
/// `self.var_values == [Type(u32), Lifetime('a), Type(u64)]`
/// we'll return a substitution `subst` with:
/// `subst.var_values == [Type(^0), Lifetime(^1), Type(^2)]`.
pub fn make_identity<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self {
pub fn make_identity<'a>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self {
use crate::ty::subst::UnpackedKind;

CanonicalVarValues {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/infer/canonical/query_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use crate::ty::subst::{Kind, UnpackedKind};
use crate::ty::{self, BoundVar, InferConst, Lift, Ty, TyCtxt};
use crate::util::captures::Captures;

impl<'cx, 'gcx, 'tcx> InferCtxtBuilder<'cx, 'gcx, 'tcx> {
impl<'gcx, 'tcx> InferCtxtBuilder<'gcx, 'tcx> {
/// The "main method" for a canonicalized trait query. Given the
/// canonical key `canonical_key`, this method will create a new
/// inference context, instantiate the key, and run your operation
Expand Down Expand Up @@ -647,7 +647,7 @@ impl<'cx, 'gcx, 'tcx> InferCtxt<'cx, 'gcx, 'tcx> {
/// Given the region obligations and constraints scraped from the infcx,
/// creates query region constraints.
pub fn make_query_outlives<'tcx>(
tcx: TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'tcx, '_, 'tcx>,
outlives_obligations: impl Iterator<Item = (Ty<'tcx>, ty::Region<'tcx>)>,
region_constraints: &RegionConstraintData<'tcx>,
) -> Vec<QueryRegionConstraint<'tcx>> {
Expand Down
10 changes: 7 additions & 3 deletions src/librustc/infer/canonical/substitute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ use crate::ty::{self, TyCtxt};
impl<'tcx, V> Canonical<'tcx, V> {
/// Instantiate the wrapped value, replacing each canonical value
/// with the value given in `var_values`.
pub fn substitute(&self, tcx: TyCtxt<'_, '_, 'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V
pub fn substitute(
&self,
tcx: TyCtxt<'tcx, '_, 'tcx>,
var_values: &CanonicalVarValues<'tcx>,
) -> V
where
V: TypeFoldable<'tcx>,
{
Expand All @@ -29,7 +33,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
/// V, replacing each of the canonical variables.
pub fn substitute_projected<T>(
&self,
tcx: TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'tcx, '_, 'tcx>,
var_values: &CanonicalVarValues<'tcx>,
projection_fn: impl FnOnce(&V) -> &T,
) -> T
Expand All @@ -46,7 +50,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
/// must be values for the set of canonical variables that appear in
/// `value`.
pub(super) fn substitute_value<'a, 'tcx, T>(
tcx: TyCtxt<'_, '_, 'tcx>,
tcx: TyCtxt<'tcx, '_, 'tcx>,
var_values: &CanonicalVarValues<'tcx>,
value: &'a T,
) -> T
Expand Down
10 changes: 5 additions & 5 deletions src/librustc/infer/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
a: Ty<'tcx>,
b: Ty<'tcx>)
-> RelateResult<'tcx, Ty<'tcx>>
where R: TypeRelation<'infcx, 'gcx, 'tcx>
where R: TypeRelation<'gcx, 'tcx>
{
let a_is_expected = relation.a_is_expected();

Expand Down Expand Up @@ -123,7 +123,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
b: &'tcx ty::Const<'tcx>,
) -> RelateResult<'tcx, &'tcx ty::Const<'tcx>>
where
R: TypeRelation<'infcx, 'gcx, 'tcx>,
R: TypeRelation<'gcx, 'tcx>,
{
let a_is_expected = relation.a_is_expected();

Expand Down Expand Up @@ -207,7 +207,7 @@ impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
}

impl<'infcx, 'gcx, 'tcx> CombineFields<'infcx, 'gcx, 'tcx> {
pub fn tcx(&self) -> TyCtxt<'infcx, 'gcx, 'tcx> {
pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
self.infcx.tcx
}

Expand Down Expand Up @@ -413,8 +413,8 @@ struct Generalization<'tcx> {
needs_wf: bool,
}

impl<'cx, 'gcx, 'tcx> TypeRelation<'cx, 'gcx, 'tcx> for Generalizer<'cx, 'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'cx, 'gcx, 'tcx> {
impl TypeRelation<'gcx, 'tcx> for Generalizer<'_, 'gcx, 'tcx> {
fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> {
self.infcx.tcx
}

Expand Down
Loading