diff --git a/src/librustc/cfg/construct.rs b/src/librustc/cfg/construct.rs index a6a688460dd6f..a7411c9667929 100644 --- a/src/librustc/cfg/construct.rs +++ b/src/librustc/cfg/construct.rs @@ -8,7 +8,7 @@ use crate::hir::{self, PatKind}; use crate::hir::def_id::DefId; struct CFGBuilder<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, owner_def_id: DefId, tables: &'a ty::TypeckTables<'tcx>, graph: CFGGraph, @@ -30,7 +30,7 @@ struct LoopScope { break_index: CFGIndex, // where to go on a `break` } -pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG { let mut graph = graph::Graph::new(); let entry = graph.add_node(CFGNodeData::Entry); diff --git a/src/librustc/cfg/graphviz.rs b/src/librustc/cfg/graphviz.rs index 57a63f3bd7348..481b5c72e9304 100644 --- a/src/librustc/cfg/graphviz.rs +++ b/src/librustc/cfg/graphviz.rs @@ -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<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub cfg: &'a cfg::CFG, pub name: String, /// `labelled_edges` controls whether we emit labels on the edges diff --git a/src/librustc/cfg/mod.rs b/src/librustc/cfg/mod.rs index 887f550f351b6..deb76e057c538 100644 --- a/src/librustc/cfg/mod.rs +++ b/src/librustc/cfg/mod.rs @@ -49,7 +49,7 @@ pub type CFGNode = graph::Node; pub type CFGEdge = graph::Edge; impl CFG { - pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG { construct::construct(tcx, body) } diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index 01dcdbf0ce545..acff8f621ac0a 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -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<'tcx, 'gcx, 'tcx>, + pub fn new<'a, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, dep: DepConstructor<'gcx>) -> DepNode where 'gcx: 'a + 'tcx, @@ -307,7 +307,7 @@ macro_rules! define_dep_nodes { /// refers to something from the previous compilation session that /// has been removed. #[inline] - pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_, '_>) -> Option { + pub fn extract_def_id(&self, tcx: TyCtxt<'_, '_>) -> Option { if self.kind.can_reconstruct_query_key() { let def_path_hash = DefPathHash(self.hash); tcx.def_path_hash_to_def_id.as_ref()? @@ -400,7 +400,7 @@ impl DefPathHash { impl DefId { #[inline(always)] - pub fn to_dep_node(self, tcx: TyCtxt<'_, '_, '_>, kind: DepKind) -> DepNode { + pub fn to_dep_node(self, tcx: TyCtxt<'_, '_>, kind: DepKind) -> DepNode { DepNode::from_def_path_hash(kind, tcx.def_path_hash(self)) } } @@ -442,23 +442,23 @@ rustc_dep_node_append!([define_dep_nodes!][ <'tcx> ]); pub trait RecoverKey<'tcx>: Sized { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option; + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option; } impl RecoverKey<'tcx> for CrateNum { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.krate) } } impl RecoverKey<'tcx> for DefId { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx) } } impl RecoverKey<'tcx> for DefIndex { - fn recover(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, dep_node: &DepNode) -> Option { + fn recover(tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode) -> Option { dep_node.extract_def_id(tcx).map(|id| id.index) } } @@ -470,11 +470,11 @@ trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug { /// 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<'tcx, 'gcx, 'tcx>) -> Fingerprint { + fn to_fingerprint(&self, _: TyCtxt<'gcx, 'tcx>) -> Fingerprint { panic!("Not implemented. Accidentally called on anonymous node?") } - fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String { format!("{:?}", self) } } @@ -484,7 +484,7 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T { default const CAN_RECONSTRUCT_QUERY_KEY: bool = false; - default fn to_fingerprint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Fingerprint { + default fn to_fingerprint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Fingerprint { let mut hcx = tcx.create_stable_hashing_context(); let mut hasher = StableHasher::new(); @@ -493,7 +493,7 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T hasher.finish() } - default fn to_debug_str(&self, _: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + default fn to_debug_str(&self, _: TyCtxt<'gcx, 'tcx>) -> String { format!("{:?}", *self) } } @@ -501,11 +501,11 @@ impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { tcx.def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { tcx.def_path_str(*self) } } @@ -513,11 +513,11 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefId { impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { tcx.hir().definitions().def_path_hash(*self).0 } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { tcx.def_path_str(DefId::local(*self)) } } @@ -525,7 +525,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for DefIndex { impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum { const CAN_RECONSTRUCT_QUERY_KEY: bool = true; - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { let def_id = DefId { krate: *self, index: CRATE_DEF_INDEX, @@ -533,7 +533,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for CrateNum { tcx.def_path_hash(def_id).0 } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { tcx.crate_name(*self).as_str().to_string() } } @@ -544,7 +544,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { // We actually would not need to specialize the implementation of this // method but it's faster to combine the hashes than to instantiate a full // hashing context and stable-hashing state. - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { let (def_id_0, def_id_1) = *self; let def_path_hash_0 = tcx.def_path_hash(def_id_0); @@ -553,7 +553,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for (DefId, DefId) { def_path_hash_0.0.combine(def_path_hash_1.0) } - fn to_debug_str(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> String { + fn to_debug_str(&self, tcx: TyCtxt<'gcx, 'tcx>) -> String { let (def_id_0, def_id_1) = *self; format!("({}, {})", @@ -568,7 +568,7 @@ impl<'gcx: 'tcx, 'tcx> DepNodeParams<'gcx, 'tcx> for HirId { // We actually would not need to specialize the implementation of this // method but it's faster to combine the hashes than to instantiate a full // hashing context and stable-hashing state. - fn to_fingerprint(&self, tcx: TyCtxt<'_, '_, '_>) -> Fingerprint { + fn to_fingerprint(&self, tcx: TyCtxt<'_, '_>) -> Fingerprint { let HirId { owner, local_id, diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 6789912a03e2f..d15980dcbe6d6 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -558,7 +558,7 @@ impl DepGraph { /// a node index can be found for that node. pub fn try_mark_green_and_read( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, dep_node: &DepNode ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| { @@ -570,7 +570,7 @@ impl DepGraph { pub fn try_mark_green( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, dep_node: &DepNode ) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> { debug_assert!(!dep_node.kind.is_eval_always()); @@ -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>, + tcx: TyCtxt<'tcx, 'tcx>, data: &DepGraphData, prev_dep_node_index: SerializedDepNodeIndex, dep_node: &DepNode @@ -791,7 +791,7 @@ impl DepGraph { #[inline(never)] fn emit_diagnostics<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, data: &DepGraphData, dep_node_index: DepNodeIndex, did_allocation: bool, @@ -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<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { + pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) { let green_nodes: Vec = { let data = self.data.as_ref().unwrap(); data.colors.values.indices().filter_map(|prev_index| { diff --git a/src/librustc/dep_graph/safe.rs b/src/librustc/dep_graph/safe.rs index e03d18950a690..86cba3a4580ba 100644 --- a/src/librustc/dep_graph/safe.rs +++ b/src/librustc/dep_graph/safe.rs @@ -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<'gcx, 'tcx> DepGraphSafe for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> { } /// Tuples make it easy to build up state. diff --git a/src/librustc/hir/check_attr.rs b/src/librustc/hir/check_attr.rs index 5b517677a43f0..4d13d91c8f27d 100644 --- a/src/librustc/hir/check_attr.rs +++ b/src/librustc/hir/check_attr.rs @@ -88,7 +88,7 @@ impl Target { } struct CheckAttrVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl CheckAttrVisitor<'tcx> { @@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool { } } -fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut CheckAttrVisitor { tcx }.as_deep_visitor() diff --git a/src/librustc/hir/def_id.rs b/src/librustc/hir/def_id.rs index 0c4f5fb3fc167..b3abe50a5952f 100644 --- a/src/librustc/hir/def_id.rs +++ b/src/librustc/hir/def_id.rs @@ -177,7 +177,7 @@ impl DefId { LocalDefId::from_def_id(self) } - pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_, '_>) -> String { + pub fn describe_as_module(&self, tcx: TyCtxt<'_, '_>) -> String { if self.is_local() && self.index == CRATE_DEF_INDEX { format!("top-level module") } else { diff --git a/src/librustc/hir/upvars.rs b/src/librustc/hir/upvars.rs index 8c92a0f5d7713..332d15c319379 100644 --- a/src/librustc/hir/upvars.rs +++ b/src/librustc/hir/upvars.rs @@ -55,7 +55,7 @@ impl Visitor<'tcx> for LocalCollector { } struct CaptureCollector<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, locals: &'a FxHashSet, upvars: FxIndexMap, } diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index 535c61df1c527..4b5b458b2afb7 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -205,7 +205,7 @@ for &'b mut T { } } -impl StableHashingContextProvider<'lcx> for TyCtxt<'lcx, 'gcx, 'lcx> { +impl StableHashingContextProvider<'lcx> for TyCtxt<'gcx, 'lcx> { fn get_stable_hashing_context(&self) -> StableHashingContext<'lcx> { (*self).create_stable_hashing_context() } diff --git a/src/librustc/infer/canonical/canonicalizer.rs b/src/librustc/infer/canonical/canonicalizer.rs index f24f7f05a1fa6..dadac4b1e6b8f 100644 --- a/src/librustc/infer/canonical/canonicalizer.rs +++ b/src/librustc/infer/canonical/canonicalizer.rs @@ -277,7 +277,7 @@ impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic { struct Canonicalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { infcx: Option<&'cx InferCtxt<'cx, 'gcx, 'tcx>>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'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 @@ -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<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -501,7 +501,7 @@ impl<'cx, 'gcx, 'tcx> Canonicalizer<'cx, 'gcx, 'tcx> { fn canonicalize( value: &V, infcx: Option<&InferCtxt<'_, 'gcx, 'tcx>>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalize_region_mode: &dyn CanonicalizeRegionMode, query_state: &mut OriginalQueryValues<'tcx>, ) -> Canonicalized<'gcx, V> diff --git a/src/librustc/infer/canonical/mod.rs b/src/librustc/infer/canonical/mod.rs index c1d070f53af03..85e784d0ca5fb 100644 --- a/src/librustc/infer/canonical/mod.rs +++ b/src/librustc/infer/canonical/mod.rs @@ -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(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + pub fn make_identity(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Self { use crate::ty::subst::UnpackedKind; CanonicalVarValues { diff --git a/src/librustc/infer/canonical/query_response.rs b/src/librustc/infer/canonical/query_response.rs index 7defbac7e545b..345889ca44174 100644 --- a/src/librustc/infer/canonical/query_response.rs +++ b/src/librustc/infer/canonical/query_response.rs @@ -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>, + tcx: TyCtxt<'_, 'tcx>, outlives_obligations: impl Iterator, ty::Region<'tcx>)>, region_constraints: &RegionConstraintData<'tcx>, ) -> Vec> { diff --git a/src/librustc/infer/canonical/substitute.rs b/src/librustc/infer/canonical/substitute.rs index 43f6f62bc4880..0dace4132b808 100644 --- a/src/librustc/infer/canonical/substitute.rs +++ b/src/librustc/infer/canonical/substitute.rs @@ -16,7 +16,7 @@ impl<'tcx, V> Canonical<'tcx, V> { /// with the value given in `var_values`. pub fn substitute( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, ) -> V where @@ -33,7 +33,7 @@ impl<'tcx, V> Canonical<'tcx, V> { /// V, replacing each of the canonical variables. pub fn substitute_projected( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, projection_fn: impl FnOnce(&V) -> &T, ) -> T @@ -50,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>, + tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>, value: &'a T, ) -> T diff --git a/src/librustc/infer/combine.rs b/src/librustc/infer/combine.rs index 10a53767f5370..21d4f3bf51197 100644 --- a/src/librustc/infer/combine.rs +++ b/src/librustc/infer/combine.rs @@ -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<'tcx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -414,7 +414,7 @@ struct Generalization<'tcx> { } impl TypeRelation<'gcx, 'tcx> for Generalizer<'_, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/equate.rs b/src/librustc/infer/equate.rs index d74a05fddbcf8..a9e0e3376a54d 100644 --- a/src/librustc/infer/equate.rs +++ b/src/librustc/infer/equate.rs @@ -27,7 +27,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Equate<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Equate<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Equate" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index 137cae149d6e5..d50cb8e61a60b 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -67,7 +67,7 @@ mod need_type_info; pub mod nice_region_error; -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn note_and_explain_region( self, region_scope_tree: ®ion::ScopeTree, @@ -446,7 +446,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { use ty::subst::Kind; struct AbsolutePathPrinter<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } struct NonTrivialPath; @@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { type DynExistential = !; type Const = !; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs index b384a97f38d79..8dd415ec9af4c 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -82,7 +82,7 @@ impl<'a, 'gcx, 'tcx> NiceRegionError<'a, 'gcx, 'tcx> { // where that lifetime appears. This allows us to highlight the // specific part of the type in the error message. struct FindNestedTypeVisitor<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, // The bound_region corresponding to the Refree(freeregion) // associated with the anonymous region we are looking for. bound_region: ty::BoundRegion, @@ -209,7 +209,7 @@ impl Visitor<'gcx> for FindNestedTypeVisitor<'gcx, 'tcx> { // where that lifetime appears. This allows us to highlight the // specific part of the type in the error message. struct TyPathVisitor<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, found_it: bool, bound_region: ty::BoundRegion, current_index: ty::DebruijnIndex, diff --git a/src/librustc/infer/error_reporting/nice_region_error/mod.rs b/src/librustc/infer/error_reporting/nice_region_error/mod.rs index bd7fc9554e8d5..dc9ec15cb2492 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/mod.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/mod.rs @@ -56,7 +56,7 @@ impl<'cx, 'gcx, 'tcx> NiceRegionError<'cx, 'gcx, 'tcx> { Self { infcx, error: None, regions: Some((span, sub, sup)), tables } } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs index c9bda63aa75cc..43a5e4a0d0e77 100644 --- a/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -322,7 +322,7 @@ impl NiceRegionError<'me, 'gcx, 'tcx> { // HACK(eddyb) maybe move this in a more central location. #[derive(Copy, Clone)] struct Highlighted<'gcx, 'tcx, T> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, highlight: RegionHighlightMode, value: T, } diff --git a/src/librustc/infer/freshen.rs b/src/librustc/infer/freshen.rs index ed8b0ff54c8d8..641e5b127e8d0 100644 --- a/src/librustc/infer/freshen.rs +++ b/src/librustc/infer/freshen.rs @@ -114,7 +114,7 @@ impl<'a, 'gcx, 'tcx> TypeFreshener<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for TypeFreshener<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/fudge.rs b/src/librustc/infer/fudge.rs index ebab1f8f2f6d9..ef6ea20c6dfba 100644 --- a/src/librustc/infer/fudge.rs +++ b/src/librustc/infer/fudge.rs @@ -143,7 +143,7 @@ pub struct InferenceFudger<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for InferenceFudger<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/glb.rs b/src/librustc/infer/glb.rs index f84ab59fdae60..0b3c0904d1777 100644 --- a/src/librustc/infer/glb.rs +++ b/src/librustc/infer/glb.rs @@ -24,7 +24,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Glb<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Glb<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Glb" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/lexical_region_resolve/mod.rs b/src/librustc/infer/lexical_region_resolve/mod.rs index 5d83cdcb176de..1612a2a54d10c 100644 --- a/src/librustc/infer/lexical_region_resolve/mod.rs +++ b/src/librustc/infer/lexical_region_resolve/mod.rs @@ -103,7 +103,7 @@ struct LexicalResolver<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.region_rels.tcx } @@ -136,7 +136,7 @@ impl<'cx, 'gcx, 'tcx> LexicalResolver<'cx, 'gcx, 'tcx> { /// Initially, the value for all variables is set to `'empty`, the /// empty region. The `expansion` phase will grow this larger. - fn construct_var_data(&self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> LexicalRegionResolutions<'tcx> { + fn construct_var_data(&self, tcx: TyCtxt<'_, 'tcx>) -> LexicalRegionResolutions<'tcx> { LexicalRegionResolutions { error_region: tcx.lifetimes.re_static, values: IndexVec::from_elem_n(VarValue::Value(tcx.lifetimes.re_empty), self.num_vars()) @@ -785,7 +785,7 @@ impl<'tcx> fmt::Debug for RegionAndOrigin<'tcx> { } impl<'tcx> LexicalRegionResolutions<'tcx> { - fn normalize(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: T) -> T + fn normalize(&self, tcx: TyCtxt<'_, 'tcx>, value: T) -> T where T: TypeFoldable<'tcx>, { diff --git a/src/librustc/infer/lub.rs b/src/librustc/infer/lub.rs index f123690ada4d9..ab49968ce24db 100644 --- a/src/librustc/infer/lub.rs +++ b/src/librustc/infer/lub.rs @@ -24,7 +24,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Lub<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Lub<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Lub" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.tcx() } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.tcx() } fn a_is_expected(&self) -> bool { self.a_is_expected } diff --git a/src/librustc/infer/mod.rs b/src/librustc/infer/mod.rs index 5b04e6d1f0a84..11918eccfd076 100644 --- a/src/librustc/infer/mod.rs +++ b/src/librustc/infer/mod.rs @@ -91,7 +91,7 @@ impl SuppressRegionErrors { /// Indicates that the MIR borrowck will repeat these region /// checks, so we should ignore errors if NLL is (unconditionally) /// enabled. - pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_, '_>) -> Self { + pub fn when_nll_is_enabled(tcx: TyCtxt<'_, '_>) -> Self { match tcx.borrowck_mode() { // If we're on Migrate mode, report AST region errors BorrowckMode::Migrate => SuppressRegionErrors { suppressed: false }, @@ -103,7 +103,7 @@ impl SuppressRegionErrors { } pub struct InferCtxt<'a, 'gcx, 'tcx> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, /// During type-checking/inference of a body, `in_progress_tables` /// contains a reference to the tables being built up, which are @@ -466,11 +466,11 @@ impl<'tcx> fmt::Display for FixupError<'tcx> { /// Necessary because we can't write the following bound: /// `F: for<'b, 'tcx> where 'gcx: 'tcx FnOnce(InferCtxt<'b, 'gcx, 'tcx>)`. pub struct InferCtxtBuilder<'gcx, 'tcx> { - global_tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + global_tcx: TyCtxt<'gcx, 'gcx>, fresh_tables: Option>>, } -impl TyCtxt<'gcx, 'gcx, 'gcx> { +impl TyCtxt<'gcx, 'gcx> { pub fn infer_ctxt<'tcx>(self) -> InferCtxtBuilder<'gcx, 'tcx> { InferCtxtBuilder { global_tcx: self, @@ -1600,7 +1600,7 @@ impl<'a, 'gcx, 'tcx> ShallowResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ShallowResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -1641,7 +1641,7 @@ impl<'gcx, 'tcx> TypeTrace<'tcx> { } } - pub fn dummy(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> TypeTrace<'tcx> { + pub fn dummy(tcx: TyCtxt<'gcx, 'tcx>) -> TypeTrace<'tcx> { TypeTrace { cause: ObligationCause::dummy(), values: Types(ExpectedFound { diff --git a/src/librustc/infer/nll_relate/mod.rs b/src/librustc/infer/nll_relate/mod.rs index 6ac087027ac6e..f6ba13d2aa8f8 100644 --- a/src/librustc/infer/nll_relate/mod.rs +++ b/src/librustc/infer/nll_relate/mod.rs @@ -498,7 +498,7 @@ impl TypeRelation<'gcx, 'tcx> for TypeRelating<'me, 'gcx, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -827,7 +827,7 @@ impl TypeRelation<'gcx, 'tcx> for TypeGeneralizer<'me, 'gcx, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/opaque_types/mod.rs b/src/librustc/infer/opaque_types/mod.rs index a054869874af9..355d527e8efb8 100644 --- a/src/librustc/infer/opaque_types/mod.rs +++ b/src/librustc/infer/opaque_types/mod.rs @@ -553,7 +553,7 @@ impl<'tcx> TypeVisitor<'tcx> for OpaqueTypeOutlivesVisitor<'_, '_, 'tcx> } struct ReverseMapper<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, /// If errors have already been reported in this fn, we suppress /// our own errors because they are sometimes derivative. @@ -569,7 +569,7 @@ struct ReverseMapper<'gcx, 'tcx> { impl ReverseMapper<'gcx, 'tcx> { fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, tainted_by_errors: bool, opaque_type_def_id: DefId, map: FxHashMap, Kind<'gcx>>, @@ -600,7 +600,7 @@ impl ReverseMapper<'gcx, 'tcx> { } impl TypeFolder<'gcx, 'tcx> for ReverseMapper<'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -944,7 +944,7 @@ impl<'a, 'gcx, 'tcx> Instantiator<'a, 'gcx, 'tcx> { /// and `opaque_hir_id` is the `HirId` of the definition of the existential type `Baz`. /// For the above example, this function returns `true` for `f1` and `false` for `f2`. pub fn may_define_existential_type( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, def_id: DefId, opaque_hir_id: hir::HirId, ) -> bool { diff --git a/src/librustc/infer/outlives/free_region_map.rs b/src/librustc/infer/outlives/free_region_map.rs index cf7765c8f12f9..2a5558a4a66fd 100644 --- a/src/librustc/infer/outlives/free_region_map.rs +++ b/src/librustc/infer/outlives/free_region_map.rs @@ -29,7 +29,7 @@ impl<'tcx> FreeRegionMap<'tcx> { /// avoid making arbitrary choices. See /// `TransitiveRelation::postdom_upper_bound` for more details. pub fn lub_free_regions<'gcx>(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, r_a: Region<'tcx>, r_b: Region<'tcx>) -> Region<'tcx> { @@ -90,7 +90,7 @@ impl_stable_hash_for!(struct FreeRegionMap<'tcx> { impl<'a, 'tcx> Lift<'tcx> for FreeRegionMap<'a> { type Lifted = FreeRegionMap<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { self.relation.maybe_map(|&fr| tcx.lift(&fr)) .map(|relation| FreeRegionMap { relation }) } diff --git a/src/librustc/infer/outlives/obligations.rs b/src/librustc/infer/outlives/obligations.rs index 86384f511c682..ddc1cd0ff3ffa 100644 --- a/src/librustc/infer/outlives/obligations.rs +++ b/src/librustc/infer/outlives/obligations.rs @@ -233,7 +233,7 @@ where // See the comments on `process_registered_region_obligations` for the meaning // of these fields. delegate: D, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, verify_bound: VerifyBoundCx<'cx, 'gcx, 'tcx>, } @@ -260,7 +260,7 @@ where { pub fn new( delegate: D, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/infer/outlives/verify.rs b/src/librustc/infer/outlives/verify.rs index 154d0612d7d11..72079a6adc9fb 100644 --- a/src/librustc/infer/outlives/verify.rs +++ b/src/librustc/infer/outlives/verify.rs @@ -13,7 +13,7 @@ use crate::util::captures::Captures; /// accrues them into the `region_obligations` code, but for NLL we /// use something else. pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, @@ -21,7 +21,7 @@ pub struct VerifyBoundCx<'cx, 'gcx: 'tcx, 'tcx: 'cx> { impl<'cx, 'gcx, 'tcx> VerifyBoundCx<'cx, 'gcx, 'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_bound_pairs: &'cx RegionBoundPairs<'tcx>, implicit_region_bound: Option>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc/infer/region_constraints/leak_check.rs b/src/librustc/infer/region_constraints/leak_check.rs index fa6bbdbbbe724..5fc6523feba55 100644 --- a/src/librustc/infer/region_constraints/leak_check.rs +++ b/src/librustc/infer/region_constraints/leak_check.rs @@ -22,7 +22,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { /// refactor the constraint set. pub fn leak_check( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, overly_polymorphic: bool, placeholder_map: &PlaceholderMap<'tcx>, _snapshot: &CombinedSnapshot<'_, 'tcx>, @@ -109,7 +109,7 @@ impl<'tcx> TaintSet<'tcx> { fn fixed_point( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, undo_log: &[UndoLog<'tcx>], verifys: &[Verify<'tcx>], ) { diff --git a/src/librustc/infer/region_constraints/mod.rs b/src/librustc/infer/region_constraints/mod.rs index ff186718f99b7..cab102907f603 100644 --- a/src/librustc/infer/region_constraints/mod.rs +++ b/src/librustc/infer/region_constraints/mod.rs @@ -700,7 +700,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn lub_regions( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, origin: SubregionOrigin<'tcx>, a: Region<'tcx>, b: Region<'tcx>, @@ -722,7 +722,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn glb_regions( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, origin: SubregionOrigin<'tcx>, a: Region<'tcx>, b: Region<'tcx>, @@ -744,7 +744,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { pub fn opportunistic_resolve_var( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, rid: RegionVid, ) -> ty::Region<'tcx> { let vid = self.unification_table.probe_value(rid).min_vid; @@ -760,7 +760,7 @@ impl<'tcx> RegionConstraintCollector<'tcx> { fn combine_vars( &mut self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, t: CombineMapType, a: Region<'tcx>, b: Region<'tcx>, @@ -850,7 +850,7 @@ impl<'tcx> fmt::Display for GenericKind<'tcx> { } impl<'gcx, 'tcx> GenericKind<'tcx> { - pub fn to_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match *self { GenericKind::Param(ref p) => p.to_ty(tcx), GenericKind::Projection(ref p) => tcx.mk_projection(p.item_def_id, p.substs), diff --git a/src/librustc/infer/resolve.rs b/src/librustc/infer/resolve.rs index ea9d8dbbb1e89..774ebdcdd2502 100644 --- a/src/librustc/infer/resolve.rs +++ b/src/librustc/infer/resolve.rs @@ -24,7 +24,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticVarResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticVarResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -61,7 +61,7 @@ impl<'a, 'gcx, 'tcx> OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpportunisticTypeAndRegionResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -177,7 +177,7 @@ struct FullTypeResolver<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for FullTypeResolver<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/infer/sub.rs b/src/librustc/infer/sub.rs index 4f73f229423c3..e17da50d7be8c 100644 --- a/src/librustc/infer/sub.rs +++ b/src/librustc/infer/sub.rs @@ -33,7 +33,7 @@ impl<'combine, 'infcx, 'gcx, 'tcx> Sub<'combine, 'infcx, 'gcx, 'tcx> { impl TypeRelation<'gcx, 'tcx> for Sub<'combine, 'infcx, 'gcx, 'tcx> { fn tag(&self) -> &'static str { "Sub" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.fields.infcx.tcx } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fields.infcx.tcx } fn a_is_expected(&self) -> bool { self.a_is_expected } fn with_cause(&mut self, cause: Cause, f: F) -> R diff --git a/src/librustc/infer/unify_key.rs b/src/librustc/infer/unify_key.rs index 6a46ed50679ef..7f9880031f3f0 100644 --- a/src/librustc/infer/unify_key.rs +++ b/src/librustc/infer/unify_key.rs @@ -10,7 +10,7 @@ use std::marker::PhantomData; use std::cell::RefMut; pub trait ToType { - fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>; } impl UnifyKey for ty::IntVid { @@ -52,7 +52,7 @@ impl UnifyKey for ty::RegionVid { } impl ToType for IntVarValue { - fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match *self { ty::IntType(i) => tcx.mk_mach_int(i), ty::UintType(i) => tcx.mk_mach_uint(i), @@ -72,7 +72,7 @@ impl UnifyKey for ty::FloatVid { impl EqUnifyValue for FloatVarValue {} impl ToType for FloatVarValue { - fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_type<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { tcx.mk_mach_float(self.0) } } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 3ddf57faa709b..11047f45343af 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -509,7 +509,7 @@ impl LintStore { /// Context for lint checking after type checking. pub struct LateContext<'a, 'tcx: 'a> { /// Type context we're checking in. - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, /// Side-tables for the body we are in. // FIXME: Make this lazy to avoid running the TypeckTables query? @@ -781,7 +781,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { /// ``` pub fn get_def_path(&self, def_id: DefId) -> Vec { pub struct AbsolutePathPrinter<'tcx> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, } impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { @@ -793,7 +793,7 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> { type DynExistential = (); type Const = (); - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -1372,7 +1372,7 @@ macro_rules! late_lint_pass_impl { late_lint_methods!(late_lint_pass_impl, [], ['tcx]); fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId, pass: T, ) { @@ -1404,7 +1404,7 @@ fn late_lint_mod_pass<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId, builtin_lints: T, ) { @@ -1424,7 +1424,7 @@ pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, pass: T ) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); @@ -1460,7 +1460,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( } fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, builtin_lints: T ) { let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap(); @@ -1494,7 +1494,7 @@ fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( /// Performs lint checking on a crate. pub fn check_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, builtin_lints: impl FnOnce() -> T + Send, ) { join(|| { diff --git a/src/librustc/lint/mod.rs b/src/librustc/lint/mod.rs index 6311639d67765..d8f21ced2559d 100644 --- a/src/librustc/lint/mod.rs +++ b/src/librustc/lint/mod.rs @@ -761,12 +761,12 @@ pub fn struct_lint_level<'a>(sess: &'a Session, return err } -pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_, '_>, id: hir::HirId) -> bool { +pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_>, id: hir::HirId) -> bool { let attrs = tcx.hir().attrs_by_hir_id(id); attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some()) } -fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) +fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap { assert_eq!(cnum, LOCAL_CRATE); @@ -789,7 +789,7 @@ fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cnum: CrateNum) struct LintLevelMapBuilder<'tcx> { levels: levels::LintLevelsBuilder<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl LintLevelMapBuilder<'tcx> { diff --git a/src/librustc/macros.rs b/src/librustc/macros.rs index 38e453191a363..aeacd3722b438 100644 --- a/src/librustc/macros.rs +++ b/src/librustc/macros.rs @@ -195,7 +195,7 @@ macro_rules! CloneLiftImpls { $( impl<$tcx> $crate::ty::Lift<$tcx> for $ty { type Lifted = Self; - fn lift_to_tcx<'a, 'gcx>(&self, _: $crate::ty::TyCtxt<'a, 'gcx, $tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, _: $crate::ty::TyCtxt<'gcx, $tcx>) -> Option { Some(Clone::clone(self)) } } @@ -264,7 +264,7 @@ macro_rules! BraceStructLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<$lifted> { $(let $field = tcx.lift(&self.$field)?;)* Some(Self::Lifted { $($field),* }) } @@ -283,7 +283,7 @@ macro_rules! EnumLiftImpl { { type Lifted = $lifted; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<$lifted> { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option<$lifted> { EnumLiftImpl!(@Variants(self, tcx) input($($variants)*) output()) } } diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 16fed08e0d0e6..2e490931525a3 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -212,7 +212,7 @@ pub trait CrateStore { // utility functions fn encode_metadata<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata; fn metadata_encoding_version(&self) -> &[u8]; } @@ -228,7 +228,7 @@ pub type CrateStoreDyn = dyn CrateStore + sync::Sync; // In order to get this left-to-right dependency ordering, we perform a // topological sort of all crates putting the leaves at the right-most // positions. -pub fn used_crates(tcx: TyCtxt<'_, '_, '_>, prefer: LinkagePreference) +pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> { let mut libs = tcx.crates() diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index ca23722da320e..9bd80bf3f8b87 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -26,7 +26,7 @@ use syntax_pos; // explored. For example, if it's a live Node::Item that is a // function, then we should explore its block to check for codes that // may need to be marked as live. -fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool { match tcx.hir().find_by_hir_id(hir_id) { Some(Node::Item(..)) | @@ -41,7 +41,7 @@ fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, struct MarkSymbolVisitor<'a, 'tcx: 'a> { worklist: Vec, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, live_symbols: FxHashSet, repr_has_repr_c: bool, @@ -302,7 +302,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> { } } -fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, +fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_>, id: hir::HirId, attrs: &[ast::Attribute]) -> bool { if attr::contains_name(attrs, sym::lang) { @@ -353,7 +353,7 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>, struct LifeSeeder<'k, 'tcx: 'k> { worklist: Vec, krate: &'k hir::Crate, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // see `MarkSymbolVisitor::struct_constructors` struct_constructors: FxHashMap, } @@ -424,7 +424,7 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> { } fn create_and_seed_worklist<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate, ) -> (Vec, FxHashMap) { @@ -451,7 +451,7 @@ fn create_and_seed_worklist<'tcx>( (life_seeder.worklist, life_seeder.struct_constructors) } -fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, access_levels: &privacy::AccessLevels, krate: &hir::Crate) -> FxHashSet { @@ -472,7 +472,7 @@ fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct DeadVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, live_symbols: FxHashSet, } @@ -660,7 +660,7 @@ impl Visitor<'tcx> for DeadVisitor<'tcx> { } } -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); let krate = tcx.hir().krate(); let live_symbols = find_live(tcx, access_levels, krate); diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index c5ab8f79baa58..faa3ea27d13ff 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -81,7 +81,7 @@ pub enum Linkage { Dynamic, } -pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let sess = &tcx.sess; let fmts = sess.crate_types.borrow().iter().map(|&ty| { let linkage = calculate_type(tcx, ty); @@ -92,7 +92,7 @@ pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { sess.dependency_formats.set(fmts); } -fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> DependencyList { let sess = &tcx.sess; @@ -242,7 +242,7 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ret } -fn add_library(tcx: TyCtxt<'_, '_, '_>, +fn add_library(tcx: TyCtxt<'_, '_>, cnum: CrateNum, link: LinkagePreference, m: &mut FxHashMap) { @@ -267,7 +267,7 @@ fn add_library(tcx: TyCtxt<'_, '_, '_>, } } -fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { +fn attempt_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { let sess = &tcx.sess; let crates = cstore::used_crates(tcx, RequireStatic); if !crates.iter().by_ref().all(|&(_, ref p)| p.is_some()) { @@ -324,7 +324,7 @@ fn activate_injected_dep(injected: Option, // After the linkage for a crate has been determined we need to verify that // there's only going to be one allocator in the output. -fn verify_ok<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, list: &[Linkage]) { +fn verify_ok<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, list: &[Linkage]) { let sess = &tcx.sess; if list.len() == 0 { return diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index 67db2ec248156..024196e35647c 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -47,7 +47,7 @@ impl<'a, 'tcx> ItemLikeVisitor<'tcx> for EntryContext<'a, 'tcx> { } } -fn entry_fn(tcx: TyCtxt<'_, '_, '_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> { +fn entry_fn(tcx: TyCtxt<'_, '_>, cnum: CrateNum) -> Option<(DefId, EntryFnType)> { assert_eq!(cnum, LOCAL_CRATE); let any_exe = tcx.sess.crate_types.borrow().iter().any(|ty| { @@ -141,7 +141,7 @@ fn find_item(item: &Item, ctxt: &mut EntryContext<'_, '_>, at_root: bool) { } fn configure_main( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, visitor: &EntryContext<'_, '_>, ) -> Option<(DefId, EntryFnType)> { if let Some((hir_id, _)) = visitor.start_fn { @@ -179,7 +179,7 @@ fn configure_main( } } -pub fn find_entry_point(tcx: TyCtxt<'_, '_, '_>) -> Option<(DefId, EntryFnType)> { +pub fn find_entry_point(tcx: TyCtxt<'_, '_>) -> Option<(DefId, EntryFnType)> { tcx.entry_fn(LOCAL_CRATE) } diff --git a/src/librustc/middle/exported_symbols.rs b/src/librustc/middle/exported_symbols.rs index 4eb3a2bd10b44..bebfb4b768703 100644 --- a/src/librustc/middle/exported_symbols.rs +++ b/src/librustc/middle/exported_symbols.rs @@ -39,7 +39,7 @@ pub enum ExportedSymbol<'tcx> { impl<'tcx> ExportedSymbol<'tcx> { pub fn symbol_name(&self, - tcx: TyCtxt<'_, 'tcx, '_>) + tcx: TyCtxt<'tcx, '_>) -> ty::SymbolName { match *self { ExportedSymbol::NonGeneric(def_id) => { @@ -55,7 +55,7 @@ impl<'tcx> ExportedSymbol<'tcx> { } pub fn compare_stable(&self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, other: &ExportedSymbol<'tcx>) -> cmp::Ordering { match *self { @@ -92,7 +92,7 @@ impl<'tcx> ExportedSymbol<'tcx> { } } -pub fn metadata_symbol_name(tcx: TyCtxt<'_, '_, '_>) -> String { +pub fn metadata_symbol_name(tcx: TyCtxt<'_, '_>) -> String { format!("rust_metadata_{}_{}", tcx.original_crate_name(LOCAL_CRATE), tcx.crate_disambiguator(LOCAL_CRATE).to_fingerprint().to_hex()) diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs index 0565e05b95019..e9f435f8991f5 100644 --- a/src/librustc/middle/expr_use_visitor.rs +++ b/src/librustc/middle/expr_use_visitor.rs @@ -202,7 +202,7 @@ enum OverloadedCallType { } impl OverloadedCallType { - fn from_trait_id(tcx: TyCtxt<'_, '_, '_>, trait_id: DefId) -> OverloadedCallType { + fn from_trait_id(tcx: TyCtxt<'_, '_>, trait_id: DefId) -> OverloadedCallType { for &(maybe_function_trait, overloaded_call_type) in &[ (tcx.lang_items().fn_once_trait(), FnOnceOverloadedCall), (tcx.lang_items().fn_mut_trait(), FnMutOverloadedCall), @@ -219,7 +219,7 @@ impl OverloadedCallType { bug!("overloaded call didn't map to known function trait") } - fn from_method_id(tcx: TyCtxt<'_, '_, '_>, method_id: DefId) -> OverloadedCallType { + fn from_method_id(tcx: TyCtxt<'_, '_>, method_id: DefId) -> OverloadedCallType { let method = tcx.associated_item(method_id); OverloadedCallType::from_trait_id(tcx, method.container.id()) } @@ -267,7 +267,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> { /// /// See also `with_infer`, which is used *during* typeck. pub fn new(delegate: &'a mut (dyn Delegate<'tcx>+'a), - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId, param_env: ty::ParamEnv<'tcx>, region_scope_tree: &'a region::ScopeTree, @@ -333,7 +333,7 @@ impl<'a, 'gcx, 'tcx> ExprUseVisitor<'a, 'gcx, 'tcx> { self.consume_expr(&body.value); } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.mc.tcx } diff --git a/src/librustc/middle/free_region.rs b/src/librustc/middle/free_region.rs index 31fb097e54705..74c50cabab0c4 100644 --- a/src/librustc/middle/free_region.rs +++ b/src/librustc/middle/free_region.rs @@ -16,7 +16,7 @@ use crate::ty::{self, TyCtxt, Region}; /// This stuff is a bit convoluted and should be refactored, but as we /// transition to NLL, it'll all go away anyhow. pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, /// The context used to fetch the region maps. pub context: DefId, @@ -30,7 +30,7 @@ pub struct RegionRelations<'a, 'gcx: 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> RegionRelations<'a, 'gcx, 'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, context: DefId, region_scope_tree: &'a region::ScopeTree, free_regions: &'a FreeRegionMap<'tcx>, diff --git a/src/librustc/middle/intrinsicck.rs b/src/librustc/middle/intrinsicck.rs index ba890e6277089..9746c7ce05c11 100644 --- a/src/librustc/middle/intrinsicck.rs +++ b/src/librustc/middle/intrinsicck.rs @@ -10,7 +10,7 @@ use syntax_pos::{Span, sym}; use crate::hir::intravisit::{self, Visitor, NestedVisitorMap}; use crate::hir; -fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_intrinsics<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut ItemVisitor { tcx }.as_deep_visitor() @@ -25,18 +25,18 @@ pub fn provide(providers: &mut Providers<'_>) { } struct ItemVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> } struct ExprVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'tcx ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, } /// If the type is `Option`, it will return `T`, otherwise /// the type itself. Works on most `Option`-like types. -fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { let (def, substs) = match ty.sty { diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs index c70179b5818c6..02163409b3271 100644 --- a/src/librustc/middle/lang_items.rs +++ b/src/librustc/middle/lang_items.rs @@ -106,7 +106,7 @@ impl LanguageItems { struct LanguageItemCollector<'tcx> { items: LanguageItems, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, /// A mapping from the name of the lang item to its order and the form it must be of. item_refs: FxHashMap<&'static str, (usize, Target)>, } @@ -160,7 +160,7 @@ impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> { } impl LanguageItemCollector<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LanguageItemCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx>) -> LanguageItemCollector<'tcx> { let mut item_refs = FxHashMap::default(); $( item_refs.insert($name, ($variant as usize, $target)); )* @@ -217,7 +217,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> { } /// Traverse and collect all the lang items in all crates. -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LanguageItems { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> LanguageItems { // Initialize the collector. let mut collector = LanguageItemCollector::new(tcx); @@ -402,7 +402,7 @@ language_item_table! { Rc, "rc", rc, Target::Struct; } -impl<'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { +impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> { /// Returns the `DefId` for a given `LangItem`. /// If not found, fatally abort compilation. pub fn require_lang_item(&self, lang_item: LangItem) -> DefId { diff --git a/src/librustc/middle/lib_features.rs b/src/librustc/middle/lib_features.rs index a6f305d73898f..b05ede53d1cfd 100644 --- a/src/librustc/middle/lib_features.rs +++ b/src/librustc/middle/lib_features.rs @@ -38,12 +38,12 @@ impl LibFeatures { } pub struct LibFeatureCollector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, lib_features: LibFeatures, } impl LibFeatureCollector<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LibFeatureCollector<'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx>) -> LibFeatureCollector<'tcx> { LibFeatureCollector { tcx, lib_features: LibFeatures::new(), @@ -142,7 +142,7 @@ impl Visitor<'tcx> for LibFeatureCollector<'tcx> { } } -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> LibFeatures { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> LibFeatures { let mut collector = LibFeatureCollector::new(tcx); intravisit::walk_crate(&mut collector, tcx.hir().krate()); collector.lib_features diff --git a/src/librustc/middle/liveness.rs b/src/librustc/middle/liveness.rs index 3a8afed724c1b..43b0c64df7837 100644 --- a/src/librustc/middle/liveness.rs +++ b/src/librustc/middle/liveness.rs @@ -150,7 +150,7 @@ enum LiveNodeKind { ExitNode } -fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_, '_>) -> String { +fn live_node_kind_to_string(lnk: LiveNodeKind, tcx: TyCtxt<'_, '_>) -> String { let cm = tcx.sess.source_map(); match lnk { UpvarNode(s) => { @@ -181,7 +181,7 @@ impl<'tcx> Visitor<'tcx> for IrMaps<'tcx> { fn visit_arm(&mut self, a: &'tcx hir::Arm) { visit_arm(self, a); } } -fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_liveness<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut IrMaps::new(tcx, module_def_id).as_deep_visitor(), @@ -257,7 +257,7 @@ enum VarKind { } struct IrMaps<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId, num_live_nodes: usize, num_vars: usize, @@ -269,7 +269,7 @@ struct IrMaps<'tcx> { } impl IrMaps<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body_owner: DefId) -> IrMaps<'tcx> { + fn new(tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId) -> IrMaps<'tcx> { IrMaps { tcx, body_owner, diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs index d1814b5fe77d2..d7e8f1fb71404 100644 --- a/src/librustc/middle/mem_categorization.rs +++ b/src/librustc/middle/mem_categorization.rs @@ -288,7 +288,7 @@ impl HirNode for hir::Pat { #[derive(Clone)] pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, pub body_owner: DefId, pub upvars: Option<&'tcx FxIndexMap>, pub region_scope_tree: &'a region::ScopeTree, @@ -339,7 +339,7 @@ impl MutabilityCategory { ret } - fn from_local(tcx: TyCtxt<'_, '_, '_>, tables: &ty::TypeckTables<'_>, + fn from_local(tcx: TyCtxt<'_, '_>, tables: &ty::TypeckTables<'_>, id: ast::NodeId) -> MutabilityCategory { let ret = match tcx.hir().get(id) { Node::Binding(p) => match p.node { @@ -400,7 +400,7 @@ impl MutabilityCategory { } impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId, region_scope_tree: &'a region::ScopeTree, tables: &'a ty::TypeckTables<'tcx>, @@ -1514,7 +1514,7 @@ impl<'tcx> cmt_<'tcx> { } } - pub fn descriptive_string(&self, tcx: TyCtxt<'_, '_, '_>) -> Cow<'static, str> { + pub fn descriptive_string(&self, tcx: TyCtxt<'_, '_>) -> Cow<'static, str> { match self.cat { Categorization::StaticItem => { "static item".into() diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 1488b61dddc08..116ce7525dab5 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -27,7 +27,7 @@ use crate::hir::intravisit; // Returns true if the given item must be inlined because it may be // monomorphized or it was marked with `#[inline]`. This will only return // true for functions. -fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, attrs: CodegenFnAttrs) -> bool { if attrs.requests_inline() { @@ -44,7 +44,7 @@ fn item_might_be_inlined(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item: &hir::ImplItem, impl_src: DefId) -> bool { let codegen_fn_attrs = tcx.codegen_fn_attrs(impl_item.hir_id.owner_def_id()); @@ -67,7 +67,7 @@ fn method_might_be_inlined<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Information needed while computing reachability. struct ReachableContext<'a, 'tcx: 'a> { // The type context. - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, // The set of items which must be exported in the linkage sense. reachable_symbols: HirIdSet, @@ -335,7 +335,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { // trait items are used from inlinable code through method call syntax or UFCS, or their // trait is a lang item. struct CollectPrivateImplItemsVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a privacy::AccessLevels, worklist: &'a mut Vec, } @@ -391,7 +391,7 @@ impl<'a, 'tcx: 'a> ItemLikeVisitor<'tcx> for CollectPrivateImplItemsVisitor<'a, #[derive(Clone, HashStable)] pub struct ReachableSet(pub Lrc); -fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet { +fn reachable_set<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> ReachableSet { debug_assert!(crate_num == LOCAL_CRATE); let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index c7c838e431556..3c99ec391533c 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -169,7 +169,7 @@ impl Scope { self.id } - pub fn node_id(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> ast::NodeId { + pub fn node_id(&self, tcx: TyCtxt<'_, '_>, scope_tree: &ScopeTree) -> ast::NodeId { match scope_tree.root_body { Some(hir_id) => { tcx.hir().hir_to_node_id(hir::HirId { @@ -184,7 +184,7 @@ impl Scope { /// Returns the span of this `Scope`. Note that in general the /// returned span may not correspond to the span of any `NodeId` in /// the AST. - pub fn span(&self, tcx: TyCtxt<'_, '_, '_>, scope_tree: &ScopeTree) -> Span { + pub fn span(&self, tcx: TyCtxt<'_, '_>, scope_tree: &ScopeTree) -> Span { let node_id = self.node_id(tcx, scope_tree); if node_id == ast::DUMMY_NODE_ID { return DUMMY_SP; @@ -359,7 +359,7 @@ pub struct Context { } struct RegionResolutionVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // The number of expressions and patterns visited in the current body expr_and_pat_count: usize, @@ -646,7 +646,7 @@ impl<'tcx> ScopeTree { /// Assuming that the provided region was defined within this `ScopeTree`, /// returns the outermost `Scope` that the region outlives. - pub fn early_free_scope<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn early_free_scope<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, br: &ty::EarlyBoundRegion) -> Scope { let param_owner = tcx.parent(br.def_id).unwrap(); @@ -677,7 +677,7 @@ impl<'tcx> ScopeTree { /// Assuming that the provided region was defined within this `ScopeTree`, /// returns the outermost `Scope` that the region outlives. - pub fn free_scope<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fr: &ty::FreeRegion) + pub fn free_scope<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, fr: &ty::FreeRegion) -> Scope { let param_owner = match fr.bound_region { ty::BoundRegion::BrNamed(def_id, _) => { @@ -1327,7 +1327,7 @@ impl<'tcx> Visitor<'tcx> for RegionResolutionVisitor<'tcx> { } } -fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn region_scope_tree<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ScopeTree { let closure_base_def_id = tcx.closure_base_def_id(def_id); diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index 83c2cab74e435..32577e019e0c2 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -218,7 +218,7 @@ impl_stable_hash_for!(struct crate::middle::resolve_lifetime::ResolveLifetimes { }); struct LifetimeContext<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, map: &'a mut NamedRegionMap, scope: ScopeRef<'a>, @@ -369,7 +369,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { /// directly, but rather use `named_region_map`, `is_late_bound_map`, /// etc. fn resolve_lifetimes<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, for_krate: CrateNum, ) -> &'tcx ResolveLifetimes { assert_eq!(for_krate, LOCAL_CRATE); @@ -398,7 +398,7 @@ fn resolve_lifetimes<'tcx>( tcx.arena.alloc(rl) } -fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> NamedRegionMap { +fn krate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> NamedRegionMap { let krate = tcx.hir().krate(); let mut map = NamedRegionMap { defs: Default::default(), @@ -1101,7 +1101,7 @@ impl ShadowKind { } } -fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_, '_>, params: &P<[hir::GenericParam]>) { +fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_>, params: &P<[hir::GenericParam]>) { let lifetime_params: Vec<_> = params .iter() .filter_map(|param| match param.kind { @@ -1129,7 +1129,7 @@ fn check_mixed_explicit_and_in_band_defs(tcx: TyCtxt<'_, '_, '_>, params: &P<[hi } fn signal_shadowing_problem( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, name: ast::Name, orig: Original, shadower: Shadower, @@ -1169,7 +1169,7 @@ fn signal_shadowing_problem( // if one of the label shadows a lifetime or another label. fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { struct GatherLabels<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, scope: ScopeRef<'a>, labels_in_fn: &'a mut Vec, } @@ -1218,7 +1218,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { } fn check_if_label_shadows_lifetime( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, mut scope: ScopeRef<'_>, label: ast::Ident, ) { @@ -1257,7 +1257,7 @@ fn extract_labels(ctxt: &mut LifetimeContext<'_, '_>, body: &hir::Body) { } fn compute_object_lifetime_defaults( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, ) -> HirIdMap> { let mut map = HirIdMap::default(); for item in tcx.hir().krate().items.values() { @@ -1315,7 +1315,7 @@ fn compute_object_lifetime_defaults( /// of the form `T:'a` so as to determine the `ObjectLifetimeDefault` /// for each type parameter. fn object_lifetime_defaults_for_item( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, generics: &hir::Generics, ) -> Vec { fn add_bounds(set: &mut Set1, bounds: &[hir::GenericBound]) { diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index b812ef504eeac..30c4a46271c21 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -106,7 +106,7 @@ impl_stable_hash_for!(struct self::Index<'tcx> { // A private tree-walker for producing an Index. struct Annotator<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, index: &'a mut Index<'tcx>, parent_stab: Option<&'tcx Stability>, parent_depr: Option, @@ -317,7 +317,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Annotator<'a, 'tcx> { } struct MissingStabilityAnnotations<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a AccessLevels, } @@ -390,7 +390,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'a, 'tcx> { } impl<'tcx> Index<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Index<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Index<'tcx> { let is_staged_api = tcx.sess.opts.debugging_opts.force_unstable_if_unmarked || tcx.features().staged_api; @@ -466,7 +466,7 @@ impl<'tcx> Index<'tcx> { /// Cross-references the feature names of unstable APIs with enabled /// features and possibly prints errors. -fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_unstable_api_usage<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut Checker { tcx }.as_deep_visitor()); } @@ -502,7 +502,7 @@ pub fn deprecation_in_effect(since: &str) -> bool { } struct Checker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } /// Result of `TyCtxt::eval_stability`. @@ -521,7 +521,7 @@ pub enum EvalResult { Unmarked, } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { // See issue #38412. fn skip_stability_check_due_to_privacy(self, mut def_id: DefId) -> bool { // Check if `def_id` is a trait method. @@ -827,7 +827,7 @@ impl Visitor<'tcx> for Checker<'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn lookup_deprecation(self, id: DefId) -> Option { self.lookup_deprecation_entry(id).map(|depr| depr.attr) } @@ -836,7 +836,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// Given the list of enabled features that were not language features (i.e., that /// were expected to be library features), and the list of features used from /// libraries, identify activated features that don't exist and error about them. -pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE); if tcx.stability().staged_api[&LOCAL_CRATE] { @@ -921,7 +921,7 @@ pub fn check_unused_or_stable_features<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } fn unnecessary_stable_feature_lint<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, span: Span, feature: Symbol, since: Symbol diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index d7c340c4040ac..45d405df950e9 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -18,13 +18,13 @@ macro_rules! weak_lang_items { ($($name:ident, $item:ident, $sym:ident;)*) => ( struct Context<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, items: &'a mut lang_items::LanguageItems, } /// Checks the crate for usage of weak lang items, returning a vector of all the /// language items required by this crate, but not defined yet. -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, items: &mut lang_items::LanguageItems) { // These are never called by user code, they're generated by the compiler. // They will never implicitly be added to the `missing` array unless we do @@ -60,7 +60,7 @@ pub fn link_name(attrs: &[ast::Attribute]) -> Option { /// Not all lang items are always required for each compilation, particularly in /// the case of panic=abort. In these situations some lang items are injected by /// crates and don't actually need to be defined in libstd. -pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) -> bool { +pub fn whitelisted(tcx: TyCtxt<'_, '_>, lang_item: lang_items::LangItem) -> bool { // If we're not compiling with unwinding, we won't actually need these // symbols. Other panic runtimes ensure that the relevant symbols are // available to link things together, but they're never exercised. @@ -72,7 +72,7 @@ pub fn whitelisted(tcx: TyCtxt<'_, '_, '_>, lang_item: lang_items::LangItem) -> false } -fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn verify<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, items: &lang_items::LanguageItems) { // We only need to check for the presence of weak lang items if we're // emitting something that's not an rlib. @@ -142,7 +142,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Context<'a, 'tcx> { } } -impl<'tcx, 'gcx> TyCtxt<'gcx, 'tcx, 'gcx> { +impl<'tcx, 'gcx> TyCtxt<'tcx, 'gcx> { pub fn is_weak_lang_item(&self, item_def_id: DefId) -> bool { let lang_items = self.lang_items(); let did = Some(item_def_id); diff --git a/src/librustc/mir/interpret/mod.rs b/src/librustc/mir/interpret/mod.rs index 48d5f0d0f4931..09d7f77ac9d5b 100644 --- a/src/librustc/mir/interpret/mod.rs +++ b/src/librustc/mir/interpret/mod.rs @@ -66,7 +66,7 @@ enum AllocDiscriminant { pub fn specialized_encode_alloc_id<'tcx, E: Encoder>( encoder: &mut E, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, alloc_id: AllocId, ) -> Result<(), E::Error> { let alloc: GlobalAlloc<'tcx> = diff --git a/src/librustc/mir/mod.rs b/src/librustc/mir/mod.rs index 46e8468847e96..90a683b733362 100644 --- a/src/librustc/mir/mod.rs +++ b/src/librustc/mir/mod.rs @@ -1241,7 +1241,7 @@ impl<'tcx> Terminator<'tcx> { impl<'tcx> TerminatorKind<'tcx> { pub fn if_<'gcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, cond: Operand<'tcx>, t: BasicBlock, f: BasicBlock, @@ -2324,7 +2324,7 @@ impl<'tcx> Operand<'tcx> { /// with given `DefId` and substs. Since this is used to synthesize /// MIR, assumes `user_ty` is None. pub fn function_handle( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, span: Span, diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index cc169aa30ccf8..0b095c2f0de56 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -48,7 +48,7 @@ pub enum MonoItem<'tcx> { } impl<'tcx> MonoItem<'tcx> { - pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> usize { + pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx>) -> usize { match *self { MonoItem::Fn(instance) => { // Estimate the size of a function based on how many statements @@ -72,7 +72,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> SymbolName { + pub fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx>) -> SymbolName { match *self { MonoItem::Fn(instance) => tcx.symbol_name(instance), MonoItem::Static(def_id) => { @@ -88,7 +88,7 @@ impl<'tcx> MonoItem<'tcx> { } pub fn instantiation_mode(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> InstantiationMode { let inline_in_all_cgus = tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| { @@ -133,7 +133,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { let def_id = match *self { MonoItem::Fn(ref instance) => instance.def_id(), MonoItem::Static(def_id) => def_id, @@ -169,7 +169,7 @@ impl<'tcx> MonoItem<'tcx> { /// Similarly, if a vtable method has such a signature, and therefore can't /// be used, we can just not emit it and have a placeholder (a null pointer, /// which will never be accessed) in its place. - pub fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> bool { + pub fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool { debug!("is_instantiable({:?})", self); let (def_id, substs) = match *self { MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs), @@ -181,7 +181,7 @@ impl<'tcx> MonoItem<'tcx> { tcx.substitute_normalize_and_test_predicates((def_id, &substs)) } - pub fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug: bool) -> String { + pub fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx>, debug: bool) -> String { return match *self { MonoItem::Fn(instance) => { to_string_internal(tcx, "fn ", instance, debug) @@ -195,7 +195,7 @@ impl<'tcx> MonoItem<'tcx> { } }; - fn to_string_internal<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn to_string_internal<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, prefix: &str, instance: Instance<'tcx>, debug: bool) @@ -208,7 +208,7 @@ impl<'tcx> MonoItem<'tcx> { } } - pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { match *self { MonoItem::Fn(Instance { def, .. }) => { tcx.hir().as_local_hir_id(def.def_id()) @@ -334,7 +334,7 @@ impl<'tcx> CodegenUnit<'tcx> { base_n::encode(hash, base_n::CASE_INSENSITIVE) } - pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { + pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, 'tcx>) { // Estimate the size of a codegen unit as (approximately) the number of MIR // statements it corresponds to. self.size_estimate = Some(self.items.keys().map(|mi| mi.size_estimate(tcx)).sum()); @@ -360,7 +360,7 @@ impl<'tcx> CodegenUnit<'tcx> { WorkProductId::from_cgu_name(&self.name().as_str()) } - pub fn work_product(&self, tcx: TyCtxt<'_, '_, '_>) -> WorkProduct { + pub fn work_product(&self, tcx: TyCtxt<'_, '_>) -> WorkProduct { let work_product_id = self.work_product_id(); tcx.dep_graph .previous_work_product(&work_product_id) @@ -370,7 +370,7 @@ impl<'tcx> CodegenUnit<'tcx> { } pub fn items_in_deterministic_order(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Vec<(MonoItem<'tcx>, (Linkage, Visibility))> { // The codegen tests rely on items being process in the same order as @@ -378,7 +378,7 @@ impl<'tcx> CodegenUnit<'tcx> { #[derive(PartialEq, Eq, PartialOrd, Ord)] pub struct ItemSortKey(Option, SymbolName); - fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey { ItemSortKey(match item { MonoItem::Fn(ref instance) => { @@ -415,7 +415,7 @@ impl<'tcx> CodegenUnit<'tcx> { items } - pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DepNode { + pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DepNode { DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone())) } } @@ -446,12 +446,12 @@ impl<'a, 'tcx> HashStable> for CodegenUnit<'tcx> { } pub struct CodegenUnitNameBuilder<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, cache: FxHashMap, } impl CodegenUnitNameBuilder<'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self { CodegenUnitNameBuilder { tcx, cache: Default::default(), diff --git a/src/librustc/mir/tcx.rs b/src/librustc/mir/tcx.rs index 696bec3e0a2ba..1d5f726567314 100644 --- a/src/librustc/mir/tcx.rs +++ b/src/librustc/mir/tcx.rs @@ -33,7 +33,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// not carry a `Ty` for `T`.) /// /// Note that the resulting type has not been normalized. - pub fn field_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: &Field) -> Ty<'tcx> + pub fn field_ty(self, tcx: TyCtxt<'gcx, 'tcx>, f: &Field) -> Ty<'tcx> { let answer = match self.ty.sty { ty::Adt(adt_def, substs) => { @@ -57,7 +57,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// Convenience wrapper around `projection_ty_core` for /// `PlaceElem`, where we can just use the `Ty` that is already /// stored inline on field projection elems. - pub fn projection_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn projection_ty(self, tcx: TyCtxt<'gcx, 'tcx>, elem: &PlaceElem<'tcx>) -> PlaceTy<'tcx> { @@ -71,7 +71,7 @@ impl<'gcx, 'tcx> PlaceTy<'tcx> { /// (which should be trivial when `T` = `Ty`). pub fn projection_ty_core( self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, elem: &ProjectionElem, mut handle_field: impl FnMut(&Self, &Field, &T) -> Ty<'tcx>) -> PlaceTy<'tcx> @@ -121,7 +121,7 @@ BraceStructTypeFoldableImpl! { } impl<'tcx> Place<'tcx> { - pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PlaceTy<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> PlaceTy<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -141,7 +141,7 @@ pub enum RvalueInitializationState { } impl<'tcx> Rvalue<'tcx> { - pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match *self { @@ -222,7 +222,7 @@ impl<'tcx> Rvalue<'tcx> { } impl<'tcx> Operand<'tcx> { - pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> + pub fn ty<'gcx, D>(&self, local_decls: &D, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> where D: HasLocalDecls<'tcx> { match self { @@ -234,7 +234,7 @@ impl<'tcx> Operand<'tcx> { } impl<'tcx> BinOp { - pub fn ty<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn ty<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, lhs_ty: Ty<'tcx>, rhs_ty: Ty<'tcx>) -> Ty<'tcx> { diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index 480d76b308dee..00a162a31fa56 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -48,11 +48,11 @@ pub struct AutoTraitInfo<'cx> { } pub struct AutoTraitFinder<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl<'tcx> AutoTraitFinder<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Self { AutoTraitFinder { tcx } } @@ -834,11 +834,11 @@ impl AutoTraitFinder<'tcx> { // Replaces all ReVars in a type with ty::Region's, using the provided map pub struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { vid_to_region: &'a FxHashMap>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index cc10107f682d5..469fd6f97666a 100644 --- a/src/librustc/traits/codegen/mod.rs +++ b/src/librustc/traits/codegen/mod.rs @@ -18,7 +18,7 @@ use crate::ty::fold::TypeFoldable; /// that type check should guarantee to us that all nested /// obligations *could be* resolved if we wanted to. /// Assumes that this is run after the entire crate has been successfully type-checked. -pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()> @@ -74,7 +74,7 @@ pub fn codegen_fulfill_obligation<'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Monomorphizes a type from the AST by first applying the /// in-scope substitutions and then normalizing any associated /// types. diff --git a/src/librustc/traits/coherence.rs b/src/librustc/traits/coherence.rs index 763c752ab301f..95e96036b4992 100644 --- a/src/librustc/traits/coherence.rs +++ b/src/librustc/traits/coherence.rs @@ -49,7 +49,7 @@ pub fn add_placeholder_note(err: &mut errors::DiagnosticBuilder<'_>) { /// with a suitably-freshened `ImplHeader` with those types /// substituted. Otherwise, invokes `no_overlap`. pub fn overlapping_impls<'gcx, F1, F2, R>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, impl1_def_id: DefId, impl2_def_id: DefId, intercrate_mode: IntercrateMode, @@ -183,7 +183,7 @@ fn overlap_within_probe( Some(OverlapResult { impl_header, intercrate_ambiguity_causes, involves_placeholder }) } -pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> Option { @@ -229,7 +229,7 @@ pub fn trait_ref_is_knowable<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } } -pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn trait_ref_is_local_or_fundamental<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> bool { trait_ref.def_id.krate == LOCAL_CRATE || tcx.has_attr(trait_ref.def_id, sym::fundamental) @@ -246,7 +246,7 @@ pub enum OrphanCheckErr<'tcx> { /// /// 1. All type parameters in `Self` must be "covered" by some local type constructor. /// 2. Some local type must appear in `Self`. -pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) -> Result<(), OrphanCheckErr<'tcx>> { @@ -353,7 +353,7 @@ pub fn orphan_check<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// /// Note that this function is never called for types that have both type /// parameters and inference variables. -fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, +fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_>, trait_ref: ty::TraitRef<'tcx>, in_crate: InCrate) -> Result<(), OrphanCheckErr<'tcx>> @@ -430,7 +430,7 @@ fn orphan_check_trait_ref<'tcx>(tcx: TyCtxt<'_, '_, '_>, } } -fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'tcx>, in_crate: InCrate) +fn uncovered_tys<'tcx>(tcx: TyCtxt<'_, '_>, ty: Ty<'tcx>, in_crate: InCrate) -> Vec> { if ty_is_local_constructor(ty, in_crate) { vec![] @@ -450,7 +450,7 @@ fn is_possibly_remote_type(ty: Ty<'_>, _in_crate: InCrate) -> bool { } } -fn ty_is_local(tcx: TyCtxt<'_, '_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool { +fn ty_is_local(tcx: TyCtxt<'_, '_>, ty: Ty<'_>, in_crate: InCrate) -> bool { ty_is_local_constructor(ty, in_crate) || fundamental_ty(ty) && ty.walk_shallow().any(|t| ty_is_local(tcx, t, in_crate)) } diff --git a/src/librustc/traits/engine.rs b/src/librustc/traits/engine.rs index 23bbd9192b1cc..e43ca8e7e0acf 100644 --- a/src/librustc/traits/engine.rs +++ b/src/librustc/traits/engine.rs @@ -78,7 +78,7 @@ impl> TraitEngineExt<'tcx> for T { } impl dyn TraitEngine<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Box { + pub fn new(tcx: TyCtxt<'_, 'tcx>) -> Box { if tcx.sess.opts.debugging_opts.chalk { Box::new(ChalkFulfillmentContext::new()) } else { diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 5ed627ccee4bd..50eac8f069058 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -1249,7 +1249,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { found: ty::PolyTraitRef<'tcx>) -> DiagnosticBuilder<'tcx> { - fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn build_fn_sig_string<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: &ty::TraitRef<'tcx>) -> String { let inputs = trait_ref.substs.type_at(1); let sig = if let ty::Tuple(inputs) = inputs.sty { @@ -1294,7 +1294,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn recursive_type_with_infinite_size_error(self, type_def_id: DefId) -> DiagnosticBuilder<'tcx> @@ -1457,7 +1457,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for ParamToVarFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { if let ty::Param(ty::ParamTy {name, .. }) = ty.sty { diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index e6bab57584f43..b478824129909 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -140,7 +140,7 @@ pub struct ObligationCause<'tcx> { } impl<'tcx> ObligationCause<'tcx> { - pub fn span<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Span { + pub fn span<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Span { match self.code { ObligationCauseCode::CompareImplMethodObligation { .. } | ObligationCauseCode::MainFunctionType | @@ -365,7 +365,7 @@ impl<'tcx> DomainGoal<'tcx> { impl<'tcx> GoalKind<'tcx> { pub fn from_poly_domain_goal<'gcx>( domain_goal: PolyDomainGoal<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> GoalKind<'tcx> { match domain_goal.no_bound_vars() { Some(p) => p.into_goal(), @@ -710,7 +710,7 @@ pub fn type_known_to_meet_bound_modulo_regions<'a, 'gcx, 'tcx>( } } -fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, region_context: DefId, cause: ObligationCause<'tcx>, elaborated_env: ty::ParamEnv<'tcx>, @@ -795,7 +795,7 @@ fn do_normalize_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // FIXME: this is gonna need to be removed ... /// Normalizes the parameter environment, reporting errors if they occur. -pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn normalize_param_env_or_error<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, region_context: DefId, unnormalized_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>) @@ -936,7 +936,7 @@ pub fn fully_normalize<'a, 'gcx, 'tcx, T>( /// environment. If this returns false, then either normalize /// encountered an error or one of the predicates did not hold. Used /// when creating vtables to check for unsatisfiable methods. -fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, predicates: Vec>) -> bool { @@ -965,7 +965,7 @@ fn normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, result } -fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, key: (DefId, SubstsRef<'tcx>)) -> bool { @@ -984,7 +984,7 @@ fn substitute_normalize_and_test_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// that come from `trait_ref`, including its supertraits. #[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`. fn vtable_methods<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] { @@ -1207,16 +1207,16 @@ where fn lift_ex_clause_to_tcx<'gcx>( ex_clause: &chalk_engine::ExClause, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option; fn lift_delayed_literal_to_tcx<'gcx>( ex_clause: &chalk_engine::DelayedLiteral, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option; fn lift_literal_to_tcx<'gcx>( ex_clause: &chalk_engine::Literal, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option; } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 6923d1c0230d7..88961c1dc81f1 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -83,7 +83,7 @@ pub enum MethodViolationCode { UndispatchableReceiver, } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Returns the object safety violations that affect /// astconv -- currently, `Self` in supertraits. This is needed @@ -703,7 +703,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } } -pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId) -> bool { tcx.object_safety_violations(trait_def_id).is_empty() } diff --git a/src/librustc/traits/on_unimplemented.rs b/src/librustc/traits/on_unimplemented.rs index e01e5b8b0b903..85af5efb42413 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -35,7 +35,7 @@ impl OnUnimplementedNote { } } -fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span, +fn parse_error(tcx: TyCtxt<'_, '_>, span: Span, message: &str, label: &str, note: Option<&str>) @@ -52,7 +52,7 @@ fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span, } impl<'gcx, 'tcx> OnUnimplementedDirective { - fn parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn parse(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, items: &[NestedMetaItem], span: Span, @@ -133,7 +133,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } - pub fn of_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn of_item(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, impl_def_id: DefId) -> Result, ErrorReported> @@ -165,7 +165,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } pub fn evaluate(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &[(Symbol, Option)]) -> OnUnimplementedNote @@ -215,7 +215,7 @@ impl<'gcx, 'tcx> OnUnimplementedDirective { } impl<'gcx, 'tcx> OnUnimplementedFormatString { - fn try_parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn try_parse(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, from: LocalInternedString, err_sp: Span) @@ -228,7 +228,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString { fn verify( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId, span: Span, ) -> Result<(), ErrorReported> { @@ -274,7 +274,7 @@ impl<'gcx, 'tcx> OnUnimplementedFormatString { pub fn format( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &FxHashMap, ) -> String { diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 45cc8b255aa43..e997e4d9c3183 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -323,7 +323,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> { } impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssocTypeNormalizer<'a, 'b, 'gcx, 'tcx> { - fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'gcx, 'tcx> { self.selcx.tcx() } @@ -836,7 +836,7 @@ struct Progress<'tcx> { } impl<'tcx> Progress<'tcx> { - fn error<'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + fn error<'gcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Self { Progress { ty: tcx.types.err, obligations: vec![], diff --git a/src/librustc/traits/query/dropck_outlives.rs b/src/librustc/traits/query/dropck_outlives.rs index 7fdf3ddceb55b..e2cb5cb89d98a 100644 --- a/src/librustc/traits/query/dropck_outlives.rs +++ b/src/librustc/traits/query/dropck_outlives.rs @@ -87,7 +87,7 @@ pub struct DropckOutlivesResult<'tcx> { impl<'tcx> DropckOutlivesResult<'tcx> { pub fn report_overflows( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, span: Span, ty: Ty<'tcx>, ) { @@ -106,7 +106,7 @@ impl<'tcx> DropckOutlivesResult<'tcx> { pub fn into_kinds_reporting_overflows( self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, span: Span, ty: Ty<'tcx>, ) -> Vec> { @@ -190,7 +190,7 @@ impl_stable_hash_for!(struct DtorckConstraint<'tcx> { /// /// Note also that `needs_drop` requires a "global" type (i.e., one /// with erased regions), but this function does not. -pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>) -> bool { +pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> bool { match ty.sty { // None of these types have a destructor and hence they do not // require anything in particular to outlive the dtor's diff --git a/src/librustc/traits/query/normalize.rs b/src/librustc/traits/query/normalize.rs index 8ee5447ab292a..86067a7c1d801 100644 --- a/src/librustc/traits/query/normalize.rs +++ b/src/librustc/traits/query/normalize.rs @@ -83,7 +83,7 @@ struct QueryNormalizer<'cx, 'gcx: 'tcx, 'tcx: 'cx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx> { - fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/traits/query/normalize_erasing_regions.rs b/src/librustc/traits/query/normalize_erasing_regions.rs index bab6fd542deb0..b9ca0363fc689 100644 --- a/src/librustc/traits/query/normalize_erasing_regions.rs +++ b/src/librustc/traits/query/normalize_erasing_regions.rs @@ -10,7 +10,7 @@ use crate::ty::{self, Ty, TyCtxt}; use crate::ty::fold::{TypeFoldable, TypeFolder}; -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Erase the regions in `value` and then fully normalize all the /// types found within. The result will also have regions erased. /// @@ -63,12 +63,12 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } struct NormalizeAfterErasingRegionsFolder<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, } impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc/traits/query/type_op/ascribe_user_type.rs b/src/librustc/traits/query/type_op/ascribe_user_type.rs index bb6b2272c783d..c663a65659c55 100644 --- a/src/librustc/traits/query/type_op/ascribe_user_type.rs +++ b/src/librustc/traits/query/type_op/ascribe_user_type.rs @@ -25,14 +25,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for AscribeUserType<'tcx> type QueryResponse = (); fn try_fast_path( - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + _tcx: TyCtxt<'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option { None } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_ascribe_user_type(canonicalized) diff --git a/src/librustc/traits/query/type_op/eq.rs b/src/librustc/traits/query/type_op/eq.rs index a8e786809467d..c431178bb2a29 100644 --- a/src/librustc/traits/query/type_op/eq.rs +++ b/src/librustc/traits/query/type_op/eq.rs @@ -18,7 +18,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> { type QueryResponse = (); fn try_fast_path( - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + _tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Eq<'tcx>>, ) -> Option { if key.value.a == key.value.b { @@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Eq<'tcx> { } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_eq(canonicalized) diff --git a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs index 537f6ccee62b7..762e09b03acad 100644 --- a/src/librustc/traits/query/type_op/implied_outlives_bounds.rs +++ b/src/librustc/traits/query/type_op/implied_outlives_bounds.rs @@ -18,14 +18,14 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ImpliedOutlivesBounds< type QueryResponse = Vec>; fn try_fast_path( - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + _tcx: TyCtxt<'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option { None } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { // FIXME this `unchecked_map` is only necessary because the diff --git a/src/librustc/traits/query/type_op/mod.rs b/src/librustc/traits/query/type_op/mod.rs index c1f76eb2f2f28..1553d17e684fa 100644 --- a/src/librustc/traits/query/type_op/mod.rs +++ b/src/librustc/traits/query/type_op/mod.rs @@ -53,7 +53,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: /// actually hits the tcx cache lookup etc. Return `Some(r)` with /// a final result or `None` to do the full path. fn try_fast_path( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option; @@ -64,7 +64,7 @@ pub trait QueryTypeOp<'gcx: 'tcx, 'tcx>: /// bad, because it would create subregion relationships that are /// not captured in the return value. fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible>; diff --git a/src/librustc/traits/query/type_op/normalize.rs b/src/librustc/traits/query/type_op/normalize.rs index 3fc3d9607e777..52a0c6042baf5 100644 --- a/src/librustc/traits/query/type_op/normalize.rs +++ b/src/librustc/traits/query/type_op/normalize.rs @@ -24,7 +24,7 @@ where { type QueryResponse = T; - fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option { + fn try_fast_path(_tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option { if !key.value.value.has_projections() { Some(key.value.value) } else { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { T::type_op_method(tcx, canonicalized) @@ -48,7 +48,7 @@ where pub trait Normalizable<'gcx, 'tcx>: fmt::Debug + TypeFoldable<'tcx> + Lift<'gcx> + Copy { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible>; @@ -64,7 +64,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_ty(canonicalized) @@ -82,7 +82,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_predicate(canonicalized) @@ -100,7 +100,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_poly_fn_sig(canonicalized) @@ -118,7 +118,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize>>, ) -> Fallible> { tcx.type_op_normalize_fn_sig(canonicalized) diff --git a/src/librustc/traits/query/type_op/outlives.rs b/src/librustc/traits/query/type_op/outlives.rs index ee5cd30bde841..56a051e08e716 100644 --- a/src/librustc/traits/query/type_op/outlives.rs +++ b/src/librustc/traits/query/type_op/outlives.rs @@ -22,7 +22,7 @@ where type QueryResponse = DropckOutlivesResult<'tcx>; fn try_fast_path( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option { if trivial_dropck_outlives(tcx, key.value.dropped_ty) { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { // Subtle: note that we are not invoking diff --git a/src/librustc/traits/query/type_op/prove_predicate.rs b/src/librustc/traits/query/type_op/prove_predicate.rs index 6a46ea4057562..64fcc73187cf0 100644 --- a/src/librustc/traits/query/type_op/prove_predicate.rs +++ b/src/librustc/traits/query/type_op/prove_predicate.rs @@ -17,7 +17,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> { type QueryResponse = (); fn try_fast_path( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option { // Proving Sized, very often on "obviously sized" types like @@ -38,7 +38,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for ProvePredicate<'tcx> { } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_prove_predicate(canonicalized) diff --git a/src/librustc/traits/query/type_op/subtype.rs b/src/librustc/traits/query/type_op/subtype.rs index 346af0dd9df07..a2f47211f4828 100644 --- a/src/librustc/traits/query/type_op/subtype.rs +++ b/src/librustc/traits/query/type_op/subtype.rs @@ -20,7 +20,7 @@ impl<'tcx> Subtype<'tcx> { impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> { type QueryResponse = (); - fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> { + fn try_fast_path(_tcx: TyCtxt<'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> { if key.value.sub == key.value.sup { Some(()) } else { @@ -29,7 +29,7 @@ impl<'gcx: 'tcx, 'tcx> super::QueryTypeOp<'gcx, 'tcx> for Subtype<'tcx> { } fn perform_query( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible> { tcx.type_op_subtype(canonicalized) diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index 30270c72d1bd6..57a361d469eff 100644 --- a/src/librustc/traits/select.rs +++ b/src/librustc/traits/select.rs @@ -300,7 +300,7 @@ enum SelectionCandidate<'tcx> { impl<'a, 'tcx> ty::Lift<'tcx> for SelectionCandidate<'a> { type Lifted = SelectionCandidate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { Some(match *self { BuiltinCandidate { has_nested } => BuiltinCandidate { has_nested }, ImplCandidate(def_id) => ImplCandidate(def_id), @@ -568,7 +568,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> { self.infcx } - pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -3989,7 +3989,7 @@ impl WithDepNode { } } - pub fn get(&self, tcx: TyCtxt<'_, '_, '_>) -> T { + pub fn get(&self, tcx: TyCtxt<'_, '_>) -> T { tcx.dep_graph.read_index(self.dep_node); self.cached_value.clone() } diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index 6acee698c8e76..d395f7199fb2c 100644 --- a/src/librustc/traits/specialize/mod.rs +++ b/src/librustc/traits/specialize/mod.rs @@ -110,7 +110,7 @@ pub fn translate_substs<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, /// that impl, a less specialized impl, or the trait default, /// whichever applies. pub fn find_associated_item<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, item: &ty::AssocItem, substs: SubstsRef<'tcx>, @@ -149,7 +149,7 @@ pub fn find_associated_item<'tcx>( /// Specialization is determined by the sets of types to which the impls apply; /// `impl1` specializes `impl2` if it applies to a subset of the types `impl2` applies /// to. -pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn specializes<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, (impl1_def_id, impl2_def_id): (DefId, DefId)) -> bool { @@ -286,7 +286,7 @@ fn fulfill_implication<'a, 'gcx, 'tcx>(infcx: &InferCtxt<'a, 'gcx, 'tcx>, // Query provider for `specialization_graph_of`. pub(super) fn specialization_graph_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_id: DefId, ) -> &'tcx specialization_graph::Graph { let mut sg = specialization_graph::Graph::new(); @@ -390,7 +390,7 @@ pub(super) fn specialization_graph_provider<'tcx>( /// Recovers the "impl X for Y" signature from `impl_def_id` and returns it as a /// string. -fn to_pretty_impl_header(tcx: TyCtxt<'_, '_, '_>, impl_def_id: DefId) -> Option { +fn to_pretty_impl_header(tcx: TyCtxt<'_, '_>, impl_def_id: DefId) -> Option { use std::fmt::Write; let trait_ref = if let Some(tr) = tcx.impl_trait_ref(impl_def_id) { diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 6650cda435d5a..89116fac7303b 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -84,7 +84,7 @@ enum Inserted { impl<'gcx, 'tcx> Children { /// Insert an impl into this set of children without comparing to any existing impls. fn insert_blindly(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); if let Some(sty) = fast_reject::simplify_type(tcx, trait_ref.self_ty(), false) { @@ -100,7 +100,7 @@ impl<'gcx, 'tcx> Children { /// an impl with a parent. The impl must be present in the list of /// children already. fn remove_existing(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let vec: &mut Vec; @@ -119,7 +119,7 @@ impl<'gcx, 'tcx> Children { /// Attempt to insert an impl into this set of children, while comparing for /// specialization relationships. fn insert(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId, simplified_self: Option) -> Result @@ -294,7 +294,7 @@ impl<'gcx, 'tcx> Graph { /// conflicts with it (has overlap, but neither specializes the other), /// information about the area of overlap is returned in the `Err`. pub fn insert(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, impl_def_id: DefId) -> Result, OverlapError> { assert!(impl_def_id.is_local()); @@ -387,7 +387,7 @@ impl<'gcx, 'tcx> Graph { /// Insert cached metadata mapping from a child impl back to its parent. pub fn record_impl_from_cstore(&mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, parent: DefId, child: DefId) { if self.parent.insert(child, parent).is_some() { @@ -425,7 +425,7 @@ impl<'gcx, 'tcx> Node { /// Iterate over the items defined directly by the given (impl or trait) node. pub fn items( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> ty::AssocItemsIterator<'gcx, 'tcx> { tcx.associated_items(self.def_id()) } @@ -482,7 +482,7 @@ impl<'gcx, 'tcx> Ancestors<'gcx> { #[inline] pub fn defs( self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_item_name: Ident, trait_item_kind: ty::AssocKind, trait_def_id: DefId, @@ -508,7 +508,7 @@ impl<'gcx, 'tcx> Ancestors<'gcx> { /// Walk up the specialization ancestors of a given impl, starting with that /// impl itself. -pub fn ancestors(tcx: TyCtxt<'_, 'tcx, '_>, +pub fn ancestors(tcx: TyCtxt<'tcx, '_>, trait_def_id: DefId, start_from_impl: DefId) -> Ancestors<'tcx> { diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index f5853b69e8b7b..e919f0ed2b4d6 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -446,7 +446,7 @@ impl<'tcx> fmt::Display for traits::Clause<'tcx> { impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { type Lifted = traits::SelectionError<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { super::Unimplemented => Some(super::Unimplemented), super::OutputTypeParameterMismatch(a, b, ref err) => { @@ -464,7 +464,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::SelectionError<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { type Lifted = traits::ObligationCauseCode<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { super::ReturnNoExpression => Some(super::ReturnNoExpression), super::MiscObligation => Some(super::MiscObligation), @@ -546,7 +546,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { type Lifted = traits::DerivedObligationCause<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.parent_trait_ref).and_then(|trait_ref| tcx.lift(&*self.parent_code) .map(|code| traits::DerivedObligationCause { @@ -559,7 +559,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::DerivedObligationCause<'a> { impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { type Lifted = traits::ObligationCause<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.code).map(|code| traits::ObligationCause { span: self.span, body_id: self.body_id, @@ -571,7 +571,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCause<'a> { // For codegen only. impl<'a, 'tcx> Lift<'tcx> for traits::Vtable<'a, ()> { type Lifted = traits::Vtable<'tcx, ()>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match self.clone() { traits::VtableImpl(traits::VtableImplData { impl_def_id, @@ -691,7 +691,7 @@ EnumLiftImpl! { impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { type Lifted = traits::Environment<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.clauses).map(|clauses| { traits::Environment { clauses, @@ -702,7 +702,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::Environment<'a> { impl<'a, 'tcx, G: Lift<'tcx>> Lift<'tcx> for traits::InEnvironment<'a, G> { type Lifted = traits::InEnvironment<'tcx, G::Lifted>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.environment).and_then(|environment| { tcx.lift(&self.goal).map(|goal| { traits::InEnvironment { @@ -721,7 +721,7 @@ where { type Lifted = C::LiftedExClause; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { ::lift_ex_clause_to_tcx(self, tcx) } } @@ -733,7 +733,7 @@ where { type Lifted = C::LiftedDelayedLiteral; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { ::lift_delayed_literal_to_tcx(self, tcx) } } @@ -745,7 +745,7 @@ where { type Lifted = C::LiftedLiteral; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { ::lift_literal_to_tcx(self, tcx) } } diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index e77ac75279e33..ef4f6472c87ec 100644 --- a/src/librustc/traits/util.rs +++ b/src/librustc/traits/util.rs @@ -12,7 +12,7 @@ use crate::util::nodemap::FxHashSet; use super::{Obligation, ObligationCause, PredicateObligation, SelectionContext, Normalized}; -fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, pred: &ty::Predicate<'tcx>) -> ty::Predicate<'tcx> { match *pred { @@ -46,12 +46,12 @@ fn anonymize_predicate<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } struct PredicateSet<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, set: FxHashSet>, } impl PredicateSet<'gcx, 'tcx> { - fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self { Self { tcx: tcx, set: Default::default() } } @@ -94,7 +94,7 @@ pub struct Elaborator<'gcx, 'tcx> { } pub fn elaborate_trait_ref<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> Elaborator<'gcx, 'tcx> { @@ -102,7 +102,7 @@ pub fn elaborate_trait_ref<'gcx, 'tcx>( } pub fn elaborate_trait_refs<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_refs: impl Iterator>) -> Elaborator<'gcx, 'tcx> { @@ -111,7 +111,7 @@ pub fn elaborate_trait_refs<'gcx, 'tcx>( } pub fn elaborate_predicates<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, mut predicates: Vec>) -> Elaborator<'gcx, 'tcx> { @@ -256,13 +256,13 @@ impl Iterator for Elaborator<'gcx, 'tcx> { pub type Supertraits<'gcx, 'tcx> = FilterToTraits>; -pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn supertraits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> Supertraits<'gcx, 'tcx> { elaborate_trait_ref(tcx, trait_ref).filter_to_traits() } -pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, bounds: impl Iterator>) -> Supertraits<'gcx, 'tcx> { elaborate_trait_refs(tcx, bounds).filter_to_traits() @@ -281,7 +281,7 @@ pub fn transitive_bounds<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, /// Expansion is done via a DFS (depth-first search), and the `visited` field /// is used to avoid cycles. pub struct TraitAliasExpander<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, stack: Vec>, } @@ -338,7 +338,7 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> { } pub fn expand_trait_aliases<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, trait_refs: impl IntoIterator, Span)> ) -> TraitAliasExpander<'gcx, 'tcx> { let items: Vec<_> = trait_refs @@ -415,12 +415,12 @@ impl<'gcx, 'tcx> Iterator for TraitAliasExpander<'gcx, 'tcx> { /////////////////////////////////////////////////////////////////////////// pub struct SupertraitDefIds<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, stack: Vec, visited: FxHashSet, } -pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn supertrait_def_ids<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, trait_def_id: DefId) -> SupertraitDefIds<'gcx, 'tcx> { @@ -552,7 +552,7 @@ pub fn predicate_for_trait_ref<'tcx>( } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn predicate_for_trait_def(self, param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, diff --git a/src/librustc/ty/_match.rs b/src/librustc/ty/_match.rs index aca22baf7d1a7..38a85c21963ce 100644 --- a/src/librustc/ty/_match.rs +++ b/src/librustc/ty/_match.rs @@ -20,18 +20,18 @@ use crate::mir::interpret::ConstValue; /// important thing about the result is Ok/Err. Also, matching never /// affects any type variables or unification state. pub struct Match<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> } impl Match<'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Match<'gcx, 'tcx> { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Match<'gcx, 'tcx> { Match { tcx } } } impl TypeRelation<'gcx, 'tcx> for Match<'gcx, 'tcx> { fn tag(&self) -> &'static str { "Match" } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn a_is_expected(&self) -> bool { true } // irrelevant fn relate_with_variance>(&mut self, diff --git a/src/librustc/ty/adjustment.rs b/src/librustc/ty/adjustment.rs index bdc5cd3fb330a..d5fe106085160 100644 --- a/src/librustc/ty/adjustment.rs +++ b/src/librustc/ty/adjustment.rs @@ -104,7 +104,7 @@ pub struct OverloadedDeref<'tcx> { } impl<'gcx, 'tcx> OverloadedDeref<'tcx> { - pub fn method_call(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, source: Ty<'tcx>) + pub fn method_call(&self, tcx: TyCtxt<'gcx, 'tcx>, source: Ty<'tcx>) -> (DefId, SubstsRef<'tcx>) { let trait_def_id = match self.mutbl { hir::MutImmutable => tcx.lang_items().deref_trait(), diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index ade084a2135bf..3561a647d5e54 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -108,7 +108,7 @@ pub fn encode_predicates<'tcx, E, C>(encoder: &mut E, } pub trait TyDecoder<'tcx>: Decoder { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; fn peek_byte(&self) -> u8; diff --git a/src/librustc/ty/constness.rs b/src/librustc/ty/constness.rs index fed7caef0d4d2..466cb353c85e4 100644 --- a/src/librustc/ty/constness.rs +++ b/src/librustc/ty/constness.rs @@ -6,7 +6,7 @@ use syntax_pos::symbol::{sym, Symbol}; use crate::hir::map::blocks::FnLikeNode; use syntax::attr; -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Whether the `def_id` counts as const fn in your current crate, considering all active /// feature gates pub fn is_const_fn(self, def_id: DefId) -> bool { @@ -69,7 +69,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { /// only checks whether the function has a `const` modifier - fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { let hir_id = tcx.hir().as_local_hir_id(def_id) .expect("Non-local call to local provider is_const_fn"); @@ -83,7 +83,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) { Some(stab) => { if cfg!(debug_assertions) && stab.promotable { @@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) { } } - fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { + fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.is_const_fn(def_id) && tcx.lookup_stability(def_id) .map(|stab| stab.allow_const_fn_ptr).unwrap_or(false) diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 8212822ba82c7..106637a5b2041 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1016,13 +1016,13 @@ pub struct FreeRegionInfo { /// /// [rustc guide]: https://rust-lang.github.io/rustc-guide/ty.html #[derive(Copy, Clone)] -pub struct TyCtxt<'a, 'gcx: 'tcx, 'tcx: 'a> { +pub struct TyCtxt<'gcx: 'tcx, 'tcx> { gcx: &'gcx GlobalCtxt<'gcx>, interners: &'gcx CtxtInterners<'gcx>, - dummy: PhantomData<(&'a (), &'tcx ())>, + dummy: PhantomData<&'tcx ()>, } -impl<'gcx> Deref for TyCtxt<'_, 'gcx, '_> { +impl<'gcx> Deref for TyCtxt<'gcx, '_> { type Target = &'gcx GlobalCtxt<'gcx>; #[inline(always)] fn deref(&self) -> &Self::Target { @@ -1119,10 +1119,10 @@ pub struct GlobalCtxt<'tcx> { output_filenames: Arc, } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Gets the global `TyCtxt`. #[inline] - pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx, 'gcx> { + pub fn global_tcx(self) -> TyCtxt<'gcx, 'gcx> { TyCtxt { gcx: self.gcx, interners: &self.gcx.global_interners, @@ -1666,7 +1666,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { pub fn encode_metadata(self) -> EncodedMetadata { @@ -1683,7 +1683,7 @@ impl<'gcx> GlobalCtxt<'gcx> { f: F ) -> R where - F: FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R, + F: FnOnce(TyCtxt<'gcx, 'tcx>) -> R, 'gcx: 'tcx, { let tcx = TyCtxt { @@ -1725,7 +1725,7 @@ impl<'gcx> GlobalCtxt<'gcx> { /// e.g., `()` or `u8`, was interned in a different context. pub trait Lift<'tcx>: fmt::Debug { type Lifted: fmt::Debug + 'tcx; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option; + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option; } @@ -1733,7 +1733,7 @@ macro_rules! nop_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for $ty { type Lifted = $lifted; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { if tcx.interners.arena.in_arena(*self as *const _) { return Some(unsafe { mem::transmute(*self) }); } @@ -1752,7 +1752,7 @@ macro_rules! nop_list_lift { ($ty:ty => $lifted:ty) => { impl<'a, 'tcx> Lift<'tcx> for &'a List<$ty> { type Lifted = &'tcx List<$lifted>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { if self.is_empty() { return Some(List::empty()); } @@ -1815,7 +1815,7 @@ pub mod tls { pub struct ImplicitCtxt<'a, 'gcx: 'tcx, 'tcx> { /// The current TyCtxt. Initially created by `enter_global` and updated /// by `enter_local` with a new local interner - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, /// The current query job, if any. This is updated by JobOwner::start in /// ty::query::plumbing when executing a query @@ -1941,7 +1941,7 @@ pub mod tls { /// This happens once per rustc session and TyCtxts only exists /// inside the `f` function. pub fn enter_global<'gcx, F, R>(gcx: &'gcx GlobalCtxt<'gcx>, f: F) -> R - where F: FnOnce(TyCtxt<'gcx, 'gcx, 'gcx>) -> R + where F: FnOnce(TyCtxt<'gcx, 'gcx>) -> R { // Update GCX_PTR to indicate there's a GlobalCtxt available GCX_PTR.with(|lock| { @@ -1978,7 +1978,7 @@ pub mod tls { /// Creates a TyCtxt and ImplicitCtxt based on the GCX_PTR thread local. /// This is used in the deadlock handler. pub unsafe fn with_global(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R + where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R { let gcx = GCX_PTR.with(|lock| *lock.lock()); assert!(gcx != 0); @@ -2030,7 +2030,7 @@ pub mod tls { /// This will panic if you pass it a TyCtxt which has a different global interner from /// the current ImplicitCtxt's tcx field. #[inline] - pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'tcx1, 'gcx, 'tcx1>, f: F) -> R + pub fn with_related_context<'gcx, 'tcx1, F, R>(tcx: TyCtxt<'gcx, 'tcx1>, f: F) -> R where F: for<'b, 'tcx2> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx2>) -> R { with_context(|context| { @@ -2048,7 +2048,7 @@ pub mod tls { /// This will panic if you pass it a TyCtxt which has a different global interner or /// a different local interner from the current ImplicitCtxt's tcx field. #[inline] - pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, f: F) -> R + pub fn with_fully_related_context<'gcx, 'tcx, F, R>(tcx: TyCtxt<'gcx, 'tcx>, f: F) -> R where F: for<'b> FnOnce(&ImplicitCtxt<'b, 'gcx, 'tcx>) -> R { with_context(|context| { @@ -2065,7 +2065,7 @@ pub mod tls { /// Panics if there is no ImplicitCtxt available #[inline] pub fn with(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'tcx, 'gcx, 'tcx>) -> R + where F: for<'gcx, 'tcx> FnOnce(TyCtxt<'gcx, 'tcx>) -> R { with_context(|context| f(context.tcx)) } @@ -2074,7 +2074,7 @@ pub mod tls { /// The closure is passed None if there is no ImplicitCtxt available #[inline] pub fn with_opt(f: F) -> R - where F: for<'gcx, 'tcx> FnOnce(Option>) -> R + where F: for<'gcx, 'tcx> FnOnce(Option>) -> R { with_context_opt(|opt_context| f(opt_context.map(|context| context.tcx))) } @@ -2098,7 +2098,7 @@ macro_rules! sty_debug_print { all_infer: usize, } - pub fn go(tcx: TyCtxt<'_, '_, '_>) { + pub fn go(tcx: TyCtxt<'_, '_>) { let mut total = DebugStat { total: 0, lt_infer: 0, @@ -2151,7 +2151,7 @@ macro_rules! sty_debug_print { }} } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { pub fn print_debug_stats(self) { sty_debug_print!( self, @@ -2290,7 +2290,7 @@ macro_rules! intern_method { $alloc_method:expr, $alloc_to_key:expr, $keep_in_local_tcx:expr) -> $ty:ty) => { - impl<'a, 'gcx, $lt_tcx> TyCtxt<'a, 'gcx, $lt_tcx> { + impl<'gcx, $lt_tcx> TyCtxt<'gcx, $lt_tcx> { pub fn $method(self, v: $alloc) -> &$lt_tcx $ty { let key = ($alloc_to_key)(&v); @@ -2400,7 +2400,7 @@ intern_method! { ) -> List } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Given a `fn` type, returns an equivalent `unsafe fn` type; /// that is, a `fn` type that is equivalent in every way for being /// unsafe. diff --git a/src/librustc/ty/erase_regions.rs b/src/librustc/ty/erase_regions.rs index df189d01a629a..330343c250c66 100644 --- a/src/librustc/ty/erase_regions.rs +++ b/src/librustc/ty/erase_regions.rs @@ -8,13 +8,13 @@ pub(super) fn provide(providers: &mut ty::query::Providers<'_>) { }; } -fn erase_regions_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { +fn erase_regions_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> { // N.B., use `super_fold_with` here. If we used `fold_with`, it // could invoke the `erase_regions_ty` query recursively. ty.super_fold_with(&mut RegionEraserVisitor { tcx }) } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Returns an equivalent value with all free regions removed (note /// that late-bound regions remain, because they are important for /// subtyping, but they are anonymized and normalized as well).. @@ -33,11 +33,11 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } struct RegionEraserVisitor<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl TypeFolder<'gcx, 'tcx> for RegionEraserVisitor<'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/ty/error.rs b/src/librustc/ty/error.rs index 632bbe229de32..000e0854f4e97 100644 --- a/src/librustc/ty/error.rs +++ b/src/librustc/ty/error.rs @@ -184,7 +184,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> { } impl<'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { - pub fn sort_string(&self, tcx: TyCtxt<'lcx, 'gcx, 'lcx>) -> Cow<'static, str> { + pub fn sort_string(&self, tcx: TyCtxt<'gcx, 'lcx>) -> Cow<'static, str> { match self.sty { ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) | ty::Float(_) | ty::Str | ty::Never => self.to_string().into(), @@ -249,7 +249,7 @@ impl<'gcx, 'lcx, 'tcx> ty::TyS<'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn note_and_explain_type_err(self, db: &mut DiagnosticBuilder<'_>, err: &TypeError<'tcx>, diff --git a/src/librustc/ty/fast_reject.rs b/src/librustc/ty/fast_reject.rs index f858c92ff0d0f..238865c866e50 100644 --- a/src/librustc/ty/fast_reject.rs +++ b/src/librustc/ty/fast_reject.rs @@ -55,7 +55,7 @@ pub enum SimplifiedTypeGen /// then we can't say much about whether two types would unify. Put another way, /// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they /// are to be considered bound. -pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub fn simplify_type<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'_>, can_simplify_params: bool) -> Option diff --git a/src/librustc/ty/fold.rs b/src/librustc/ty/fold.rs index 1698d8d3cdd64..00ef9446fb194 100644 --- a/src/librustc/ty/fold.rs +++ b/src/librustc/ty/fold.rs @@ -156,7 +156,7 @@ pub trait TypeFoldable<'tcx>: fmt::Debug + Clone { /// identity fold, it should invoke `foo.fold_with(self)` to fold each /// sub-item. pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx>; fn fold_binder(&mut self, t: &Binder) -> Binder where T : TypeFoldable<'tcx> @@ -203,7 +203,7 @@ pub struct BottomUpFolder<'gcx, 'tcx, F, G, H> G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, pub ty_op: F, pub lt_op: G, pub ct_op: H, @@ -214,7 +214,7 @@ impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx, G: FnMut(ty::Region<'tcx>) -> ty::Region<'tcx>, H: FnMut(&'tcx ty::Const<'tcx>) -> &'tcx ty::Const<'tcx>, { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_ty(&mut self, ty: Ty<'tcx>) -> Ty<'tcx> { let t = ty.super_fold_with(self); @@ -235,7 +235,7 @@ impl<'gcx, 'tcx, F, G, H> TypeFolder<'gcx, 'tcx> for BottomUpFolder<'gcx, 'tcx, /////////////////////////////////////////////////////////////////////////// // Region folder -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Collects the free and escaping regions in `value` into `region_set`. Returns /// whether any late-bound regions were skipped pub fn collect_regions(self, @@ -362,7 +362,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { /// visited by `fld_r`. pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, skipped_regions: &'a mut bool, /// Stores the index of a binder *just outside* the stuff we have @@ -382,7 +382,7 @@ pub struct RegionFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { #[inline] pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, skipped_regions: &'a mut bool, fold_region_fn: &'a mut dyn FnMut(ty::Region<'tcx>, ty::DebruijnIndex) -> ty::Region<'tcx>, ) -> RegionFolder<'a, 'gcx, 'tcx> { @@ -396,7 +396,7 @@ impl<'a, 'gcx, 'tcx> RegionFolder<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -427,7 +427,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> { /// Replaces the escaping bound vars (late bound regions or bound types) in a type. struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, /// As with `RegionFolder`, represents the index of a binder *just outside* /// the ones we have visited. @@ -440,7 +440,7 @@ struct BoundVarReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, fld_r: &'a mut F, fld_t: &'a mut G, fld_c: &'a mut H, @@ -460,7 +460,7 @@ impl<'a, 'gcx, 'tcx> BoundVarReplacer<'a, 'gcx, 'tcx> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -542,7 +542,7 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx> } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Replaces all regions bound by the given `Binder` with the /// results returned by the closure; the closure is expected to /// return a free region (relative to this binder), and hence the @@ -723,14 +723,14 @@ enum Direction { } struct Shifter<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, current_index: ty::DebruijnIndex, amount: u32, direction: Direction, } impl Shifter<'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, amount: u32, direction: Direction) -> Self { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, amount: u32, direction: Direction) -> Self { Shifter { tcx, current_index: ty::INNERMOST, @@ -741,7 +741,7 @@ impl Shifter<'gcx, 'tcx> { } impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.current_index.shift_in(1); @@ -818,7 +818,7 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'gcx, 'tcx> { } pub fn shift_region<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region: ty::Region<'tcx>, amount: u32 ) -> ty::Region<'tcx> { @@ -833,7 +833,7 @@ pub fn shift_region<'gcx, 'tcx>( } pub fn shift_vars<'gcx, 'tcx, T>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, value: &T, amount: u32 ) -> T where T: TypeFoldable<'tcx> { @@ -844,7 +844,7 @@ pub fn shift_vars<'gcx, 'tcx, T>( } pub fn shift_out_vars<'gcx, 'tcx, T>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, value: &T, amount: u32 ) -> T where T: TypeFoldable<'tcx> { diff --git a/src/librustc/ty/inhabitedness/def_id_forest.rs b/src/librustc/ty/inhabitedness/def_id_forest.rs index ebe23b27117f2..0573249e57c9a 100644 --- a/src/librustc/ty/inhabitedness/def_id_forest.rs +++ b/src/librustc/ty/inhabitedness/def_id_forest.rs @@ -32,7 +32,7 @@ impl<'gcx, 'tcx> DefIdForest { /// Creates a forest consisting of a single tree representing the entire /// crate. #[inline] - pub fn full(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest { + pub fn full(tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest { let crate_id = tcx.hir().local_def_id(CRATE_NODE_ID); DefIdForest::from_id(crate_id) } @@ -53,14 +53,14 @@ impl<'gcx, 'tcx> DefIdForest { /// Tests whether the forest contains a given DefId. pub fn contains(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, id: DefId) -> bool { self.root_ids.iter().any(|root_id| tcx.is_descendant_of(id, *root_id)) } /// Calculate the intersection of a collection of forests. - pub fn intersection(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn intersection(tcx: TyCtxt<'gcx, 'tcx>, iter: I) -> DefIdForest where I: IntoIterator { @@ -97,7 +97,7 @@ impl<'gcx, 'tcx> DefIdForest { } /// Calculate the union of a collection of forests. - pub fn union(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn union(tcx: TyCtxt<'gcx, 'tcx>, iter: I) -> DefIdForest where I: IntoIterator { diff --git a/src/librustc/ty/inhabitedness/mod.rs b/src/librustc/ty/inhabitedness/mod.rs index 1c9b06cb6b475..54558fd6561ac 100644 --- a/src/librustc/ty/inhabitedness/mod.rs +++ b/src/librustc/ty/inhabitedness/mod.rs @@ -51,7 +51,7 @@ mod def_id_forest; // This code should only compile in modules where the uninhabitedness of Foo is // visible. -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Checks whether a type is visibly uninhabited from a particular module. /// # Example /// ```rust @@ -110,7 +110,7 @@ impl<'gcx, 'tcx> AdtDef { /// Calculate the forest of DefIds from which this adt is visibly uninhabited. fn uninhabited_from( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> DefIdForest { // Non-exhaustive ADTs from other crates are always considered inhabited. @@ -128,7 +128,7 @@ impl<'gcx, 'tcx> VariantDef { /// Calculate the forest of DefIds from which this variant is visibly uninhabited. pub fn uninhabited_from( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>, adt_kind: AdtKind) -> DefIdForest { @@ -154,7 +154,7 @@ impl<'gcx, 'tcx> FieldDef { /// Calculate the forest of DefIds from which this field is visibly uninhabited. fn uninhabited_from( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>, is_enum: bool, ) -> DefIdForest { @@ -182,7 +182,7 @@ impl<'gcx, 'tcx> FieldDef { impl<'gcx, 'tcx> TyS<'tcx> { /// Calculate the forest of DefIds from which this type is visibly uninhabited. - fn uninhabited_from(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> DefIdForest + fn uninhabited_from(&self, tcx: TyCtxt<'gcx, 'tcx>) -> DefIdForest { match self.sty { Adt(def, substs) => def.uninhabited_from(tcx, substs), diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index 92c64e8614e9a..a48f88220f417 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -44,7 +44,7 @@ pub enum InstanceDef<'tcx> { impl<'tcx> Instance<'tcx> { pub fn ty(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { let ty = tcx.type_of(self.def.def_id()); @@ -55,7 +55,7 @@ impl<'tcx> Instance<'tcx> { ) } - fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> PolyFnSig<'tcx> { + fn fn_sig_noadjust(&self, tcx: TyCtxt<'tcx, 'tcx>) -> PolyFnSig<'tcx> { let ty = self.ty(tcx); match ty.sty { ty::FnDef(..) | @@ -105,7 +105,7 @@ impl<'tcx> Instance<'tcx> { } } - pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { + pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let mut fn_sig = self.fn_sig_noadjust(tcx); if let InstanceDef::VtableShim(..) = self.def { // Modify fn(self, ...) to fn(self: *mut Self, ...) @@ -136,13 +136,13 @@ impl<'tcx> InstanceDef<'tcx> { } #[inline] - pub fn attrs(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::Attributes<'tcx> { + pub fn attrs(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::Attributes<'tcx> { tcx.get_attrs(self.def_id()) } pub fn is_inline( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> ) -> bool { use crate::hir::map::DefPathData; let def_id = match *self { @@ -158,7 +158,7 @@ impl<'tcx> InstanceDef<'tcx> { pub fn requires_local( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> ) -> bool { if self.is_inline(tcx) { return true @@ -218,7 +218,7 @@ impl<'b, 'tcx> Instance<'tcx> { Instance { def: InstanceDef::Item(def_id), substs: substs } } - pub fn mono(tcx: TyCtxt<'b, 'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { + pub fn mono(tcx: TyCtxt<'tcx, 'b>, def_id: DefId) -> Instance<'tcx> { Instance::new(def_id, tcx.global_tcx().empty_substs_for_def_id(def_id)) } @@ -245,7 +245,7 @@ impl<'b, 'tcx> Instance<'tcx> { /// Presuming that coherence and type-check have succeeded, if this method is invoked /// in a monomorphic context (i.e., like during codegen), then it is guaranteed to return /// `Some`. - pub fn resolve(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn resolve(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> Option> { @@ -297,7 +297,7 @@ impl<'b, 'tcx> Instance<'tcx> { result } - pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn resolve_for_vtable(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> Option> { @@ -317,7 +317,7 @@ impl<'b, 'tcx> Instance<'tcx> { } pub fn resolve_closure( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: ty::ClosureSubsts<'tcx>, requested_kind: ty::ClosureKind) @@ -332,7 +332,7 @@ impl<'b, 'tcx> Instance<'tcx> { } pub fn resolve_drop_in_place( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> ty::Instance<'tcx> { @@ -342,7 +342,7 @@ impl<'b, 'tcx> Instance<'tcx> { } pub fn fn_once_adapter_instance( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, closure_did: DefId, substs: ty::ClosureSubsts<'tcx>) -> Instance<'tcx> @@ -377,7 +377,7 @@ impl<'b, 'tcx> Instance<'tcx> { } fn resolve_associated_item<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_item: &ty::AssocItem, param_env: ty::ParamEnv<'tcx>, trait_id: DefId, diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 4c76d36f11c7b..327c430cd396f 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -31,9 +31,9 @@ use rustc_target::abi::call::{ pub trait IntegerExt { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, signed: bool) -> Ty<'tcx>; fn from_attr(cx: &C, ity: attr::IntType) -> Integer; - fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -42,7 +42,7 @@ pub trait IntegerExt { } impl IntegerExt for Integer { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, signed: bool) -> Ty<'tcx> { match (*self, signed) { (I8, false) => tcx.types.u8, (I16, false) => tcx.types.u16, @@ -77,7 +77,7 @@ impl IntegerExt for Integer { /// signed discriminant range and #[repr] attribute. /// N.B.: u128 values above i128::MAX will be treated as signed, but /// that shouldn't affect anything, other than maybe debuginfo. - fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn repr_discr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, repr: &ReprOptions, min: i128, @@ -126,11 +126,11 @@ impl IntegerExt for Integer { } pub trait PrimitiveExt { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx>; + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx>; } impl PrimitiveExt for Primitive { - fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { match *self { Int(i, signed) => i.to_ty(tcx, signed), Float(FloatTy::F32) => tcx.types.f32, @@ -171,7 +171,7 @@ impl<'tcx> fmt::Display for LayoutError<'tcx> { } } -fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn layout_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> Result<&'tcx LayoutDetails, LayoutError<'tcx>> { @@ -226,7 +226,7 @@ enum StructKind { Prefixed(Size, Align), } -impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { fn scalar_pair(&self, a: Scalar, b: Scalar) -> LayoutDetails { let dl = self.data_layout(); let b_align = b.value.align(dl); @@ -1221,7 +1221,7 @@ enum SavedLocalEligibility { // Also included in the layout are the upvars and the discriminant. // These are included as fields on the "outer" layout; they are not part // of any variant. -impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { /// Compute the eligibility and assignment of each local. fn generator_saved_local_eligibility(&self, info: &GeneratorLayout<'tcx>) -> (BitSet, IndexVec) { @@ -1605,7 +1605,7 @@ pub enum SizeSkeleton<'tcx> { impl<'tcx> SizeSkeleton<'tcx> { pub fn compute(ty: Ty<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> Result, LayoutError<'tcx>> { debug_assert!(!ty.has_infer_types()); @@ -1727,21 +1727,21 @@ impl<'tcx> SizeSkeleton<'tcx> { } pub trait HasTyCtxt<'tcx>: HasDataLayout { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx>; } pub trait HasParamEnv<'tcx> { fn param_env(&self) -> ty::ParamEnv<'tcx>; } -impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> HasDataLayout for TyCtxt<'gcx, 'tcx> { fn data_layout(&self) -> &TargetDataLayout { &self.data_layout } } -impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'tcx, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> { +impl<'gcx, 'tcx> HasTyCtxt<'gcx> for TyCtxt<'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> { self.global_tcx() } } @@ -1759,7 +1759,7 @@ impl<'tcx, T: HasDataLayout> HasDataLayout for LayoutCx<'tcx, T> { } impl<'gcx, 'tcx, T: HasTyCtxt<'gcx>> HasTyCtxt<'gcx> for LayoutCx<'tcx, T> { - fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx, 'gcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'gcx> { self.tcx.tcx() } } @@ -1796,7 +1796,7 @@ impl MaybeResult for Result { pub type TyLayout<'tcx> = ::rustc_target::abi::TyLayout<'tcx, Ty<'tcx>>; -impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutOf for LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { type Ty = Ty<'tcx>; type TyLayout = Result, LayoutError<'tcx>>; @@ -1855,7 +1855,7 @@ impl LayoutOf for LayoutCx<'tcx, ty::query::TyCtxtAt<'tcx, 'tcx>> { } // Helper (inherent) `layout_of` methods to avoid pushing `LayoutCx` to users. -impl TyCtxt<'_, 'tcx, '_> { +impl TyCtxt<'tcx, '_> { /// Computes the layout of a type. Note that this implicitly /// executes in "reveal all" mode. #[inline] @@ -2189,7 +2189,7 @@ struct Niche { impl Niche { fn reserve<'tcx>( &self, - cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>>, + cx: &LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>>, count: u128, ) -> Option<(u128, Scalar)> { if count > self.available { @@ -2205,7 +2205,7 @@ impl Niche { } } -impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx, 'tcx>> { +impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx, 'tcx>> { /// Find the offset of a niche leaf field, starting from /// the given type and recursing through aggregates. // FIXME(eddyb) traverse already optimized enums. diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index be19b2d945cbf..76681fe2e8cf4 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -213,7 +213,7 @@ impl AssocItem { } } - pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> String { + pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> String { match self.kind { ty::AssocKind::Method => { // We skip the binder here because the binder would deanonymize all @@ -259,14 +259,14 @@ pub trait DefIdTree: Copy { } } -impl<'gcx, 'tcx> DefIdTree for TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> DefIdTree for TyCtxt<'gcx, 'tcx> { fn parent(self, id: DefId) -> Option { self.def_key(id).parent.map(|index| DefId { index: index, ..id }) } } impl Visibility { - pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_, '_>) -> Self { + pub fn from_hir(visibility: &hir::Visibility, id: hir::HirId, tcx: TyCtxt<'_, '_>) -> Self { match visibility.node { hir::VisibilityKind::Public => Visibility::Public, hir::VisibilityKind::Crate(_) => Visibility::Restricted(DefId::local(CRATE_DEF_INDEX)), @@ -934,7 +934,7 @@ impl<'gcx, 'tcx> Generics { own_counts } - pub fn requires_monomorphization(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { + pub fn requires_monomorphization(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool { if self.own_requires_monomorphization() { return true; } @@ -959,7 +959,7 @@ impl<'gcx, 'tcx> Generics { pub fn region_param(&'tcx self, param: &EarlyBoundRegion, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { @@ -977,7 +977,7 @@ impl<'gcx, 'tcx> Generics { /// Returns the `GenericParamDef` associated with this `ParamTy`. pub fn type_param(&'tcx self, param: &ParamTy, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; @@ -994,7 +994,7 @@ impl<'gcx, 'tcx> Generics { /// Returns the `ConstParameterDef` associated with this `ParamConst`. pub fn const_param(&'tcx self, param: &ParamConst, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + tcx: TyCtxt<'gcx, 'tcx>) -> &GenericParamDef { if let Some(index) = param.index.checked_sub(self.parent_count as u32) { let param = &self.params[index as usize]; @@ -1020,21 +1020,21 @@ impl<'tcx> serialize::UseSpecializedEncodable for GenericPredicates<'tcx> {} impl<'tcx> serialize::UseSpecializedDecodable for GenericPredicates<'tcx> {} impl<'gcx, 'tcx> GenericPredicates<'tcx> { - pub fn instantiate(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) + pub fn instantiate(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_into(tcx, &mut instantiated, substs); instantiated } - pub fn instantiate_own(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, substs: SubstsRef<'tcx>) + pub fn instantiate_own(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: SubstsRef<'tcx>) -> InstantiatedPredicates<'tcx> { InstantiatedPredicates { predicates: self.predicates.iter().map(|(p, _)| p.subst(tcx, substs)).collect(), } } - fn instantiate_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn instantiate_into(&self, tcx: TyCtxt<'gcx, 'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>, substs: SubstsRef<'tcx>) { if let Some(def_id) = self.parent { @@ -1045,14 +1045,14 @@ impl<'gcx, 'tcx> GenericPredicates<'tcx> { ); } - pub fn instantiate_identity(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + pub fn instantiate_identity(&self, tcx: TyCtxt<'gcx, 'tcx>) -> InstantiatedPredicates<'tcx> { let mut instantiated = InstantiatedPredicates::empty(); self.instantiate_identity_into(tcx, &mut instantiated); instantiated } - fn instantiate_identity_into(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn instantiate_identity_into(&self, tcx: TyCtxt<'gcx, 'tcx>, instantiated: &mut InstantiatedPredicates<'tcx>) { if let Some(def_id) = self.parent { tcx.predicates_of(def_id).instantiate_identity_into(tcx, instantiated); @@ -1060,7 +1060,7 @@ impl<'gcx, 'tcx> GenericPredicates<'tcx> { instantiated.predicates.extend(self.predicates.iter().map(|&(p, _)| p)) } - pub fn instantiate_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn instantiate_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>, poly_trait_ref: &ty::PolyTraitRef<'tcx>) -> InstantiatedPredicates<'tcx> { @@ -1134,7 +1134,7 @@ impl<'gcx, 'tcx> Predicate<'tcx> { /// poly-trait-ref holds. This is slightly different from a normal /// substitution in terms of what happens with bound regions. See /// lengthy comment below for details. - pub fn subst_supertrait(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn subst_supertrait(&self, tcx: TyCtxt<'gcx, 'tcx>, trait_ref: &ty::PolyTraitRef<'tcx>) -> ty::Predicate<'tcx> { @@ -1294,7 +1294,7 @@ impl<'tcx> PolyProjectionPredicate<'tcx> { } #[inline] - pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> PolyTraitRef<'tcx> { + pub fn to_poly_trait_ref(&self, tcx: TyCtxt<'_, '_>) -> PolyTraitRef<'tcx> { // Note: unlike with `TraitRef::to_poly_trait_ref()`, // `self.0.trait_ref` is permitted to have escaping regions. // This is because here `self` has a `Binder` and so does our @@ -1856,7 +1856,7 @@ impl<'gcx, 'tcx> VariantDef { /// If someone speeds up attribute loading to not be a performance concern, they can /// remove this hack and use the constructor `DefId` everywhere. pub fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ident: Ident, variant_did: Option, ctor_def_id: Option, @@ -2069,7 +2069,7 @@ impl_stable_hash_for!(struct ReprOptions { }); impl ReprOptions { - pub fn new(tcx: TyCtxt<'_, '_, '_>, did: DefId) -> ReprOptions { + pub fn new(tcx: TyCtxt<'_, '_>, did: DefId) -> ReprOptions { let mut flags = ReprFlags::empty(); let mut size = None; let mut max_align = 0; @@ -2146,7 +2146,7 @@ impl ReprOptions { impl<'gcx, 'tcx> AdtDef { /// Creates a new `AdtDef`. fn new( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, did: DefId, kind: AdtKind, variants: IndexVec, @@ -2286,7 +2286,7 @@ impl<'gcx, 'tcx> AdtDef { } /// Returns `true` if this type has a destructor. - pub fn has_dtor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { + pub fn has_dtor(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool { self.destructor(tcx).is_some() } @@ -2297,7 +2297,7 @@ impl<'gcx, 'tcx> AdtDef { } #[inline] - pub fn predicates(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> { + pub fn predicates(&self, tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx GenericPredicates<'gcx> { tcx.predicates_of(self.did) } @@ -2351,7 +2351,7 @@ impl<'gcx, 'tcx> AdtDef { #[inline] pub fn eval_explicit_discr( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, expr_did: DefId, ) -> Option> { let param_env = ParamEnv::empty(); @@ -2398,7 +2398,7 @@ impl<'gcx, 'tcx> AdtDef { #[inline] pub fn discriminants( &'tcx self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> impl Iterator)> + Captures<'gcx> { let repr_type = self.repr.discr_type(); let initial = repr_type.initial_discriminant(tcx.global_tcx()); @@ -2428,7 +2428,7 @@ impl<'gcx, 'tcx> AdtDef { /// assuming there are no constant-evaluation errors there. #[inline] pub fn discriminant_for_variant(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, variant_index: VariantIdx) -> Discr<'tcx> { let (val, offset) = self.discriminant_def_for_variant(variant_index); @@ -2465,7 +2465,7 @@ impl<'gcx, 'tcx> AdtDef { (expr_did, variant_index.as_u32() - explicit_index) } - pub fn destructor(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + pub fn destructor(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.adt_destructor(self.did) } @@ -2479,12 +2479,12 @@ impl<'gcx, 'tcx> AdtDef { /// /// Due to normalization being eager, this applies even if /// the associated type is behind a pointer (e.g., issue #31299). - pub fn sized_constraint(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { + pub fn sized_constraint(&self, tcx: TyCtxt<'gcx, 'tcx>) -> &'tcx [Ty<'tcx>] { tcx.adt_sized_constraint(self.did).0 } fn sized_constraint_for_ty(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Vec> { let result = match ty.sty { @@ -2564,7 +2564,7 @@ impl<'gcx, 'tcx> AdtDef { } impl<'gcx, 'tcx> FieldDef { - pub fn ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { + pub fn ty(&self, tcx: TyCtxt<'gcx, 'tcx>, subst: SubstsRef<'tcx>) -> Ty<'tcx> { tcx.type_of(self.did).subst(tcx, subst) } } @@ -2590,7 +2590,7 @@ impl<'tcx> ClosureKind { // This is the initial value used when doing upvar inference. pub const LATTICE_BOTTOM: ClosureKind = ClosureKind::Fn; - pub fn trait_did(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> DefId { + pub fn trait_did(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DefId { match *self { ClosureKind::Fn => tcx.require_lang_item(FnTraitLangItem), ClosureKind::FnMut => { @@ -2618,7 +2618,7 @@ impl<'tcx> ClosureKind { /// Returns the representative scalar type for this closure kind. /// See `TyS::to_opt_closure_kind` for more details. - pub fn to_ty(self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(self, tcx: TyCtxt<'_, 'tcx>) -> Ty<'tcx> { match self { ty::ClosureKind::Fn => tcx.types.i8, ty::ClosureKind::FnMut => tcx.types.i16, @@ -2755,7 +2755,7 @@ pub enum ImplOverlapKind { Issue33140 } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn body_tables(self, body: hir::BodyId) -> &'gcx TypeckTables<'gcx> { self.typeck_tables_of(self.hir().body_owner_def_id(body)) } @@ -3116,7 +3116,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } pub struct AssocItemsIterator<'gcx, 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_ids: &'gcx [DefId], next_index: usize, } @@ -3131,7 +3131,7 @@ impl Iterator for AssocItemsIterator<'_, '_> { } } -fn associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> AssocItem { +fn associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> AssocItem { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let parent_id = tcx.hir().get_parent_item(id); let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id); @@ -3176,7 +3176,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]); /// such. /// - a Error, if a type contained itself. The representability /// check should catch this case. -fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> { let def = tcx.adt_def(def_id); @@ -3192,7 +3192,7 @@ fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, AdtSizedConstraint(result) } -fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx [DefId] { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -3217,14 +3217,14 @@ fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn def_span<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Span { +fn def_span<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Span { tcx.hir().span_if_local(def_id).unwrap() } /// If the given `DefId` describes an item belonging to a trait, /// returns the `DefId` of the trait that the trait item belongs to; /// otherwise, returns `None`. -fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { tcx.opt_associated_item(def_id) .and_then(|associated_item| { match associated_item.container { @@ -3235,7 +3235,7 @@ fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option, def_id: DefId) -> Option { +pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Option { if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { if let Node::Item(item) = tcx.hir().get_by_hir_id(hir_id) { if let hir::ItemKind::Existential(ref exist_ty) = item.node { @@ -3247,7 +3247,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> ParamEnv<'tcx> { @@ -3285,26 +3285,26 @@ fn param_env<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause) } -fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> CrateDisambiguator { assert_eq!(crate_num, LOCAL_CRATE); tcx.sess.local_crate_disambiguator() } -fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> Symbol { assert_eq!(crate_num, LOCAL_CRATE); tcx.crate_name.clone() } -fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn crate_hash<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> Svh { assert_eq!(crate_num, LOCAL_CRATE); tcx.hir().crate_hash } -fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance_def: InstanceDef<'tcx>) -> usize { match instance_def { @@ -3321,7 +3321,7 @@ fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`. /// /// See [`ImplOverlapKind::Issue33140`] for more details. -fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option> { diff --git a/src/librustc/ty/outlives.rs b/src/librustc/ty/outlives.rs index 1d80d86e7a82a..c24c0541ad71f 100644 --- a/src/librustc/ty/outlives.rs +++ b/src/librustc/ty/outlives.rs @@ -45,7 +45,7 @@ pub enum Component<'tcx> { EscapingProjection(Vec>), } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Push onto `out` all the things that must outlive `'a` for the condition /// `ty0: 'a` to hold. Note that `ty0` must be a **fully resolved type**. pub fn push_outlives_components(&self, ty0: Ty<'tcx>, diff --git a/src/librustc/ty/print/mod.rs b/src/librustc/ty/print/mod.rs index 9954160396c73..d5bca55c2f1b1 100644 --- a/src/librustc/ty/print/mod.rs +++ b/src/librustc/ty/print/mod.rs @@ -37,7 +37,7 @@ pub trait Printer<'gcx: 'tcx, 'tcx>: Sized { type DynExistential; type Const; - fn tcx(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx(&'a self) -> TyCtxt<'gcx, 'tcx>; fn print_def_path( self, diff --git a/src/librustc/ty/print/obsolete.rs b/src/librustc/ty/print/obsolete.rs index b429539658ff2..a320eb47e6c1c 100644 --- a/src/librustc/ty/print/obsolete.rs +++ b/src/librustc/ty/print/obsolete.rs @@ -17,14 +17,14 @@ use syntax::ast; /// Same as `unique_type_name()` but with the result pushed onto the given /// `output` parameter. pub struct DefPathBasedNames<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, omit_disambiguators: bool, omit_local_crate_name: bool, } impl DefPathBasedNames<'tcx> { pub fn new( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, omit_disambiguators: bool, omit_local_crate_name: bool, ) -> Self { diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index d688202381a5d..d55f1c8983610 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -934,7 +934,7 @@ pub trait PrettyPrinter<'gcx: 'tcx, 'tcx>: pub struct FmtPrinter<'a, 'gcx, 'tcx, F>(Box>); pub struct FmtPrinterData<'a, 'gcx, 'tcx, F> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, fmt: F, empty_path: bool, @@ -963,7 +963,7 @@ impl DerefMut for FmtPrinter<'_, '_, '_, F> { } impl FmtPrinter<'a, 'gcx, 'tcx, F> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, fmt: F, ns: Namespace) -> Self { + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, fmt: F, ns: Namespace) -> Self { FmtPrinter(Box::new(FmtPrinterData { tcx, fmt, @@ -978,7 +978,7 @@ impl FmtPrinter<'a, 'gcx, 'tcx, F> { } } -impl TyCtxt<'_, '_, '_> { +impl TyCtxt<'_, '_> { // HACK(eddyb) get rid of `def_path_str` and/or pass `Namespace` explicitly always // (but also some things just print a `DefId` generally so maybe we need this?) fn guess_def_namespace(self, def_id: DefId) -> Namespace { @@ -1025,7 +1025,7 @@ impl Printer<'gcx, 'tcx> for FmtPrinter<'_, 'gcx, 'tcx, F> { type DynExistential = Self; type Const = Self; - fn tcx(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&'a self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index d6b0951fd0311..c595d37989cb1 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -31,30 +31,30 @@ pub(crate) trait QueryAccessors<'tcx>: QueryConfig<'tcx> { fn query(key: Self::Key) -> Query<'tcx>; // Don't use this method to access query results, instead use the methods on TyCtxt - fn query_cache<'a>(tcx: TyCtxt<'a, 'tcx, '_>) -> &'a Lock>; + fn query_cache<'a>(tcx: TyCtxt<'tcx, '_>) -> &'a Lock>; - fn to_dep_node(tcx: TyCtxt<'_, 'tcx, '_>, key: &Self::Key) -> DepNode; + fn to_dep_node(tcx: TyCtxt<'tcx, '_>, key: &Self::Key) -> DepNode; // Don't use this method to compute query results, instead use the methods on TyCtxt - fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value; + fn compute(tcx: TyCtxt<'tcx, '_>, key: Self::Key) -> Self::Value; fn hash_result( hcx: &mut StableHashingContext<'_>, result: &Self::Value ) -> Option; - fn handle_cycle_error(tcx: TyCtxt<'_, 'tcx, '_>, error: CycleError<'tcx>) -> Self::Value; + fn handle_cycle_error(tcx: TyCtxt<'tcx, '_>, error: CycleError<'tcx>) -> Self::Value; } pub(crate) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { - fn describe(tcx: TyCtxt<'_, '_, '_>, key: Self::Key) -> Cow<'static, str>; + fn describe(tcx: TyCtxt<'_, '_>, key: Self::Key) -> Cow<'static, str>; #[inline] - fn cache_on_disk(_: TyCtxt<'tcx, 'tcx, 'tcx>, _: Self::Key) -> bool { + fn cache_on_disk(_: TyCtxt<'tcx, 'tcx>, _: Self::Key) -> bool { false } - fn try_load_from_disk(_: TyCtxt<'tcx, 'tcx, 'tcx>, + fn try_load_from_disk(_: TyCtxt<'tcx, 'tcx>, _: SerializedDepNodeIndex) -> Option { bug!("QueryDescription::load_from_disk() called for an unsupported query.") @@ -62,7 +62,7 @@ pub(crate) trait QueryDescription<'tcx>: QueryAccessors<'tcx> { } impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M { - default fn describe(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Cow<'static, str> { + default fn describe(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Cow<'static, str> { if !tcx.sess.verbose() { format!("processing `{}`", tcx.def_path_str(def_id)).into() } else { @@ -73,7 +73,7 @@ impl<'tcx, M: QueryAccessors<'tcx, Key=DefId>> QueryDescription<'tcx> for M { } impl<'tcx> QueryDescription<'tcx> for queries::analysis<'tcx> { - fn describe(_tcx: TyCtxt<'_, '_, '_>, _: CrateNum) -> Cow<'static, str> { + fn describe(_tcx: TyCtxt<'_, '_>, _: CrateNum) -> Cow<'static, str> { "running analysis passes on this crate".into() } } @@ -82,12 +82,12 @@ macro_rules! impl_disk_cacheable_query( ($query_name:ident, |$tcx:tt, $key:tt| $cond:expr) => { impl<'tcx> QueryDescription<'tcx> for queries::$query_name<'tcx> { #[inline] - fn cache_on_disk($tcx: TyCtxt<'tcx, 'tcx, 'tcx>, $key: Self::Key) -> bool { + fn cache_on_disk($tcx: TyCtxt<'tcx, 'tcx>, $key: Self::Key) -> bool { $cond } #[inline] - fn try_load_from_disk(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn try_load_from_disk(tcx: TyCtxt<'tcx, 'tcx>, id: SerializedDepNodeIndex) -> Option { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) diff --git a/src/librustc/ty/query/job.rs b/src/librustc/ty/query/job.rs index a595f22bfb323..f8fc2c1012586 100644 --- a/src/librustc/ty/query/job.rs +++ b/src/librustc/ty/query/job.rs @@ -77,7 +77,7 @@ impl<'tcx> QueryJob<'tcx> { #[cfg(parallel_compiler)] pub(super) fn r#await<'lcx>( &self, - tcx: TyCtxt<'lcx, 'tcx, 'lcx>, + tcx: TyCtxt<'tcx, 'lcx>, span: Span, ) -> Result<(), CycleError<'tcx>> { tls::with_related_context(tcx, move |icx| { @@ -102,7 +102,7 @@ impl<'tcx> QueryJob<'tcx> { #[cfg(not(parallel_compiler))] pub(super) fn find_cycle_in_stack<'lcx>( &self, - tcx: TyCtxt<'lcx, 'tcx, 'lcx>, + tcx: TyCtxt<'tcx, 'lcx>, span: Span, ) -> CycleError<'tcx> { // Get the current executing query (waiter) and find the waitee amongst its parents @@ -338,7 +338,7 @@ fn connected_to_root<'tcx>( // Deterministically pick an query from a list #[cfg(parallel_compiler)] fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, queries: &'a [T], f: F ) -> &'a T { @@ -366,7 +366,7 @@ fn pick_query<'a, 'tcx, T, F: Fn(&T) -> (Span, Lrc>)>( fn remove_cycle<'tcx>( jobs: &mut Vec>>, wakelist: &mut Vec>>, - tcx: TyCtxt<'_, 'tcx, '_> + tcx: TyCtxt<'tcx, '_> ) -> bool { let mut visited = FxHashSet::default(); let mut stack = Vec::new(); @@ -505,7 +505,7 @@ pub unsafe fn handle_deadlock() { /// There may be multiple cycles involved in a deadlock, so this searches /// all active queries for cycles before finally resuming all the waiters at once. #[cfg(parallel_compiler)] -fn deadlock(tcx: TyCtxt<'_, '_, '_>, registry: &rayon_core::Registry) { +fn deadlock(tcx: TyCtxt<'_, '_>, registry: &rayon_core::Registry) { let on_panic = OnDrop(|| { eprintln!("deadlock handler panicked, aborting process"); process::abort(); diff --git a/src/librustc/ty/query/keys.rs b/src/librustc/ty/query/keys.rs index 27b0e8e881df9..96a98b45f1f69 100644 --- a/src/librustc/ty/query/keys.rs +++ b/src/librustc/ty/query/keys.rs @@ -22,7 +22,7 @@ pub(super) trait Key: Clone + Hash + Eq + Debug { /// In the event that a cycle occurs, if no explicit span has been /// given for a query with key `self`, what span should we use? - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span; + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span; } impl<'tcx> Key for ty::InstanceDef<'tcx> { @@ -30,7 +30,7 @@ impl<'tcx> Key for ty::InstanceDef<'tcx> { LOCAL_CRATE } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.def_id()) } } @@ -40,7 +40,7 @@ impl<'tcx> Key for ty::Instance<'tcx> { LOCAL_CRATE } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.def_id()) } } @@ -50,7 +50,7 @@ impl<'tcx> Key for mir::interpret::GlobalId<'tcx> { self.instance.query_crate() } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.instance.default_span(tcx) } } @@ -59,7 +59,7 @@ impl Key for CrateNum { fn query_crate(&self) -> CrateNum { *self } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -68,7 +68,7 @@ impl Key for DefIndex { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _tcx: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -77,7 +77,7 @@ impl Key for DefId { fn query_crate(&self) -> CrateNum { self.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(*self) } } @@ -86,7 +86,7 @@ impl Key for (DefId, DefId) { fn query_crate(&self) -> CrateNum { self.0.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.1.default_span(tcx) } } @@ -95,7 +95,7 @@ impl Key for (CrateNum, DefId) { fn query_crate(&self) -> CrateNum { self.0 } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.1.default_span(tcx) } } @@ -104,7 +104,7 @@ impl Key for (DefId, SimplifiedType) { fn query_crate(&self) -> CrateNum { self.0.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.0.default_span(tcx) } } @@ -113,7 +113,7 @@ impl<'tcx> Key for (DefId, SubstsRef<'tcx>) { fn query_crate(&self) -> CrateNum { self.0.krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.0.default_span(tcx) } } @@ -122,7 +122,7 @@ impl<'tcx> Key for (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>) { fn query_crate(&self) -> CrateNum { self.1.def_id().krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.1.def_id()) } } @@ -131,7 +131,7 @@ impl<'tcx> Key for (&'tcx ty::Const<'tcx>, mir::Field) { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -140,7 +140,7 @@ impl<'tcx> Key for ty::PolyTraitRef<'tcx>{ fn query_crate(&self) -> CrateNum { self.def_id().krate } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.def_span(self.def_id()) } } @@ -149,7 +149,7 @@ impl<'tcx> Key for ty::Const<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -158,7 +158,7 @@ impl<'tcx> Key for Ty<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -167,7 +167,7 @@ impl<'tcx> Key for ty::ParamEnv<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -176,7 +176,7 @@ impl<'tcx, T: Key> Key for ty::ParamEnvAnd<'tcx, T> { fn query_crate(&self) -> CrateNum { self.value.query_crate() } - fn default_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, tcx: TyCtxt<'_, '_>) -> Span { self.value.default_span(tcx) } } @@ -185,7 +185,7 @@ impl<'tcx> Key for traits::Environment<'tcx> { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -194,7 +194,7 @@ impl Key for InternedString { fn query_crate(&self) -> CrateNum { LOCAL_CRATE } - fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _tcx: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } @@ -209,7 +209,7 @@ where LOCAL_CRATE } - fn default_span(&self, _tcx: TyCtxt<'_, '_, '_>) -> Span { + fn default_span(&self, _tcx: TyCtxt<'_, '_>) -> Span { DUMMY_SP } } diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 7f8ba215cea2c..71ea4ac772c31 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -157,7 +157,7 @@ impl<'sess> OnDiskCache<'sess> { } pub fn serialize<'tcx, E>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, encoder: &mut E) -> Result<(), E::Error> where E: ty_codec::TyEncoder @@ -314,7 +314,7 @@ impl<'sess> OnDiskCache<'sess> { return Ok(()); - fn sorted_cnums_including_local_crate(tcx: TyCtxt<'_, '_, '_>) -> Vec { + fn sorted_cnums_including_local_crate(tcx: TyCtxt<'_, '_>) -> Vec { let mut cnums = vec![LOCAL_CRATE]; cnums.extend_from_slice(&tcx.crates()[..]); cnums.sort_unstable(); @@ -327,7 +327,7 @@ impl<'sess> OnDiskCache<'sess> { /// Loads a diagnostic emitted during the previous compilation session. pub fn load_diagnostics<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex) -> Vec { let diagnostics: Option = self.load_indexed( @@ -355,7 +355,7 @@ impl<'sess> OnDiskCache<'sess> { /// Returns the cached query result if there is something in the cache for /// the given `SerializedDepNodeIndex`; otherwise returns `None`. pub fn try_load_query_result<'tcx, T>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex) -> Option where T: Decodable @@ -383,7 +383,7 @@ impl<'sess> OnDiskCache<'sess> { } fn load_indexed<'tcx, T>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node_index: SerializedDepNodeIndex, index: &FxHashMap, @@ -423,7 +423,7 @@ impl<'sess> OnDiskCache<'sess> { // current-session-CrateNum. There might be CrateNums from the previous // Session that don't occur in the current one. For these, the mapping // maps to None. - fn compute_cnum_map(tcx: TyCtxt<'_, '_, '_>, + fn compute_cnum_map(tcx: TyCtxt<'_, '_>, prev_cnums: &[(u32, String, CrateDisambiguator)]) -> IndexVec> { @@ -458,7 +458,7 @@ impl<'sess> OnDiskCache<'sess> { /// we use for crate metadata decoding in that it can rebase spans and /// eventually will also handle things that contain `Ty` instances. struct CacheDecoder<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, opaque: opaque::Decoder<'a>, source_map: &'a SourceMap, cnum_map: &'a IndexVec>, @@ -527,7 +527,7 @@ fn decode_tagged<'a, 'tcx, D, T, V>(decoder: &mut D, impl<'a, 'tcx> ty_codec::TyDecoder<'tcx> for CacheDecoder<'a, 'tcx> { #[inline] - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -745,7 +745,7 @@ for CacheDecoder<'a, 'tcx> { //- ENCODING ------------------------------------------------------------------- struct CacheEncoder<'a, 'tcx, E: ty_codec::TyEncoder> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, encoder: &'a mut E, type_shorthands: FxHashMap, usize>, predicate_shorthands: FxHashMap, usize>, @@ -1064,7 +1064,7 @@ impl<'a> SpecializedDecoder for opaque::Decoder<'a> { } } -fn encode_query_results<'a, 'tcx, Q, E>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn encode_query_results<'a, 'tcx, Q, E>(tcx: TyCtxt<'tcx, 'tcx>, encoder: &mut CacheEncoder<'a, 'tcx, E>, query_result_index: &mut EncodedQueryResultIndex) -> Result<(), E::Error> diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index e151f9d111cf7..639aa8e2c34b8 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -105,7 +105,7 @@ impl<'a, 'tcx, Q: QueryDescription<'tcx>> JobOwner<'a, 'tcx, Q> { /// for some compile-time benchmarks. #[inline(always)] pub(super) fn try_get( - tcx: TyCtxt<'a, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, span: Span, key: &Q::Key, ) -> TryGetJob<'a, 'tcx, Q> { @@ -247,7 +247,7 @@ pub(super) enum TryGetJob<'a, 'tcx: 'a, D: QueryDescription<'tcx> + 'a> { Cycle(D::Value), } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { /// Executes a job by changing the ImplicitCtxt to point to the /// new query job while it executes. It returns the diagnostics /// captured during execution and the actual result. @@ -259,7 +259,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { compute: F) -> R where - F: for<'lcx> FnOnce(TyCtxt<'lcx, 'gcx, 'lcx>) -> R + F: for<'lcx> FnOnce(TyCtxt<'gcx, 'lcx>) -> R { // The TyCtxt stored in TLS has the same global interner lifetime // as `self`, so we use `with_related_context` to relate the 'gcx lifetimes @@ -874,7 +874,7 @@ macro_rules! define_queries_inner { } } - pub fn describe(&self, tcx: TyCtxt<'_, '_, '_>) -> Cow<'static, str> { + pub fn describe(&self, tcx: TyCtxt<'_, '_>) -> Cow<'static, str> { let (r, name) = match *self { $(Query::$name(key) => { (queries::$name::describe(tcx, key), stringify!($name)) @@ -888,7 +888,7 @@ macro_rules! define_queries_inner { } // FIXME(eddyb) Get more valid Span's on queries. - pub fn default_span(&self, tcx: TyCtxt<'_, $tcx, '_>, span: Span) -> Span { + pub fn default_span(&self, tcx: TyCtxt<$tcx, '_>, span: Span) -> Span { if !span.is_dummy() { return span; } @@ -954,20 +954,20 @@ macro_rules! define_queries_inner { } #[inline(always)] - fn query_cache<'a>(tcx: TyCtxt<'a, $tcx, '_>) -> &'a Lock> { + fn query_cache<'a>(tcx: TyCtxt<$tcx, '_>) -> &'a Lock> { &tcx.queries.$name } #[allow(unused)] #[inline(always)] - fn to_dep_node(tcx: TyCtxt<'_, $tcx, '_>, key: &Self::Key) -> DepNode { + fn to_dep_node(tcx: TyCtxt<$tcx, '_>, key: &Self::Key) -> DepNode { use crate::dep_graph::DepConstructor::*; DepNode::new(tcx, $node(*key)) } #[inline] - fn compute(tcx: TyCtxt<'_, 'tcx, '_>, key: Self::Key) -> Self::Value { + fn compute(tcx: TyCtxt<'tcx, '_>, key: Self::Key) -> Self::Value { __query_compute::$name(move || { let provider = tcx.queries.providers.get(key.query_crate()) // HACK(eddyb) it's possible crates may be loaded after @@ -988,7 +988,7 @@ macro_rules! define_queries_inner { } fn handle_cycle_error( - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, error: CycleError<'tcx> ) -> Self::Value { handle_cycle_error!([$($modifiers)*][tcx, error]) @@ -997,7 +997,7 @@ macro_rules! define_queries_inner { #[derive(Copy, Clone)] pub struct TyCtxtEnsure<'gcx, 'tcx> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, } impl TyCtxtEnsure<$tcx, 'lcx> { @@ -1010,19 +1010,19 @@ macro_rules! define_queries_inner { #[derive(Copy, Clone)] pub struct TyCtxtAt<'gcx, 'tcx> { - pub tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub tcx: TyCtxt<'gcx, 'tcx>, pub span: Span, } impl Deref for TyCtxtAt<'gcx, 'tcx> { - type Target = TyCtxt<'tcx, 'gcx, 'tcx>; + type Target = TyCtxt<'gcx, 'tcx>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.tcx } } - impl TyCtxt<'lcx, $tcx, 'lcx> { + impl TyCtxt<$tcx, 'lcx> { /// Returns a transparent wrapper for `TyCtxt`, which ensures queries /// are executed instead of just returing their results. #[inline(always)] @@ -1090,12 +1090,12 @@ macro_rules! define_provider_struct { (tcx: $tcx:tt, input: ($(([$($modifiers:tt)*] [$name:ident] [$K:ty] [$R:ty]))*)) => { pub struct Providers<$tcx> { - $(pub $name: fn(TyCtxt<$tcx, $tcx, $tcx>, $K) -> $R,)* + $(pub $name: fn(TyCtxt<$tcx, $tcx>, $K) -> $R,)* } impl<$tcx> Default for Providers<$tcx> { fn default() -> Self { - $(fn $name<$tcx>(_: TyCtxt<$tcx, $tcx, $tcx>, key: $K) -> $R { + $(fn $name<$tcx>(_: TyCtxt<$tcx, $tcx>, key: $K) -> $R { bug!("tcx.{}({:?}) unsupported by its crate", stringify!($name), key); })* @@ -1149,7 +1149,7 @@ macro_rules! define_provider_struct { /// add it to the "We don't have enough information to reconstruct..." group in /// the match below. pub fn force_from_dep_node<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dep_node: &DepNode ) -> bool { use crate::dep_graph::RecoverKey; @@ -1237,7 +1237,7 @@ macro_rules! impl_load_from_cache { impl DepNode { // Check whether the query invocation corresponding to the given // DepNode is eligible for on-disk-caching. - pub fn cache_on_disk(&self, tcx: TyCtxt<'_, '_, '_>) -> bool { + pub fn cache_on_disk(&self, tcx: TyCtxt<'_, '_>) -> bool { use crate::ty::query::queries; use crate::ty::query::QueryDescription; @@ -1255,7 +1255,7 @@ macro_rules! impl_load_from_cache { // above `cache_on_disk` methods returns true. // Also, as a sanity check, it expects that the corresponding query // invocation has been marked as green already. - pub fn load_from_on_disk_cache(&self, tcx: TyCtxt<'_, '_, '_>) { + pub fn load_from_on_disk_cache(&self, tcx: TyCtxt<'_, '_>) { match self.kind { $(DepKind::$dep_kind => { debug_assert!(tcx.dep_graph diff --git a/src/librustc/ty/query/values.rs b/src/librustc/ty/query/values.rs index 016d4792e11ce..5c6b2e172d3c3 100644 --- a/src/librustc/ty/query/values.rs +++ b/src/librustc/ty/query/values.rs @@ -4,36 +4,36 @@ use crate::ty::util::NeedsDrop; use syntax::symbol::InternedString; pub(super) trait Value<'tcx>: Sized { - fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self; + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> Self; } impl<'tcx, T> Value<'tcx> for T { - default fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> T { + default fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> T { tcx.sess.abort_if_errors(); bug!("Value::from_cycle_error called without errors"); } } impl<'tcx> Value<'tcx> for Ty<'tcx> { - fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { tcx.types.err } } impl<'tcx> Value<'tcx> for ty::SymbolName { - fn from_cycle_error(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(_: TyCtxt<'tcx, 'tcx>) -> Self { ty::SymbolName { name: InternedString::intern("") } } } impl<'tcx> Value<'tcx> for NeedsDrop { - fn from_cycle_error(_: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(_: TyCtxt<'tcx, 'tcx>) -> Self { NeedsDrop(false) } } impl<'tcx> Value<'tcx> for AdtSizedConstraint<'tcx> { - fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + fn from_cycle_error(tcx: TyCtxt<'tcx, 'tcx>) -> Self { AdtSizedConstraint(tcx.intern_type_list(&[tcx.types.err])) } } diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 288e203902a14..247f3fea89d15 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -23,7 +23,7 @@ pub enum Cause { } pub trait TypeRelation<'gcx: 'tcx, 'tcx> : Sized { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'gcx, 'tcx>; /// Returns a static string we can use for printouts. fn tag(&self) -> &'static str; diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 8b98bf22cf91a..a6584173fd280 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -337,14 +337,14 @@ CloneTypeFoldableAndLiftImpls! { // FIXME(eddyb) replace all the uses of `Option::map` with `?`. impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>> Lift<'tcx> for (A, B) { type Lifted = (A::Lifted, B::Lifted); - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| tcx.lift(&self.1).map(|b| (a, b))) } } impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) { type Lifted = (A::Lifted, B::Lifted, C::Lifted); - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.0).and_then(|a| { tcx.lift(&self.1).and_then(|b| tcx.lift(&self.2).map(|c| (a, b, c))) }) @@ -353,7 +353,7 @@ impl<'tcx, A: Lift<'tcx>, B: Lift<'tcx>, C: Lift<'tcx>> Lift<'tcx> for (A, B, C) impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { type Lifted = Option; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { Some(ref x) => tcx.lift(x).map(Some), None => Some(None) @@ -363,7 +363,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Option { impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { type Lifted = Result; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { Ok(ref x) => tcx.lift(x).map(Ok), Err(ref e) => tcx.lift(e).map(Err) @@ -373,14 +373,14 @@ impl<'tcx, T: Lift<'tcx>, E: Lift<'tcx>> Lift<'tcx> for Result { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Box { type Lifted = Box; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&**self).map(Box::new) } } impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { type Lifted = Vec; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { // type annotation needed to inform `projection_must_outlive` let mut result : Vec<>::Lifted> = Vec::with_capacity(self.len()); @@ -397,14 +397,14 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for [T] { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for Vec { type Lifted = Vec; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self[..]) } } impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { type Lifted = IndexVec; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { self.iter() .map(|e| tcx.lift(e)) .collect() @@ -413,7 +413,7 @@ impl<'tcx, I: Idx, T: Lift<'tcx>> Lift<'tcx> for IndexVec { impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { type Lifted = ty::TraitRef<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::TraitRef { def_id: self.def_id, substs, @@ -423,7 +423,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { type Lifted = ty::ExistentialTraitRef<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| ty::ExistentialTraitRef { def_id: self.def_id, substs, @@ -433,7 +433,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialTraitRef<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { type Lifted = ty::ExistentialPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match self { ty::ExistentialPredicate::Trait(x) => { tcx.lift(x).map(ty::ExistentialPredicate::Trait) @@ -450,7 +450,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { type Lifted = ty::TraitPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&self.trait_ref).map(|trait_ref| ty::TraitPredicate { trait_ref, @@ -460,7 +460,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::TraitPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { type Lifted = ty::SubtypePredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&(self.a, self.b)).map(|(a, b)| ty::SubtypePredicate { a_is_expected: self.a_is_expected, @@ -472,14 +472,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::SubtypePredicate<'a> { impl<'tcx, A: Copy+Lift<'tcx>, B: Copy+Lift<'tcx>> Lift<'tcx> for ty::OutlivesPredicate { type Lifted = ty::OutlivesPredicate; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&(self.0, self.1)).map(|(a, b)| ty::OutlivesPredicate(a, b)) } } impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { type Lifted = ty::ProjectionTy<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&self.substs).map(|substs| { ty::ProjectionTy { @@ -492,7 +492,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { type Lifted = ty::ProjectionPredicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { tcx.lift(&(self.projection_ty, self.ty)).map(|(projection_ty, ty)| { ty::ProjectionPredicate { @@ -505,7 +505,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionPredicate<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { type Lifted = ty::ExistentialProjection<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ExistentialProjection { substs, @@ -518,7 +518,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ExistentialProjection<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { type Lifted = ty::Predicate<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::Predicate::Trait(ref binder) => { tcx.lift(binder).map(ty::Predicate::Trait) @@ -558,14 +558,14 @@ impl<'a, 'tcx> Lift<'tcx> for ty::Predicate<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::Binder { type Lifted = ty::Binder; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(self.skip_binder()).map(ty::Binder::bind) } } impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { type Lifted = ty::ParamEnv<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.caller_bounds).map(|caller_bounds| { ty::ParamEnv { reveal: self.reveal, @@ -578,7 +578,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ParamEnv<'a> { impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { type Lifted = ty::ParamEnvAnd<'tcx, T::Lifted>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.param_env).and_then(|param_env| { tcx.lift(&self.value).map(|value| { ty::ParamEnvAnd { @@ -592,7 +592,7 @@ impl<'a, 'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::ParamEnvAnd<'a, T> { impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { type Lifted = ty::ClosureSubsts<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::ClosureSubsts { substs } }) @@ -601,7 +601,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ClosureSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { type Lifted = ty::GeneratorSubsts<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.substs).map(|substs| { ty::GeneratorSubsts { substs } }) @@ -610,7 +610,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GeneratorSubsts<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { type Lifted = ty::adjustment::Adjustment<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.kind).and_then(|kind| { tcx.lift(&self.target).map(|target| { ty::adjustment::Adjustment { kind, target } @@ -621,7 +621,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjustment<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { type Lifted = ty::adjustment::Adjust<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::adjustment::Adjust::NeverToAny => Some(ty::adjustment::Adjust::NeverToAny), @@ -639,7 +639,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::Adjust<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { type Lifted = ty::adjustment::OverloadedDeref<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.region).map(|region| { ty::adjustment::OverloadedDeref { region, @@ -651,7 +651,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::OverloadedDeref<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { type Lifted = ty::adjustment::AutoBorrow<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::adjustment::AutoBorrow::Ref(r, m) => { tcx.lift(&r).map(|r| ty::adjustment::AutoBorrow::Ref(r, m)) @@ -665,7 +665,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::adjustment::AutoBorrow<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { type Lifted = ty::GenSig<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&(self.yield_ty, self.return_ty)) .map(|(yield_ty, return_ty)| { ty::GenSig { @@ -678,7 +678,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { type Lifted = ty::FnSig<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.inputs_and_output).map(|x| { ty::FnSig { inputs_and_output: x, @@ -692,7 +692,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::FnSig<'a> { impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { type Lifted = ty::error::ExpectedFound; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { tcx.lift(&self.expected).and_then(|expected| { tcx.lift(&self.found).map(|found| { ty::error::ExpectedFound { @@ -706,7 +706,7 @@ impl<'tcx, T: Lift<'tcx>> Lift<'tcx> for ty::error::ExpectedFound { impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { type Lifted = ty::error::TypeError<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { use crate::ty::error::TypeError::*; Some(match *self { @@ -743,7 +743,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> { impl<'a, 'tcx> Lift<'tcx> for ty::InstanceDef<'a> { type Lifted = ty::InstanceDef<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match *self { ty::InstanceDef::Item(def_id) => Some(ty::InstanceDef::Item(def_id)), diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 248d037fa5edc..5036408af39cc 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -324,7 +324,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// Divides the closure substs into their respective /// components. Single source of truth with respect to the /// ordering. - fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> SplitClosureSubsts<'tcx> { + fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> SplitClosureSubsts<'tcx> { let generics = tcx.generics_of(def_id); let parent_len = generics.parent_count; SplitClosureSubsts { @@ -335,7 +335,7 @@ impl<'tcx> ClosureSubsts<'tcx> { } #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> + pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> impl Iterator> + 'tcx { let SplitClosureSubsts { upvar_kinds, .. } = self.split(def_id, tcx); @@ -351,7 +351,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// Returns the closure kind for this closure; may return a type /// variable during inference. To get the closure kind during /// inference, use `infcx.closure_kind(def_id, substs)`. - pub fn closure_kind_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn closure_kind_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).closure_kind_ty } @@ -359,7 +359,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// closure; may contain type variables during inference. To get /// the closure signature during inference, use /// `infcx.fn_sig(def_id)`. - pub fn closure_sig_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn closure_sig_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).closure_sig_ty } @@ -368,7 +368,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// there are no type variables. /// /// If you have an inference context, use `infcx.closure_kind()`. - pub fn closure_kind(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::ClosureKind { + pub fn closure_kind(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx>) -> ty::ClosureKind { self.split(def_id, tcx).closure_kind_ty.to_opt_closure_kind().unwrap() } @@ -377,7 +377,7 @@ impl<'tcx> ClosureSubsts<'tcx> { /// there are no type variables. /// /// If you have an inference context, use `infcx.closure_sig()`. - pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { + pub fn closure_sig(self, def_id: DefId, tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let ty = self.closure_sig_ty(def_id, tcx); match ty.sty { ty::FnPtr(sig) => sig, @@ -401,7 +401,7 @@ struct SplitGeneratorSubsts<'tcx> { } impl<'tcx> GeneratorSubsts<'tcx> { - fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> SplitGeneratorSubsts<'tcx> { + fn split(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> SplitGeneratorSubsts<'tcx> { let generics = tcx.generics_of(def_id); let parent_len = generics.parent_count; SplitGeneratorSubsts { @@ -417,12 +417,12 @@ impl<'tcx> GeneratorSubsts<'tcx> { /// It contains a tuple of all the types that could end up on a generator frame. /// The state transformation MIR pass may only produce layouts which mention types /// in this tuple. Upvars are not counted here. - pub fn witness(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn witness(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).witness } #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> + pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> impl Iterator> + 'tcx { let SplitGeneratorSubsts { upvar_kinds, .. } = self.split(def_id, tcx); @@ -436,12 +436,12 @@ impl<'tcx> GeneratorSubsts<'tcx> { } /// Returns the type representing the yield type of the generator. - pub fn yield_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn yield_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).yield_ty } /// Returns the type representing the return type of the generator. - pub fn return_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> Ty<'tcx> { + pub fn return_ty(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> Ty<'tcx> { self.split(def_id, tcx).return_ty } @@ -451,13 +451,13 @@ impl<'tcx> GeneratorSubsts<'tcx> { /// N.B., some bits of the code prefers to see this wrapped in a /// binder, but it never contains bound regions. Probably this /// function should be removed. - pub fn poly_sig(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> PolyGenSig<'tcx> { + pub fn poly_sig(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> PolyGenSig<'tcx> { ty::Binder::dummy(self.sig(def_id, tcx)) } /// Returns the "generator signature", which consists of its yield /// and return types. - pub fn sig(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> GenSig<'tcx> { + pub fn sig(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> GenSig<'tcx> { ty::GenSig { yield_ty: self.yield_ty(def_id, tcx), return_ty: self.return_ty(def_id, tcx), @@ -479,7 +479,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The valid variant indices of this Generator. #[inline] - pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Range { + pub fn variant_range(&self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> Range { // FIXME requires optimized MIR let num_variants = tcx.generator_layout(def_id).variant_fields.len(); (VariantIdx::new(0)..VariantIdx::new(num_variants)) @@ -489,7 +489,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// out of range. #[inline] pub fn discriminant_for_variant( - &self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, variant_index: VariantIdx + &self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>, variant_index: VariantIdx ) -> Discr<'tcx> { // Generators don't support explicit discriminant values, so they are // the same as the variant index. @@ -501,7 +501,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// variant indices. #[inline] pub fn discriminants( - &'tcx self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx> + &'tcx self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx> ) -> impl Iterator)> + Captures<'gcx> { self.variant_range(def_id, tcx).map(move |index| { (index, Discr { val: index.as_usize() as u128, ty: self.discr_ty(tcx) }) @@ -522,7 +522,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The type of the state discriminant used in the generator type. #[inline] - pub fn discr_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn discr_ty(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { tcx.types.u32 } @@ -533,7 +533,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// The locals are grouped by their variant number. Note that some locals may /// be repeated in multiple variants. #[inline] - pub fn state_tys(self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> + pub fn state_tys(self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> impl Iterator> + Captures<'gcx>> { let layout = tcx.generator_layout(def_id); @@ -547,7 +547,7 @@ impl<'gcx, 'tcx> GeneratorSubsts<'tcx> { /// This is the types of the fields of a generator which are not stored in a /// variant. #[inline] - pub fn prefix_tys(self, def_id: DefId, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> + pub fn prefix_tys(self, def_id: DefId, tcx: TyCtxt<'gcx, 'tcx>) -> impl Iterator> { self.upvar_tys(def_id, tcx) @@ -562,7 +562,7 @@ pub enum UpvarSubsts<'tcx> { impl<'tcx> UpvarSubsts<'tcx> { #[inline] - pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_, '_>) -> + pub fn upvar_tys(self, def_id: DefId, tcx: TyCtxt<'_, '_>) -> impl Iterator> + 'tcx { let upvar_kinds = match self { @@ -593,7 +593,7 @@ pub enum ExistentialPredicate<'tcx> { impl<'gcx, 'tcx> ExistentialPredicate<'tcx> { /// Compares via an ordering that will not change if modules are reordered or other changes are /// made to the tree. In particular, this ordering is preserved across incremental compilations. - pub fn stable_cmp(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, other: &Self) -> Ordering { + pub fn stable_cmp(&self, tcx: TyCtxt<'gcx, 'tcx>, other: &Self) -> Ordering { use self::ExistentialPredicate::*; match (*self, *other) { (Trait(_), Trait(_)) => Ordering::Equal, @@ -611,7 +611,7 @@ impl<'gcx, 'tcx> ExistentialPredicate<'tcx> { } impl<'gcx, 'tcx> Binder> { - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::Predicate<'tcx> { use crate::ty::ToPredicate; match *self.skip_binder() { @@ -744,7 +744,7 @@ impl<'tcx> TraitRef<'tcx> { /// Returns a `TraitRef` of the form `P0: Foo` where `Pi` /// are the parameters defined on trait. - pub fn identity<'gcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { + pub fn identity<'gcx>(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId) -> TraitRef<'tcx> { TraitRef { def_id, substs: InternalSubsts::identity_for_item(tcx, def_id), @@ -764,7 +764,7 @@ impl<'tcx> TraitRef<'tcx> { self.substs.types() } - pub fn from_method(tcx: TyCtxt<'tcx, '_, 'tcx>, + pub fn from_method(tcx: TyCtxt<'_, 'tcx>, trait_id: DefId, substs: SubstsRef<'tcx>) -> ty::TraitRef<'tcx> { @@ -817,7 +817,7 @@ impl<'gcx, 'tcx> ExistentialTraitRef<'tcx> { self.substs.types() } - pub fn erase_self_ty(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn erase_self_ty(tcx: TyCtxt<'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> ty::ExistentialTraitRef<'tcx> { // Assert there is a Self. @@ -833,7 +833,7 @@ impl<'gcx, 'tcx> ExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::TraitRef<'tcx> { // otherwise the escaping vars would be captured by the binder // debug_assert!(!self_ty.has_escaping_bound_vars()); @@ -856,7 +856,7 @@ impl<'tcx> PolyExistentialTraitRef<'tcx> { /// we convert the principal trait-ref into a normal trait-ref, /// you must give *some* self type. A common choice is `mk_err()` /// or some placeholder type. - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, + pub fn with_self_ty(&self, tcx: TyCtxt<'_, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyTraitRef<'tcx> { self.map_bound(|trait_ref| trait_ref.with_self_ty(tcx, self_ty)) @@ -992,7 +992,7 @@ impl<'tcx> ProjectionTy<'tcx> { /// Construct a `ProjectionTy` by searching the trait from `trait_ref` for the /// associated item named `item_name`. pub fn from_ref_and_name( - tcx: TyCtxt<'_, '_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident + tcx: TyCtxt<'_, '_>, trait_ref: ty::TraitRef<'tcx>, item_name: Ident ) -> ProjectionTy<'tcx> { let item_def_id = tcx.associated_items(trait_ref.def_id).find(|item| { item.kind == ty::AssocKind::Type && @@ -1008,7 +1008,7 @@ impl<'tcx> ProjectionTy<'tcx> { /// Extracts the underlying trait reference from this projection. /// For example, if this is a projection of `::Item`, /// then this function would return a `T: Iterator` trait reference. - pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::TraitRef<'tcx> { + pub fn trait_ref(&self, tcx: TyCtxt<'_, '_>) -> ty::TraitRef<'tcx> { let def_id = tcx.associated_item(self.item_def_id).container.id(); ty::TraitRef { def_id, @@ -1125,7 +1125,7 @@ impl<'gcx, 'tcx> ParamTy { ParamTy::new(def.index, def.name) } - pub fn to_ty(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn to_ty(self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { tcx.mk_ty_param(self.index, self.name) } @@ -1153,7 +1153,7 @@ impl<'gcx, 'tcx> ParamConst { ParamConst::new(def.index, def.name) } - pub fn to_const(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx Const<'tcx> { + pub fn to_const(self, tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx Const<'tcx> { tcx.mk_const_param(self.index, self.name, ty) } } @@ -1413,7 +1413,7 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { /// For example, if this is a projection of `exists T. ::Item == X`, /// then this function would return a `exists T. T: Iterator` existential trait /// reference. - pub fn trait_ref(&self, tcx: TyCtxt<'_, '_, '_>) -> ty::ExistentialTraitRef<'tcx> { + pub fn trait_ref(&self, tcx: TyCtxt<'_, '_>) -> ty::ExistentialTraitRef<'tcx> { let def_id = tcx.associated_item(self.item_def_id).container.id(); ty::ExistentialTraitRef{ def_id, @@ -1421,7 +1421,7 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { } } - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::ProjectionPredicate<'tcx> { @@ -1439,7 +1439,7 @@ impl<'tcx, 'gcx> ExistentialProjection<'tcx> { } impl<'tcx, 'gcx> PolyExistentialProjection<'tcx> { - pub fn with_self_ty(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, self_ty: Ty<'tcx>) + pub fn with_self_ty(&self, tcx: TyCtxt<'gcx, 'tcx>, self_ty: Ty<'tcx>) -> ty::PolyProjectionPredicate<'tcx> { self.map_bound(|p| p.with_self_ty(tcx, self_ty)) } @@ -1652,7 +1652,7 @@ impl RegionKind { /// of the impl, and for all the other highlighted regions, it /// would return the `DefId` of the function. In other cases (not shown), this /// function might return the `DefId` of a closure. - pub fn free_region_binding_scope(&self, tcx: TyCtxt<'_, '_, '_>) -> DefId { + pub fn free_region_binding_scope(&self, tcx: TyCtxt<'_, '_>) -> DefId { match self { ty::ReEarlyBound(br) => { tcx.parent(br.def_id).unwrap() @@ -1687,7 +1687,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { /// `ty.conservative_is_privately_uninhabited` implies that any value of type `ty` /// will be `Abi::Uninhabited`. (Note that uninhabited types may have nonzero /// size, to account for partial initialisation. See #49298 for details.) - pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { + pub fn conservative_is_privately_uninhabited(&self, tcx: TyCtxt<'gcx, 'tcx>) -> bool { // FIXME(varkor): we can make this less conversative by substituting concrete // type arguments. match self.sty { @@ -1799,7 +1799,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn sequence_element_type(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn sequence_element_type(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { Array(ty, _) | Slice(ty) => ty, Str => tcx.mk_mach_uint(ast::UintTy::U8), @@ -1807,7 +1807,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn simd_type(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + pub fn simd_type(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match self.sty { Adt(def, substs) => { def.non_enum_variant().fields[0].ty(tcx, substs) @@ -1816,7 +1816,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn simd_size(&self, _cx: TyCtxt<'_, '_, '_>) -> usize { + pub fn simd_size(&self, _cx: TyCtxt<'_, '_>) -> usize { match self.sty { Adt(def, _) => def.non_enum_variant().fields.len(), _ => bug!("simd_size called on invalid type") @@ -2036,7 +2036,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { } } - pub fn fn_sig(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> PolyFnSig<'tcx> { + pub fn fn_sig(&self, tcx: TyCtxt<'gcx, 'tcx>) -> PolyFnSig<'tcx> { match self.sty { FnDef(def_id, substs) => { tcx.fn_sig(def_id).subst(tcx, substs) @@ -2084,7 +2084,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { /// If the type contains variants, returns the valid range of variant indices. /// FIXME This requires the optimized MIR in the case of generators. #[inline] - pub fn variant_range(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option> { + pub fn variant_range(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option> { match self.sty { TyKind::Adt(adt, _) => Some(adt.variant_range()), TyKind::Generator(def_id, substs, _) => Some(substs.variant_range(def_id, tcx)), @@ -2098,7 +2098,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { #[inline] pub fn discriminant_for_variant( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, variant_index: VariantIdx ) -> Option> { match self.sty { @@ -2189,7 +2189,7 @@ impl<'gcx, 'tcx> TyS<'tcx> { /// /// Returning true means the type is known to be sized. Returning /// `false` means nothing -- could be sized, might not be. - pub fn is_trivially_sized(&self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> bool { + pub fn is_trivially_sized(&self, tcx: TyCtxt<'_, 'tcx>) -> bool { match self.sty { ty::Infer(ty::IntVar(_)) | ty::Infer(ty::FloatVar(_)) | ty::Uint(_) | ty::Int(_) | ty::Bool | ty::Float(_) | @@ -2240,7 +2240,7 @@ static_assert_size!(Const<'_>, 40); impl<'tcx> Const<'tcx> { #[inline] pub fn from_scalar( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, val: Scalar, ty: Ty<'tcx>, ) -> &'tcx Self { @@ -2252,7 +2252,7 @@ impl<'tcx> Const<'tcx> { #[inline] pub fn from_bits( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, bits: u128, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> &'tcx Self { @@ -2264,24 +2264,24 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn zero_sized(tcx: TyCtxt<'tcx, '_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self { + pub fn zero_sized(tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>) -> &'tcx Self { Self::from_scalar(tcx, Scalar::zst(), ty) } #[inline] - pub fn from_bool(tcx: TyCtxt<'tcx, '_, 'tcx>, v: bool) -> &'tcx Self { + pub fn from_bool(tcx: TyCtxt<'_, 'tcx>, v: bool) -> &'tcx Self { Self::from_bits(tcx, v as u128, ParamEnv::empty().and(tcx.types.bool)) } #[inline] - pub fn from_usize(tcx: TyCtxt<'tcx, '_, 'tcx>, n: u64) -> &'tcx Self { + pub fn from_usize(tcx: TyCtxt<'_, 'tcx>, n: u64) -> &'tcx Self { Self::from_bits(tcx, n as u128, ParamEnv::empty().and(tcx.types.usize)) } #[inline] pub fn to_bits( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Option { if self.ty != ty.value { @@ -2300,7 +2300,7 @@ impl<'tcx> Const<'tcx> { #[inline] pub fn assert_bits( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Option { assert_eq!(self.ty, ty.value); @@ -2310,7 +2310,7 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn assert_bool(&self, tcx: TyCtxt<'_, '_, '_>) -> Option { + pub fn assert_bool(&self, tcx: TyCtxt<'_, '_>) -> Option { self.assert_bits(tcx, ParamEnv::empty().and(tcx.types.bool)).and_then(|v| match v { 0 => Some(false), 1 => Some(true), @@ -2319,14 +2319,14 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn assert_usize(&self, tcx: TyCtxt<'_, '_, '_>) -> Option { + pub fn assert_usize(&self, tcx: TyCtxt<'_, '_>) -> Option { self.assert_bits(tcx, ParamEnv::empty().and(tcx.types.usize)).map(|v| v as u64) } #[inline] pub fn unwrap_bits( &self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, ty: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> u128 { self.assert_bits(tcx, ty).unwrap_or_else(|| @@ -2334,7 +2334,7 @@ impl<'tcx> Const<'tcx> { } #[inline] - pub fn unwrap_usize(&self, tcx: TyCtxt<'_, '_, '_>) -> u64 { + pub fn unwrap_usize(&self, tcx: TyCtxt<'_, '_>) -> u64 { self.assert_usize(tcx).unwrap_or_else(|| bug!("expected constant usize, got {:#?}", self)) } diff --git a/src/librustc/ty/subst.rs b/src/librustc/ty/subst.rs index 276a2592ac7af..60579bcf3a5b4 100644 --- a/src/librustc/ty/subst.rs +++ b/src/librustc/ty/subst.rs @@ -138,7 +138,7 @@ impl<'tcx> Kind<'tcx> { impl<'a, 'tcx> Lift<'tcx> for Kind<'a> { type Lifted = Kind<'tcx>; - fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option { + fn lift_to_tcx<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Option { match self.unpack() { UnpackedKind::Lifetime(lt) => tcx.lift(<).map(|lt| lt.into()), UnpackedKind::Type(ty) => tcx.lift(&ty).map(|ty| ty.into()), @@ -184,7 +184,7 @@ pub type SubstsRef<'tcx> = &'tcx InternalSubsts<'tcx>; impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// Creates a `InternalSubsts` that maps each generic parameter to itself. - pub fn identity_for_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { + pub fn identity_for_item(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId) -> SubstsRef<'tcx> { Self::for_item(tcx, def_id, |param, _| { tcx.mk_param_from_def(param) }) @@ -195,7 +195,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// the type parameter index. For regions, we use the `BoundRegion::BrNamed` /// variant (which has a `DefId`). pub fn bound_vars_for_item( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId ) -> SubstsRef<'tcx> { Self::for_item(tcx, def_id, |param, _| { @@ -233,7 +233,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// The closures get to observe the `InternalSubsts` as they're /// being built, which can be used to correctly /// substitute defaults of generic parameters. - pub fn for_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn for_item(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) -> SubstsRef<'tcx> @@ -247,7 +247,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { } pub fn extend_to(&self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, mut mk_kind: F) -> SubstsRef<'tcx> @@ -261,7 +261,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { } fn fill_item(substs: &mut SmallVec<[Kind<'tcx>; 8]>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, defs: &ty::Generics, mk_kind: &mut F) where F: FnMut(&ty::GenericParamDef, &[Kind<'tcx>]) -> Kind<'tcx> @@ -372,7 +372,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { /// in a different item, with `target_substs` as the base for /// the target impl/trait, with the source child-specific /// parameters (e.g., method parameters) on top of that base. - pub fn rebase_onto(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn rebase_onto(&self, tcx: TyCtxt<'gcx, 'tcx>, source_ancestor: DefId, target_substs: SubstsRef<'tcx>) -> SubstsRef<'tcx> { @@ -380,7 +380,7 @@ impl<'a, 'gcx, 'tcx> InternalSubsts<'tcx> { tcx.mk_substs(target_substs.iter().chain(&self[defs.params.len()..]).cloned()) } - pub fn truncate_to(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, generics: &ty::Generics) + pub fn truncate_to(&self, tcx: TyCtxt<'gcx, 'tcx>, generics: &ty::Generics) -> SubstsRef<'tcx> { tcx.mk_substs(self.iter().take(generics.count()).cloned()) } @@ -414,19 +414,19 @@ impl<'tcx> serialize::UseSpecializedDecodable for SubstsRef<'tcx> {} // there is more information available (for better errors). pub trait Subst<'tcx>: Sized { - fn subst<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: &[Kind<'tcx>]) -> Self { self.subst_spanned(tcx, substs, None) } - fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> Self; } impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { - fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + fn subst_spanned<'gcx>(&self, tcx: TyCtxt<'gcx, 'tcx>, substs: &[Kind<'tcx>], span: Option) -> T @@ -445,7 +445,7 @@ impl<'tcx, T:TypeFoldable<'tcx>> Subst<'tcx> for T { // The actual substitution engine itself is a type folder. struct SubstFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, substs: &'a [Kind<'tcx>], /// The location for which the substitution is performed, if available. @@ -462,7 +462,7 @@ struct SubstFolder<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn fold_binder>(&mut self, t: &ty::Binder) -> ty::Binder { self.binders_passed += 1; diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index b7a4199067224..9c82082f8f5c7 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -64,14 +64,14 @@ impl<'gcx, 'tcx> TraitDef { } } - pub fn ancestors(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn ancestors(&self, tcx: TyCtxt<'gcx, 'tcx>, of_impl: DefId) -> specialization_graph::Ancestors<'gcx> { specialization_graph::ancestors(tcx, self.def_id, of_impl) } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn for_each_impl(self, def_id: DefId, mut f: F) { let impls = self.trait_impls_of(def_id); @@ -148,7 +148,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } // Query provider for `trait_impls_of`. -pub(super) fn trait_impls_of_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub(super) fn trait_impls_of_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_id: DefId) -> &'tcx TraitImpls { let mut impls = TraitImpls::default(); diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index a9b2dbe1d95b0..a88b3eaa586a3 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -51,10 +51,10 @@ impl<'tcx> fmt::Display for Discr<'tcx> { impl<'tcx> Discr<'tcx> { /// Adds `1` to the value and wraps around if the maximum for the type is reached. - pub fn wrap_incr<'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + pub fn wrap_incr<'gcx>(self, tcx: TyCtxt<'gcx, 'tcx>) -> Self { self.checked_add(tcx, 1).0 } - pub fn checked_add<'gcx>(self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, n: u128) -> (Self, bool) { + pub fn checked_add<'gcx>(self, tcx: TyCtxt<'gcx, 'tcx>, n: u128) -> (Self, bool) { let (int, signed) = match self.ty.sty { Int(ity) => (Integer::from_attr(&tcx, SignedInt(ity)), true), Uint(uty) => (Integer::from_attr(&tcx, UnsignedInt(uty)), false), @@ -104,14 +104,14 @@ impl<'tcx> Discr<'tcx> { } pub trait IntTypeExt { - fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx>; - fn disr_incr<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, val: Option>) + fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx>; + fn disr_incr<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, val: Option>) -> Option>; - fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx>; + fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Discr<'tcx>; } impl IntTypeExt for attr::IntType { - fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Ty<'tcx> { + fn to_ty<'gcx, 'tcx>(&self, tcx: TyCtxt<'gcx, 'tcx>) -> Ty<'tcx> { match *self { SignedInt(ast::IntTy::I8) => tcx.types.i8, SignedInt(ast::IntTy::I16) => tcx.types.i16, @@ -128,7 +128,7 @@ impl IntTypeExt for attr::IntType { } } - fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Discr<'tcx> { + fn initial_discriminant<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Discr<'tcx> { Discr { val: 0, ty: self.to_ty(tcx) @@ -137,7 +137,7 @@ impl IntTypeExt for attr::IntType { fn disr_incr<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, val: Option>, ) -> Option> { if let Some(val) = val { @@ -179,7 +179,7 @@ pub enum Representability { impl<'tcx> ty::ParamEnv<'tcx> { pub fn can_type_implement_copy(self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, self_type: Ty<'tcx>) -> Result<(), CopyImplementationError<'tcx>> { // FIXME: (@jroesch) float this code up @@ -228,7 +228,7 @@ impl<'tcx> ty::ParamEnv<'tcx> { } } -impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { +impl<'tcx> TyCtxt<'tcx, 'tcx> { /// Creates a hash of the type `Ty` which will be the same no matter what crate /// context it's calculated within. This is used by the `type_id` intrinsic. pub fn type_id_hash(self, ty: Ty<'tcx>) -> u64 { @@ -249,7 +249,7 @@ impl<'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { } } -impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { +impl<'gcx, 'tcx> TyCtxt<'gcx, 'tcx> { pub fn has_error_field(self, ty: Ty<'tcx>) -> bool { if let ty::Adt(def, substs) = ty.sty { for field in def.all_fields() { @@ -632,7 +632,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { seen_opaque_tys: FxHashSet, primary_def_id: DefId, found_recursion: bool, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl<'gcx, 'tcx> OpaqueTypeExpander<'gcx, 'tcx> { @@ -659,7 +659,7 @@ impl<'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { } impl<'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for OpaqueTypeExpander<'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -696,7 +696,7 @@ impl<'tcx> ty::TyS<'tcx> { /// full requirements for the `Copy` trait (cc #29149) -- this /// winds up being reported as an error during NLL borrow check. pub fn is_copy_modulo_regions(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, span: Span) -> bool { @@ -724,7 +724,7 @@ impl<'tcx> ty::TyS<'tcx> { /// that the `Freeze` trait is not exposed to end users and is /// effectively an implementation detail. pub fn is_freeze(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, span: Span)-> bool { @@ -739,7 +739,7 @@ impl<'tcx> ty::TyS<'tcx> { /// then `needs_drop` will definitely return `true` for `ty`.) #[inline] pub fn needs_drop(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>) -> bool { tcx.needs_drop_raw(param_env.and(self)).0 @@ -761,7 +761,7 @@ impl<'tcx> ty::TyS<'tcx> { /// Check whether a type is representable. This means it cannot contain unboxed /// structural recursion. This check is needed for structs and enums. pub fn is_representable(&'tcx self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span) -> Representability { @@ -779,7 +779,7 @@ impl<'tcx> ty::TyS<'tcx> { } fn are_inner_types_recursive<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, ty: Ty<'tcx>) @@ -839,7 +839,7 @@ impl<'tcx> ty::TyS<'tcx> { // Does the type `ty` directly (without indirection through a pointer) // contain any types on stack `seen`? fn is_type_structurally_recursive<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, @@ -860,7 +860,7 @@ impl<'tcx> ty::TyS<'tcx> { } fn is_type_structurally_recursive_inner<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, sp: Span, seen: &mut Vec>, representable_cache: &mut FxHashMap, Representability>, @@ -937,7 +937,7 @@ impl<'tcx> ty::TyS<'tcx> { } } -fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -953,7 +953,7 @@ fn is_copy_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, )) } -fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -969,7 +969,7 @@ fn is_sized_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, )) } -fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> bool { @@ -988,7 +988,7 @@ fn is_freeze_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, #[derive(Clone, HashStable)] pub struct NeedsDrop(pub bool); -fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn needs_drop_raw<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, query: ty::ParamEnvAnd<'tcx, Ty<'tcx>>) -> NeedsDrop { diff --git a/src/librustc/ty/wf.rs b/src/librustc/ty/wf.rs index 3bd0ddce5d271..f0378b2e084df 100644 --- a/src/librustc/ty/wf.rs +++ b/src/librustc/ty/wf.rs @@ -509,7 +509,7 @@ impl<'a, 'gcx, 'tcx> WfPredicates<'a, 'gcx, 'tcx> { /// `'static` would appear in the list. The hard work is done by /// `ty::required_region_bounds`, see that for more information. pub fn object_region_bounds<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, existential_predicates: ty::Binder<&'tcx ty::List>>) -> Vec> { diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index d76178d7eac68..94219650a8e82 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -229,7 +229,7 @@ fn compatible_borrow_kinds(borrow_kind1: ty::BorrowKind, } impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.bccx.tcx } + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.bccx.tcx } pub fn each_issued_loan(&self, node: hir::ItemLocalId, mut op: F) -> bool where F: FnMut(&Loan<'tcx>) -> bool, diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 6d79a08608928..7a8a62edea1a3 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -45,7 +45,7 @@ pub enum PatternSource<'tcx> { /// /// In this latter case, this function will return `PatternSource::LetDecl` /// with a reference to the let -fn get_pattern_source<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { +fn get_pattern_source<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, pat: &Pat) -> PatternSource<'tcx> { let parent = tcx.hir().get_parent_node_by_hir_id(pat.hir_id); diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 08b8894ac89e4..8bdfa1352cbe0 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -251,7 +251,7 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, } impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.bccx.tcx } + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.bccx.tcx } /// Guarantees that `cmt` is assignable, or reports an error. fn guarantee_assignment_valid(&mut self, diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 00626c2f2b91c..aa94e100f334f 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -53,7 +53,7 @@ pub struct LoanDataFlowOperator; pub type LoanDataFlow<'tcx> = DataFlowContext<'tcx, LoanDataFlowOperator>; -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().borrowck(body_owner_def_id); }); @@ -73,7 +73,7 @@ pub struct AnalysisData<'tcx> { pub move_data: move_data::FlowedMoveData<'tcx>, } -fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, owner_def_id: DefId) +fn borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, owner_def_id: DefId) -> &'tcx BorrowCheckResult { assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck()); @@ -193,7 +193,7 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc /// Accessor for introspective clients inspecting `AnalysisData` and /// the `BorrowckCtxt` itself , e.g., the flowgraph visualizer. pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body_id: hir::BodyId, cfg: &cfg::CFG) -> (BorrowckCtxt<'a, 'tcx>, AnalysisData<'tcx>) @@ -221,7 +221,7 @@ pub fn build_borrowck_dataflow_data_for_fn<'a, 'tcx>( // Type definitions pub struct BorrowckCtxt<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // tables for the current thing we are checking; set to // Some in `borrowck_fn` and cleared later @@ -391,7 +391,7 @@ pub enum LoanPathElem<'tcx> { } fn closure_to_block(closure_id: LocalDefId, - tcx: TyCtxt<'_, '_, '_>) -> HirId { + tcx: TyCtxt<'_, '_>) -> HirId { let closure_id = tcx.hir().local_def_id_to_node_id(closure_id); match tcx.hir().get(closure_id) { Node::Expr(expr) => match expr.node { diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 2dbc02253992c..81d5a49a805c9 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -223,7 +223,7 @@ impl MoveData<'tcx> { /// Returns the existing move path index for `lp`, if any, and otherwise adds a new index for /// `lp` and any of its base paths that do not yet have an index. - pub fn move_path(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn move_path(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>) -> MovePathIndex { if let Some(&index) = self.path_map.borrow().get(&lp) { return index; @@ -311,7 +311,7 @@ impl MoveData<'tcx> { } /// Adds a new move entry for a move of `lp` that occurs at location `id` with kind `kind`. - pub fn add_move(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn add_move(&self, tcx: TyCtxt<'tcx, 'tcx>, orig_lp: Rc>, id: hir::ItemLocalId, kind: MoveKind) { @@ -340,7 +340,7 @@ impl MoveData<'tcx> { self.add_move_helper(tcx, orig_lp, id, kind); } - fn add_move_helper(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn add_move_helper(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>, id: hir::ItemLocalId, kind: MoveKind) { @@ -365,7 +365,7 @@ impl MoveData<'tcx> { /// Adds a new record for an assignment to `lp` that occurs at location `id` with the given /// `span`. - pub fn add_assignment(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn add_assignment(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>, assign_id: hir::ItemLocalId, span: Span) { @@ -395,7 +395,7 @@ impl MoveData<'tcx> { self.add_assignment_helper(tcx, lp, assign_id, span); } - fn add_assignment_helper(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn add_assignment_helper(&self, tcx: TyCtxt<'tcx, 'tcx>, lp: Rc>, assign_id: hir::ItemLocalId, span: Span) { diff --git a/src/librustc_borrowck/dataflow.rs b/src/librustc_borrowck/dataflow.rs index 037f1120d96b4..4e49fa57cb99c 100644 --- a/src/librustc_borrowck/dataflow.rs +++ b/src/librustc_borrowck/dataflow.rs @@ -27,7 +27,7 @@ pub enum EntryOrExit { #[derive(Clone)] pub struct DataFlowContext<'tcx, O> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, /// a name for the analysis using this dataflow instance analysis_name: &'static str, @@ -225,7 +225,7 @@ pub enum KillFrom { } impl<'tcx, O: DataFlowOperator> DataFlowContext<'tcx, O> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, analysis_name: &'static str, body: Option<&hir::Body>, cfg: &cfg::CFG, diff --git a/src/librustc_codegen_llvm/allocator.rs b/src/librustc_codegen_llvm/allocator.rs index 1fe020561dde1..27ec939dd2933 100644 --- a/src/librustc_codegen_llvm/allocator.rs +++ b/src/librustc_codegen_llvm/allocator.rs @@ -9,7 +9,7 @@ use rustc_allocator::{ALLOCATOR_METHODS, AllocatorTy}; use crate::ModuleLlvm; use crate::llvm::{self, False, True}; -pub(crate) unsafe fn codegen(tcx: TyCtxt<'_, '_, '_>, mods: &mut ModuleLlvm, kind: AllocatorKind) { +pub(crate) unsafe fn codegen(tcx: TyCtxt<'_, '_>, mods: &mut ModuleLlvm, kind: AllocatorKind) { let llcx = &*mods.llcx; let llmod = mods.llmod(); let usize = match &tcx.sess.target.target.target_pointer_width[..] { diff --git a/src/librustc_codegen_llvm/attributes.rs b/src/librustc_codegen_llvm/attributes.rs index 9d0e7dde34d13..f68f3de118574 100644 --- a/src/librustc_codegen_llvm/attributes.rs +++ b/src/librustc_codegen_llvm/attributes.rs @@ -367,7 +367,7 @@ pub fn provide_extern(providers: &mut Providers<'_>) { }; } -fn wasm_import_module(tcx: TyCtxt<'_, '_, '_>, id: DefId) -> Option { +fn wasm_import_module(tcx: TyCtxt<'_, '_>, id: DefId) -> Option { tcx.wasm_import_module_map(id.krate) .get(&id) .map(|s| CString::new(&s[..]).unwrap()) diff --git a/src/librustc_codegen_llvm/back/write.rs b/src/librustc_codegen_llvm/back/write.rs index d8a9f681639a0..6f3f9d4cb8b55 100644 --- a/src/librustc_codegen_llvm/back/write.rs +++ b/src/librustc_codegen_llvm/back/write.rs @@ -89,7 +89,7 @@ pub fn create_informational_target_machine( } pub fn create_target_machine( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, find_features: bool, ) -> &'static mut llvm::TargetMachine { target_machine_factory(&tcx.sess, tcx.backend_optimization_level(LOCAL_CRATE), find_features)() diff --git a/src/librustc_codegen_llvm/base.rs b/src/librustc_codegen_llvm/base.rs index fd8ef55c77f3c..60c141ab566da 100644 --- a/src/librustc_codegen_llvm/base.rs +++ b/src/librustc_codegen_llvm/base.rs @@ -42,7 +42,7 @@ use rustc::hir::CodegenFnAttrs; use crate::value::Value; pub fn write_compressed_metadata<'a, 'gcx>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut ModuleLlvm ) { @@ -103,7 +103,7 @@ pub fn iter_globals(llmod: &'ll llvm::Module) -> ValueIter<'ll> { } } -pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedString) { +pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString) { let start_time = Instant::now(); let dep_node = tcx.codegen_unit(cgu_name).codegen_dep_node(tcx); @@ -124,7 +124,7 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, cgu_name: InternedStr submit_codegened_module_to_llvm(&LlvmCodegenBackend(()), tcx, module, cost); fn module_codegen<'ll, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString, ) -> ModuleCodegen { let cgu = tcx.codegen_unit(cgu_name); diff --git a/src/librustc_codegen_llvm/builder.rs b/src/librustc_codegen_llvm/builder.rs index af28f43a74f26..28e27535a39ad 100644 --- a/src/librustc_codegen_llvm/builder.rs +++ b/src/librustc_codegen_llvm/builder.rs @@ -66,7 +66,7 @@ impl ty::layout::HasDataLayout for Builder<'_, '_, '_> { } impl ty::layout::HasTyCtxt<'tcx> for Builder<'_, '_, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.cx.tcx } } diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs index ca91814c45bf8..e3126d0e25d5a 100644 --- a/src/librustc_codegen_llvm/context.rs +++ b/src/librustc_codegen_llvm/context.rs @@ -35,7 +35,7 @@ use crate::abi::Abi; /// `llvm::Context` so that several compilation units may be optimized in parallel. /// All other LLVM data structures in the `CodegenCx` are tied to that `llvm::Context`. pub struct CodegenCx<'ll, 'tcx: 'll> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub check_overflow: bool, pub use_dll_storage_attrs: bool, pub tls_model: llvm::ThreadLocalMode, @@ -141,7 +141,7 @@ pub fn is_pie_binary(sess: &Session) -> bool { } pub unsafe fn create_module( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, llcx: &'ll llvm::Context, mod_name: &str, ) -> &'ll llvm::Module { @@ -207,7 +207,7 @@ pub unsafe fn create_module( } impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { - crate fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + crate fn new(tcx: TyCtxt<'tcx, 'tcx>, codegen_unit: Arc>, llvm_module: &'ll crate::ModuleLlvm) -> Self { @@ -838,7 +838,7 @@ impl HasTargetSpec for CodegenCx<'ll, 'tcx> { } impl ty::layout::HasTyCtxt<'tcx> for CodegenCx<'ll, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 42bd790ca2e9c..4fad236c32dd3 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -894,7 +894,7 @@ fn pointer_type_metadata( } } -pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_, '_>, +pub fn compile_unit_metadata(tcx: TyCtxt<'_, '_>, codegen_unit_name: &str, debug_context: &CrateDebugContext<'ll, '_>) -> &'ll DIDescriptor { diff --git a/src/librustc_codegen_llvm/lib.rs b/src/librustc_codegen_llvm/lib.rs index 89c24c624a249..17a6fe090b905 100644 --- a/src/librustc_codegen_llvm/lib.rs +++ b/src/librustc_codegen_llvm/lib.rs @@ -103,13 +103,13 @@ mod va_arg; pub struct LlvmCodegenBackend(()); impl ExtraBackendMethods for LlvmCodegenBackend { - fn new_metadata(&self, tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> ModuleLlvm { + fn new_metadata(&self, tcx: TyCtxt<'_, '_>, mod_name: &str) -> ModuleLlvm { ModuleLlvm::new_metadata(tcx, mod_name) } fn write_compressed_metadata<'b, 'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut ModuleLlvm ) { @@ -117,7 +117,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { } fn codegen_allocator<'b, 'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, mods: &mut ModuleLlvm, kind: AllocatorKind ) { @@ -125,7 +125,7 @@ impl ExtraBackendMethods for LlvmCodegenBackend { } fn compile_codegen_unit<'a, 'tcx: 'a>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString, ) { base::compile_codegen_unit(tcx, cgu_name); @@ -286,7 +286,7 @@ impl CodegenBackend for LlvmCodegenBackend { fn codegen_crate<'b, 'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> @@ -365,7 +365,7 @@ unsafe impl Send for ModuleLlvm { } unsafe impl Sync for ModuleLlvm { } impl ModuleLlvm { - fn new(tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self { + fn new(tcx: TyCtxt<'_, '_>, mod_name: &str) -> Self { unsafe { let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names()); let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _; @@ -377,7 +377,7 @@ impl ModuleLlvm { } } - fn new_metadata(tcx: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self { + fn new_metadata(tcx: TyCtxt<'_, '_>, mod_name: &str) -> Self { unsafe { let llcx = llvm::LLVMRustContextCreate(tcx.sess.fewer_names()); let llmod_raw = context::create_module(tcx, llcx, mod_name) as *const _; diff --git a/src/librustc_codegen_ssa/back/linker.rs b/src/librustc_codegen_ssa/back/linker.rs index 926f4febe7bae..260c07a7b6287 100644 --- a/src/librustc_codegen_ssa/back/linker.rs +++ b/src/librustc_codegen_ssa/back/linker.rs @@ -25,7 +25,7 @@ pub struct LinkerInfo { } impl LinkerInfo { - pub fn new(tcx: TyCtxt<'_, '_, '_>) -> LinkerInfo { + pub fn new(tcx: TyCtxt<'_, '_>) -> LinkerInfo { LinkerInfo { exports: tcx.sess.crate_types.borrow().iter().map(|&c| { (c, exported_symbols(tcx, c)) @@ -1012,7 +1012,7 @@ impl<'a> Linker for WasmLd<'a> { } } -fn exported_symbols(tcx: TyCtxt<'_, '_, '_>, crate_type: CrateType) -> Vec { +fn exported_symbols(tcx: TyCtxt<'_, '_>, crate_type: CrateType) -> Vec { if let Some(ref exports) = tcx.sess.target.target.options.override_export_symbols { return exports.clone() } diff --git a/src/librustc_codegen_ssa/back/symbol_export.rs b/src/librustc_codegen_ssa/back/symbol_export.rs index 8d6652d05df5f..e805cb0003f05 100644 --- a/src/librustc_codegen_ssa/back/symbol_export.rs +++ b/src/librustc_codegen_ssa/back/symbol_export.rs @@ -21,7 +21,7 @@ pub type ExportedSymbols = FxHashMap< Arc>, >; -pub fn threshold(tcx: TyCtxt<'_, '_, '_>) -> SymbolExportLevel { +pub fn threshold(tcx: TyCtxt<'_, '_>) -> SymbolExportLevel { crates_export_threshold(&tcx.sess.crate_types.borrow()) } @@ -46,7 +46,7 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor } } -fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap { @@ -157,7 +157,7 @@ fn reachable_non_generics_provider<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tcx.arena.alloc(reachable_non_generics) } -fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { let export_threshold = threshold(tcx); @@ -169,13 +169,13 @@ fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.reachable_non_generics(def_id.krate).contains_key(&def_id) } -fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> Arc, SymbolExportLevel)>> @@ -279,7 +279,7 @@ fn exported_symbols_provider_local<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn upstream_monomorphizations_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx DefIdMap, CrateNum>> { @@ -329,7 +329,7 @@ fn upstream_monomorphizations_provider<'tcx>( } fn upstream_monomorphizations_for_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option<&'tcx FxHashMap, CrateNum>> { @@ -337,7 +337,7 @@ fn upstream_monomorphizations_for_provider<'tcx>( tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id) } -fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> bool { +fn is_unreachable_local_definition_provider(tcx: TyCtxt<'_, '_>, def_id: DefId) -> bool { if let Some(hir_id) = tcx.hir().as_local_hir_id(def_id) { !tcx.reachable_set(LOCAL_CRATE).0.contains(&hir_id) } else { @@ -359,7 +359,7 @@ pub fn provide_extern(providers: &mut Providers<'_>) { providers.upstream_monomorphizations_for = upstream_monomorphizations_for_provider; } -fn symbol_export_level(tcx: TyCtxt<'_, '_, '_>, sym_def_id: DefId) -> SymbolExportLevel { +fn symbol_export_level(tcx: TyCtxt<'_, '_>, sym_def_id: DefId) -> SymbolExportLevel { // We export anything that's not mangled at the "C" layer as it probably has // to do with ABI concerns. We do not, however, apply such treatment to // special symbols in the standard library for various plumbing between diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index 5abff2d8ec350..894884e19c3fd 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -375,7 +375,7 @@ fn need_pre_lto_bitcode_for_incr_comp(sess: &Session) -> bool { pub fn start_async_codegen( backend: B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, metadata: EncodedMetadata, coordinator_receive: Receiver>, total_cgus: usize @@ -996,7 +996,7 @@ enum MainThreadWorkerState { fn start_executing_work( backend: B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, crate_info: &CrateInfo, shared_emitter: SharedEmitter, codegen_worker_send: Sender>, @@ -1862,7 +1862,7 @@ impl OngoingCodegen { } pub fn submit_pre_codegened_module_to_llvm(&self, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: ModuleCodegen) { self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); @@ -1872,7 +1872,7 @@ impl OngoingCodegen { submit_codegened_module_to_llvm(&self.backend, tcx, module, cost); } - pub fn codegen_finished(&self, tcx: TyCtxt<'_, '_, '_>) { + pub fn codegen_finished(&self, tcx: TyCtxt<'_, '_>) { self.wait_for_signal_to_codegen_item(); self.check_for_errors(tcx.sess); drop(self.coordinator_send.send(Box::new(Message::CodegenComplete::))); @@ -1911,7 +1911,7 @@ impl OngoingCodegen { pub fn submit_codegened_module_to_llvm( _backend: &B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: ModuleCodegen, cost: u64 ) { @@ -1924,7 +1924,7 @@ pub fn submit_codegened_module_to_llvm( pub fn submit_post_lto_module_to_llvm( _backend: &B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: CachedModuleCodegen ) { let llvm_work_item = WorkItem::CopyPostLtoArtifacts(module); @@ -1936,7 +1936,7 @@ pub fn submit_post_lto_module_to_llvm( pub fn submit_pre_lto_module_to_llvm( _backend: &B, - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, module: CachedModuleCodegen ) { let filename = pre_lto_bitcode_filename(&module.name); @@ -1961,7 +1961,7 @@ pub fn pre_lto_bitcode_filename(module_name: &str) -> String { format!("{}.{}", module_name, PRE_LTO_BC_EXT) } -fn msvc_imps_needed(tcx: TyCtxt<'_, '_, '_>) -> bool { +fn msvc_imps_needed(tcx: TyCtxt<'_, '_>) -> bool { // This should never be true (because it's not supported). If it is true, // something is wrong with commandline arg validation. assert!(!(tcx.sess.opts.cg.linker_plugin_lto.enabled() && diff --git a/src/librustc_codegen_ssa/base.rs b/src/librustc_codegen_ssa/base.rs index b80f01467af0b..517d19c56a565 100644 --- a/src/librustc_codegen_ssa/base.rs +++ b/src/librustc_codegen_ssa/base.rs @@ -480,7 +480,7 @@ pub const CODEGEN_WORKER_ID: usize = ::std::usize::MAX; pub fn codegen_crate( backend: B, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> @@ -703,7 +703,7 @@ impl Drop for AbortCodegenOnDrop { } } -fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { time(tcx.sess, "assert dep graph", || ::rustc_incremental::assert_dep_graph(tcx)); @@ -714,7 +714,7 @@ fn assert_and_save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } impl CrateInfo { - pub fn new(tcx: TyCtxt<'_, '_, '_>) -> CrateInfo { + pub fn new(tcx: TyCtxt<'_, '_>) -> CrateInfo { let mut info = CrateInfo { panic_runtime: None, compiler_builtins: None, @@ -780,7 +780,7 @@ impl CrateInfo { } } -fn is_codegened_item(tcx: TyCtxt<'_, '_, '_>, id: DefId) -> bool { +fn is_codegened_item(tcx: TyCtxt<'_, '_>, id: DefId) -> bool { let (all_mono_items, _) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); all_mono_items.contains(&id) @@ -850,7 +850,7 @@ pub fn provide_both(providers: &mut Providers<'_>) { }; } -fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn determine_cgu_reuse<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cgu: &CodegenUnit<'tcx>) -> CguReuse { if !tcx.dep_graph.is_fully_enabled() { diff --git a/src/librustc_codegen_ssa/common.rs b/src/librustc_codegen_ssa/common.rs index 0e1885fe29ba6..82af0049affc9 100644 --- a/src/librustc_codegen_ssa/common.rs +++ b/src/librustc_codegen_ssa/common.rs @@ -122,7 +122,7 @@ mod temp_stable_hash_impls { } } -pub fn langcall(tcx: TyCtxt<'_, '_, '_>, +pub fn langcall(tcx: TyCtxt<'_, '_>, span: Option, msg: &str, li: LangItem) diff --git a/src/librustc_codegen_ssa/debuginfo/type_names.rs b/src/librustc_codegen_ssa/debuginfo/type_names.rs index 695a1c1cbcf88..50847b09805e9 100644 --- a/src/librustc_codegen_ssa/debuginfo/type_names.rs +++ b/src/librustc_codegen_ssa/debuginfo/type_names.rs @@ -8,7 +8,7 @@ use rustc_data_structures::fx::FxHashSet; // any caching, i.e., calling the function twice with the same type will also do // the work twice. The `qualified` parameter only affects the first level of the // type name, further levels (i.e., type parameters) are always fully qualified. -pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool) -> String { @@ -20,7 +20,7 @@ pub fn compute_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Pushes the name of the type as it should be stored in debuginfo on the // `output` String. See also compute_debuginfo_type_name(). -pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, t: Ty<'tcx>, qualified: bool, output: &mut String, @@ -208,7 +208,7 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } - fn push_item_name(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn push_item_name(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, qualified: bool, output: &mut String) { @@ -228,7 +228,7 @@ pub fn push_debuginfo_type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // reconstructed for items from non-local crates. For local crates, this // would be possible but with inlining and LTO we have to use the least // common denominator - otherwise we would run into conflicts. - fn push_type_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn push_type_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, substs: SubstsRef<'tcx>, output: &mut String, visited: &mut FxHashSet>) { diff --git a/src/librustc_codegen_ssa/traits/backend.rs b/src/librustc_codegen_ssa/traits/backend.rs index 40333874c0007..e6532f47bc86f 100644 --- a/src/librustc_codegen_ssa/traits/backend.rs +++ b/src/librustc_codegen_ssa/traits/backend.rs @@ -31,22 +31,22 @@ impl<'tcx, T> Backend<'tcx> for T where } pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Send { - fn new_metadata(&self, sess: TyCtxt<'_, '_, '_>, mod_name: &str) -> Self::Module; + fn new_metadata(&self, sess: TyCtxt<'_, '_>, mod_name: &str) -> Self::Module; fn write_compressed_metadata<'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, metadata: &EncodedMetadata, llvm_module: &mut Self::Module, ); fn codegen_allocator<'gcx>( &self, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, mods: &mut Self::Module, kind: AllocatorKind ); fn compile_codegen_unit<'a, 'tcx: 'a>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cgu_name: InternedString, ); // If find_features is true this won't access `sess.crate_types` by assuming diff --git a/src/librustc_codegen_utils/codegen_backend.rs b/src/librustc_codegen_utils/codegen_backend.rs index e29bb751b9a09..521ef23b825fd 100644 --- a/src/librustc_codegen_utils/codegen_backend.rs +++ b/src/librustc_codegen_utils/codegen_backend.rs @@ -36,7 +36,7 @@ pub trait CodegenBackend { fn provide_extern(&self, _providers: &mut Providers<'_>); fn codegen_crate<'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, metadata: EncodedMetadata, need_metadata_module: bool, rx: mpsc::Receiver> diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index 3726e4f47b96b..cc6e368f11b3b 100644 --- a/src/librustc_codegen_utils/lib.rs +++ b/src/librustc_codegen_utils/lib.rs @@ -36,7 +36,7 @@ pub mod symbol_names_test; /// error in codegen. This is used to write compile-fail tests /// that actually test that compilation succeeds without /// reporting an error. -pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_, '_>) { +pub fn check_for_rustc_errors_attr(tcx: TyCtxt<'_, '_>) { if let Some((def_id, _)) = tcx.entry_fn(LOCAL_CRATE) { if tcx.has_attr(def_id, sym::rustc_error) { tcx.sess.span_fatal(tcx.def_span(def_id), "compilation successful"); diff --git a/src/librustc_codegen_utils/symbol_names.rs b/src/librustc_codegen_utils/symbol_names.rs index 4df96a95e53a1..89b35b4cc6114 100644 --- a/src/librustc_codegen_utils/symbol_names.rs +++ b/src/librustc_codegen_utils/symbol_names.rs @@ -112,7 +112,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn symbol_name(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: Instance<'tcx>) -> InternedString { +fn symbol_name(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) -> InternedString { let def_id = instance.def_id(); let substs = instance.substs; diff --git a/src/librustc_codegen_utils/symbol_names/legacy.rs b/src/librustc_codegen_utils/symbol_names/legacy.rs index 41e972f869f7d..5e7b29d13a166 100644 --- a/src/librustc_codegen_utils/symbol_names/legacy.rs +++ b/src/librustc_codegen_utils/symbol_names/legacy.rs @@ -14,7 +14,7 @@ use std::fmt::{self, Write}; use std::mem::{self, discriminant}; pub(super) fn mangle( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, instantiating_crate: Option, ) -> String { @@ -69,7 +69,7 @@ pub(super) fn mangle( } fn get_symbol_hash<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // instance this name will be for instance: Instance<'tcx>, @@ -180,7 +180,7 @@ impl SymbolPath { } struct SymbolPrinter<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, path: SymbolPath, // When `true`, `finalize_pending_component` isn't used. @@ -203,7 +203,7 @@ impl Printer<'tcx, 'tcx> for SymbolPrinter<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_codegen_utils/symbol_names/v0.rs b/src/librustc_codegen_utils/symbol_names/v0.rs index e3b12fb7f415c..6a155ba1b2a3b 100644 --- a/src/librustc_codegen_utils/symbol_names/v0.rs +++ b/src/librustc_codegen_utils/symbol_names/v0.rs @@ -13,7 +13,7 @@ use std::fmt::Write; use std::ops::Range; pub(super) fn mangle( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, instantiating_crate: Option, ) -> String { @@ -76,7 +76,7 @@ struct BinderLevel { } struct SymbolMangler<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, compress: Option>>, binders: Vec, out: String, @@ -223,7 +223,7 @@ impl Printer<'tcx, 'tcx> for SymbolMangler<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } diff --git a/src/librustc_codegen_utils/symbol_names_test.rs b/src/librustc_codegen_utils/symbol_names_test.rs index 3d82557d4c5b1..93b8a969d0b60 100644 --- a/src/librustc_codegen_utils/symbol_names_test.rs +++ b/src/librustc_codegen_utils/symbol_names_test.rs @@ -11,7 +11,7 @@ use syntax::symbol::{Symbol, sym}; const SYMBOL_NAME: Symbol = sym::rustc_symbol_name; const DEF_PATH: Symbol = sym::rustc_def_path; -pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { // if the `rustc_attrs` feature is not enabled, then the // attributes we are interested in cannot be present anyway, so // skip the walk. @@ -26,7 +26,7 @@ pub fn report_symbol_names<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct SymbolNamesTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl SymbolNamesTest<'tcx> { diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 64d405721807f..a447baa7f41a8 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -156,7 +156,7 @@ impl PpSourceMode { /// Constructs a `PrinterSupport` object and passes it to `f`. fn call_with_pp_support<'tcx, A, F>(&self, sess: &'tcx Session, - tcx: Option>, + tcx: Option>, f: F) -> A where F: FnOnce(&dyn PrinterSupport) -> A @@ -188,7 +188,7 @@ impl PpSourceMode { } fn call_with_pp_support_hir<'tcx, A, F>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, f: F ) -> A where F: FnOnce(&dyn HirPrinterSupport<'_>, &hir::Crate) -> A @@ -270,7 +270,7 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn { struct NoAnn<'hir> { sess: &'hir Session, - tcx: Option>, + tcx: Option>, } impl<'hir> PrinterSupport for NoAnn<'hir> { @@ -311,7 +311,7 @@ impl<'hir> pprust_hir::PpAnn for NoAnn<'hir> { struct IdentifiedAnnotation<'hir> { sess: &'hir Session, - tcx: Option>, + tcx: Option>, } impl<'hir> PrinterSupport for IdentifiedAnnotation<'hir> { @@ -456,7 +456,7 @@ impl<'a> pprust::PpAnn for HygieneAnnotation<'a> { struct TypedAnnotation<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: Cell<&'a ty::TypeckTables<'tcx>>, } @@ -618,7 +618,7 @@ impl UserIdentifiedItem { } fn print_flowgraph<'tcx, W: Write>(variants: Vec, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, code: blocks::Code<'tcx>, mode: PpFlowGraphMode, mut out: W) @@ -755,7 +755,7 @@ pub fn print_after_parsing(sess: &Session, } pub fn print_after_hir_lowering<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, input: &Input, krate: &ast::Crate, ppm: PpMode, @@ -866,7 +866,7 @@ pub fn print_after_hir_lowering<'tcx>( // with a different callback than the standard driver, so that isn't easy. // Instead, we call that function ourselves. fn print_with_analysis<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ppm: PpMode, uii: Option, ofile: Option<&Path> diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index a43a508ba96e7..5e41b8c9efda2 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -51,7 +51,7 @@ use std::io::Write; use syntax::ast; use syntax_pos::Span; -pub fn assert_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn assert_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.debugging_opts.dump_dep_graph { dump_graph(tcx); @@ -90,7 +90,7 @@ type Sources = Vec<(Span, DefId, DepNode)>; type Targets = Vec<(Span, ast::Name, hir::HirId, DepNode)>; struct IfThisChanged<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, if_this_changed: Sources, then_this_would_need: Targets, } @@ -184,7 +184,7 @@ impl Visitor<'tcx> for IfThisChanged<'tcx> { } } -fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, if_this_changed: &Sources, then_this_would_need: &Targets) { @@ -217,7 +217,7 @@ fn check_paths<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn dump_graph(tcx: TyCtxt<'_, '_, '_>) { +fn dump_graph(tcx: TyCtxt<'_, '_>) { let path: String = env::var("RUST_DEP_GRAPH").unwrap_or_else(|_| "dep_graph".to_string()); let query = tcx.dep_graph.query(); diff --git a/src/librustc_incremental/assert_module_sources.rs b/src/librustc_incremental/assert_module_sources.rs index 7f1a9f8b88e53..12f81f337d356 100644 --- a/src/librustc_incremental/assert_module_sources.rs +++ b/src/librustc_incremental/assert_module_sources.rs @@ -35,7 +35,7 @@ const MODULE: Symbol = sym::module; const CFG: Symbol = sym::cfg; const KIND: Symbol = sym::kind; -pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.dep_graph.with_ignore(|| { if tcx.sess.opts.incremental.is_none() { return; @@ -60,7 +60,7 @@ pub fn assert_module_sources<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct AssertModuleSource<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, available_cgus: BTreeSet, } diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index e28ee041bff36..e281636e9a1ce 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -206,7 +206,7 @@ impl Assertion { } } -pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { // can't add `#[rustc_dirty]` etc without opting in to this feature if !tcx.features().rustc_attrs { return; @@ -235,7 +235,7 @@ pub fn check_dirty_clean_annotations<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } pub struct DirtyCleanVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, checked_attrs: FxHashSet, } @@ -537,7 +537,7 @@ impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> { /// /// Also make sure that the `label` and `except` fields do not /// both exist. -fn check_config(tcx: TyCtxt<'_, '_, '_>, attr: &Attribute) -> bool { +fn check_config(tcx: TyCtxt<'_, '_>, attr: &Attribute) -> bool { debug!("check_config(attr={:?})", attr); let config = &tcx.sess.parse_sess.config; debug!("check_config: config={:?}", config); @@ -572,7 +572,7 @@ fn check_config(tcx: TyCtxt<'_, '_, '_>, attr: &Attribute) -> bool { } } -fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> ast::Name { +fn expect_associated_value(tcx: TyCtxt<'_, '_>, item: &NestedMetaItem) -> ast::Name { if let Some(value) = item.value_str() { value } else { @@ -590,7 +590,7 @@ fn expect_associated_value(tcx: TyCtxt<'_, '_, '_>, item: &NestedMetaItem) -> as // the HIR. It is used to verfiy that we really ran checks for all annotated // nodes. pub struct FindAllAttrs<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, attr_names: Vec, found_attrs: Vec<&'tcx Attribute>, } diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs index afcd4c01dbd09..adcd06d719cd9 100644 --- a/src/librustc_incremental/persist/load.rs +++ b/src/librustc_incremental/persist/load.rs @@ -15,7 +15,7 @@ use super::fs::*; use super::file_format; use super::work_product; -pub fn dep_graph_tcx_init<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn dep_graph_tcx_init<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { if !tcx.dep_graph.is_fully_enabled() { return } diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs index 27133b87d32a1..6f175acebf95d 100644 --- a/src/librustc_incremental/persist/save.rs +++ b/src/librustc_incremental/persist/save.rs @@ -15,7 +15,7 @@ use super::dirty_clean; use super::file_format; use super::work_product; -pub fn save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn save_dep_graph<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { debug!("save_dep_graph()"); tcx.dep_graph.with_ignore(|| { let sess = tcx.sess; @@ -129,7 +129,7 @@ fn save_in(sess: &Session, path_buf: PathBuf, encode: F) } } -fn encode_dep_graph(tcx: TyCtxt<'_, '_, '_>, +fn encode_dep_graph(tcx: TyCtxt<'_, '_>, encoder: &mut Encoder) { // First encode the commandline arguments hash tcx.sess.opts.dep_tracking_hash().encode(encoder).unwrap(); @@ -234,7 +234,7 @@ fn encode_work_product_index(work_products: &FxHashMap, +fn encode_query_cache(tcx: TyCtxt<'_, '_>, encoder: &mut Encoder) { time(tcx.sess, "serialize query result cache", || { tcx.serialize_query_result_cache(encoder).unwrap(); diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 66a4ee8bfc35d..2fc78dcddd040 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -798,7 +798,7 @@ declare_box_region_type!( impl BoxedGlobalCtxt { pub fn enter(&mut self, f: F) -> R where - F: for<'tcx> FnOnce(TyCtxt<'tcx, 'tcx, 'tcx>) -> R + F: for<'tcx> FnOnce(TyCtxt<'tcx, 'tcx>) -> R { self.access(|gcx| ty::tls::enter_global(gcx, |tcx| f(tcx))) } @@ -879,7 +879,7 @@ pub fn create_global_ctxt( /// Runs the resolution, type-checking, region checking and other /// miscellaneous analysis passes on the crate. fn analysis<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> Result<()> { assert_eq!(cnum, LOCAL_CRATE); @@ -999,7 +999,7 @@ fn analysis<'tcx>( } fn encode_and_write_metadata<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, outputs: &OutputFilenames, ) -> (middle::cstore::EncodedMetadata, bool) { #[derive(PartialEq, Eq, PartialOrd, Ord)] @@ -1062,7 +1062,7 @@ fn encode_and_write_metadata<'tcx>( /// be discarded. pub fn start_codegen<'tcx>( codegen_backend: &dyn CodegenBackend, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, rx: mpsc::Receiver>, outputs: &OutputFilenames, ) -> Box { diff --git a/src/librustc_interface/proc_macro_decls.rs b/src/librustc_interface/proc_macro_decls.rs index 82eb2014728d4..864b59d8a84c4 100644 --- a/src/librustc_interface/proc_macro_decls.rs +++ b/src/librustc_interface/proc_macro_decls.rs @@ -6,12 +6,12 @@ use rustc::ty::query::Providers; use syntax::attr; use syntax::symbol::sym; -pub fn find<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { +pub fn find<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { tcx.proc_macro_decls_static(LOCAL_CRATE) } fn proc_macro_decls_static<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> Option { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_lint/lib.rs b/src/librustc_lint/lib.rs index 59498799f19d0..5eff28b194b98 100644 --- a/src/librustc_lint/lib.rs +++ b/src/librustc_lint/lib.rs @@ -75,7 +75,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn lint_mod<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn lint_mod<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { lint::late_lint_mod(tcx, module_def_id, BuiltinCombinedModuleLateLintPass::new()); } diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 0bb5457d32860..494f0b6676052 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -519,11 +519,11 @@ enum FfiResult<'tcx> { }, } -fn is_zst<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { +fn is_zst<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, did: DefId, ty: Ty<'tcx>) -> bool { tcx.layout_of(tcx.param_env(did).and(ty)).map(|layout| layout.is_zst()).unwrap_or(false) } -fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { +fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> bool { match ty.sty { ty::FnPtr(_) => true, ty::Ref(..) => true, @@ -555,7 +555,7 @@ fn ty_is_known_nonnull<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> boo /// to function pointers, references, core::num::NonZero*, /// core::ptr::NonNull, and #[repr(transparent)] newtypes. /// FIXME: This duplicates code in codegen. -fn is_repr_nullable_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_repr_nullable_ptr<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, ty_def: &'tcx ty::AdtDef, substs: SubstsRef<'tcx>) diff --git a/src/librustc_macros/src/query.rs b/src/librustc_macros/src/query.rs index 14f46fef874db..bb6595b5a8036 100644 --- a/src/librustc_macros/src/query.rs +++ b/src/librustc_macros/src/query.rs @@ -327,7 +327,7 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - #tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + #tcx: TyCtxt<'tcx, 'tcx>, #id: SerializedDepNodeIndex ) -> Option { #block @@ -338,7 +338,7 @@ fn add_query_description_impl( quote! { #[inline] fn try_load_from_disk( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, id: SerializedDepNodeIndex ) -> Option { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) @@ -350,7 +350,7 @@ fn add_query_description_impl( quote! { #[inline] #[allow(unused_variables)] - fn cache_on_disk(#tcx: TyCtxt<'tcx, 'tcx, 'tcx>, #key: Self::Key) -> bool { + fn cache_on_disk(#tcx: TyCtxt<'tcx, 'tcx>, #key: Self::Key) -> bool { #expr } @@ -367,7 +367,7 @@ fn add_query_description_impl( quote! { #[allow(unused_variables)] fn describe( - #tcx: TyCtxt<'_, '_, '_>, + #tcx: TyCtxt<'_, '_>, #key: #arg, ) -> Cow<'static, str> { format!(#desc).into() diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index 87ca766bbaa93..75020693461a4 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -40,7 +40,7 @@ macro_rules! provide { (<$lt:tt> $tcx:ident, $def_id:ident, $other:ident, $cdata:ident, $($name:ident => $compute:block)*) => { pub fn provide_extern<$lt>(providers: &mut Providers<$lt>) { - $(fn $name<$lt:$lt, T>($tcx: TyCtxt<$lt, $lt, $lt>, def_id_arg: T) + $(fn $name<$lt:$lt, T>($tcx: TyCtxt<$lt, $lt>, def_id_arg: T) -> as QueryConfig<$lt>>::Value where T: IntoArgs, @@ -551,7 +551,7 @@ impl CrateStore for cstore::CStore { } fn encode_metadata<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata { encoder::encode_metadata(tcx) diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index bcce834c282e0..017c38e0f9d50 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -39,7 +39,7 @@ pub struct DecodeContext<'a, 'tcx: 'a> { opaque: opaque::Decoder<'a>, cdata: Option<&'a CrateMetadata>, sess: Option<&'a Session>, - tcx: Option>, + tcx: Option>, // Cache the last used source_file for translating spans as an optimization. last_source_file_index: usize, @@ -55,7 +55,7 @@ pub trait Metadata<'a, 'tcx>: Copy { fn raw_bytes(self) -> &'a [u8]; fn cdata(self) -> Option<&'a CrateMetadata> { None } fn sess(self) -> Option<&'a Session> { None } - fn tcx(self) -> Option> { None } + fn tcx(self) -> Option> { None } fn decoder(self, pos: usize) -> DecodeContext<'a, 'tcx> { let tcx = self.tcx(); @@ -114,14 +114,14 @@ impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, &'a Session) { } } -impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'tcx, 'tcx, 'tcx>) { +impl<'a, 'tcx> Metadata<'a, 'tcx> for (&'a CrateMetadata, TyCtxt<'tcx, 'tcx>) { fn raw_bytes(self) -> &'a [u8] { self.0.raw_bytes() } fn cdata(self) -> Option<&'a CrateMetadata> { Some(self.0) } - fn tcx(self) -> Option> { + fn tcx(self) -> Option> { Some(self.1) } } @@ -146,7 +146,7 @@ impl<'a, 'tcx: 'a, T: Decodable> LazySeq { } impl<'a, 'tcx> DecodeContext<'a, 'tcx> { - pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx.expect("missing TyCtxt in DecodeContext") } @@ -172,7 +172,7 @@ impl<'a, 'tcx> DecodeContext<'a, 'tcx> { impl<'a, 'tcx> TyDecoder<'tcx> for DecodeContext<'a, 'tcx> { #[inline] - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx.expect("missing TyCtxt in DecodeContext") } @@ -547,7 +547,7 @@ impl<'a, 'tcx> CrateMetadata { fn get_variant( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item: &Entry<'_>, index: DefIndex, parent_did: DefId, @@ -590,7 +590,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_adt_def(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> &'tcx ty::AdtDef { let item = self.entry(item_id); let did = self.local_def_id(item_id); @@ -618,21 +618,21 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_predicates(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates.unwrap().decode((self, tcx)) } pub fn get_predicates_defined_on(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { self.entry(item_id).predicates_defined_on.unwrap().decode((self, tcx)) } pub fn get_super_predicates(&self, item_id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::GenericPredicates<'tcx> { let super_predicates = match self.entry(item_id).kind { EntryKind::Trait(data) => data.decode(self).super_predicates, @@ -650,7 +650,7 @@ impl<'a, 'tcx> CrateMetadata { self.entry(item_id).generics.unwrap().decode((self, sess)) } - pub fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Ty<'tcx> { + pub fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx, 'tcx>) -> Ty<'tcx> { self.entry(id).ty.unwrap().decode((self, tcx)) } @@ -702,7 +702,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_impl_trait(&self, id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Option> { self.get_impl_data(id).trait_ref.map(|tr| tr.decode((self, tcx))) } @@ -710,7 +710,7 @@ impl<'a, 'tcx> CrateMetadata { /// Iterates over all the stability attributes in the given crate. pub fn get_lib_features( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [(ast::Name, Option)] { // FIXME: For a proc macro crate, not sure whether we should return the "host" // features or an empty Vec. Both don't cause ICEs. @@ -722,7 +722,7 @@ impl<'a, 'tcx> CrateMetadata { /// Iterates over the language items in the given crate. pub fn get_lang_items( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [(DefId, usize)] { if self.proc_macros.is_some() { // Proc macro crates do not export any lang-items to the target. @@ -885,7 +885,7 @@ impl<'a, 'tcx> CrateMetadata { } pub fn maybe_get_optimized_mir(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, id: DefIndex) -> Option> { match self.is_proc_macro(id) { @@ -1019,7 +1019,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_inherent_implementations_for_type( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, id: DefIndex ) -> &'tcx [DefId] { tcx.arena.alloc_from_iter(self.entry(id) @@ -1030,7 +1030,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_implementations_for_trait( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, filter: Option, ) -> &'tcx [DefId] { if self.proc_macros.is_some() { @@ -1087,7 +1087,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_foreign_modules( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [ForeignModule] { if self.proc_macros.is_some() { // Proc macro crates do not have any *target* foreign modules. @@ -1099,7 +1099,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_dylib_dependency_formats( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [(CrateNum, LinkagePreference)] { tcx.arena.alloc_from_iter(self.root .dylib_dependency_formats @@ -1113,7 +1113,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn get_missing_lang_items( &self, - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, ) -> &'tcx [lang_items::LangItem] { if self.proc_macros.is_some() { // Proc macro crates do not depend on any target weak lang-items. @@ -1136,7 +1136,7 @@ impl<'a, 'tcx> CrateMetadata { } pub fn exported_symbols(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)> { if self.proc_macros.is_some() { // If this crate is a custom derive crate, then we're not even going to @@ -1194,7 +1194,7 @@ impl<'a, 'tcx> CrateMetadata { pub fn fn_sig(&self, id: DefIndex, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> ty::PolyFnSig<'tcx> { let sig = match self.entry(id).kind { EntryKind::Fn(data) | diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index b7b9a739371e1..ee7ffa1b06628 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -42,7 +42,7 @@ use rustc::hir::intravisit; pub struct EncodeContext<'tcx> { opaque: opaque::Encoder, - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, entries_index: Index<'tcx>, @@ -1818,7 +1818,7 @@ impl EncodeContext<'tcx> { } struct ImplVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impls: FxHashMap>, } @@ -1865,7 +1865,7 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> { // will allow us to slice the metadata to the precise length that we just // generated regardless of trailing bytes that end up in it. -pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata { let mut encoder = opaque::Encoder::new(vec![]); @@ -1909,7 +1909,7 @@ pub fn encode_metadata<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) EncodedMetadata { raw_data: result } } -pub fn get_repr_options<'tcx, 'gcx>(tcx: TyCtxt<'gcx, 'tcx, 'gcx>, did: DefId) -> ReprOptions { +pub fn get_repr_options<'tcx, 'gcx>(tcx: TyCtxt<'tcx, 'gcx>, did: DefId) -> ReprOptions { let ty = tcx.type_of(did); match ty.sty { ty::Adt(ref def, _) => return def.repr, diff --git a/src/librustc_metadata/foreign_modules.rs b/src/librustc_metadata/foreign_modules.rs index f3e1e3ad80d89..7520fb607c5fa 100644 --- a/src/librustc_metadata/foreign_modules.rs +++ b/src/librustc_metadata/foreign_modules.rs @@ -3,7 +3,7 @@ use rustc::hir; use rustc::middle::cstore::ForeignModule; use rustc::ty::TyCtxt; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, modules: Vec::new(), @@ -13,7 +13,7 @@ pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { } struct Collector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, modules: Vec, } diff --git a/src/librustc_metadata/link_args.rs b/src/librustc_metadata/link_args.rs index 7e99e3d8a4c3c..1c50b0f293a62 100644 --- a/src/librustc_metadata/link_args.rs +++ b/src/librustc_metadata/link_args.rs @@ -4,7 +4,7 @@ use rustc::ty::TyCtxt; use rustc_target::spec::abi::Abi; use syntax::symbol::sym; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { let mut collector = Collector { args: Vec::new(), }; diff --git a/src/librustc_metadata/native_libs.rs b/src/librustc_metadata/native_libs.rs index 801acbfd34699..bcd91eb22cf1f 100644 --- a/src/librustc_metadata/native_libs.rs +++ b/src/librustc_metadata/native_libs.rs @@ -11,7 +11,7 @@ use syntax::feature_gate::{self, GateIssue}; use syntax::symbol::{Symbol, sym}; use syntax::{span_err, struct_span_err}; -pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Vec { +pub fn collect<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Vec { let mut collector = Collector { tcx, libs: Vec::new(), @@ -29,7 +29,7 @@ pub fn relevant_lib(sess: &Session, lib: &NativeLibrary) -> bool { } struct Collector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, libs: Vec, } diff --git a/src/librustc_mir/borrow_check/borrow_set.rs b/src/librustc_mir/borrow_check/borrow_set.rs index e1425ed24300d..85a5669dfe142 100644 --- a/src/librustc_mir/borrow_check/borrow_set.rs +++ b/src/librustc_mir/borrow_check/borrow_set.rs @@ -122,7 +122,7 @@ impl LocalsStateAtExit { impl<'tcx> BorrowSet<'tcx> { pub fn build( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_are_invalidated_at_exit: bool, move_data: &MoveData<'tcx> @@ -162,7 +162,7 @@ impl<'tcx> BorrowSet<'tcx> { } struct GatherBorrows<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, idx_vec: IndexVec>, location_map: FxHashMap, diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 1bcdf22672093..60ad8921c0b3d 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -87,7 +87,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { +fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { let input_body = tcx.mir_validated(def_id); debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id)); diff --git a/src/librustc_mir/borrow_check/move_errors.rs b/src/librustc_mir/borrow_check/move_errors.rs index a7f3022019c1a..a010338a08d12 100644 --- a/src/librustc_mir/borrow_check/move_errors.rs +++ b/src/librustc_mir/borrow_check/move_errors.rs @@ -96,7 +96,7 @@ impl BorrowedContentSource<'tcx> { } } - fn from_call(func: Ty<'tcx>, tcx: TyCtxt<'tcx, '_, 'tcx>) -> Option { + fn from_call(func: Ty<'tcx>, tcx: TyCtxt<'_, 'tcx>) -> Option { match func.sty { ty::FnDef(def_id, substs) => { let trait_id = tcx.trait_of_item(def_id)?; diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index 38e6e55e40a97..ccdde320df06e 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -523,7 +523,7 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { } fn suggest_ampmut_self<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, local_decl: &mir::LocalDecl<'tcx>, ) -> (Span, String) { let sp = local_decl.source_info.span; @@ -556,7 +556,7 @@ fn suggest_ampmut_self<'gcx, 'tcx>( // This implementation attempts to emulate AST-borrowck prioritization // by trying (3.), then (2.) and finally falling back on (1.). fn suggest_ampmut<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, local: Local, local_decl: &mir::LocalDecl<'tcx>, @@ -623,7 +623,7 @@ fn is_closure_or_generator(ty: Ty<'_>) -> bool { /// | ---------- use `&'a mut String` here to make mutable /// ``` fn annotate_struct_field( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'tcx>, field: &mir::Field, ) -> Option<(Span, String)> { diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs index c0848f2afe633..5563bdcaebf27 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/find_use.rs @@ -12,7 +12,7 @@ use rustc_data_structures::fx::FxHashSet; crate fn find<'tcx>( body: &Body<'tcx>, regioncx: &Rc>, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, region_vid: RegionVid, start_point: Location, ) -> Option { @@ -30,7 +30,7 @@ crate fn find<'tcx>( struct UseFinder<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, regioncx: &'cx Rc>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_vid: RegionVid, start_point: Location, } @@ -101,7 +101,7 @@ impl<'cx, 'gcx, 'tcx> UseFinder<'cx, 'gcx, 'tcx> { struct DefUseVisitor<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, region_vid: RegionVid, def_use_result: Option, } diff --git a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs index 534a91d39a0ce..a8b197135b0a0 100644 --- a/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs +++ b/src/librustc_mir/borrow_check/nll/explain_borrow/mod.rs @@ -53,7 +53,7 @@ impl BorrowExplanation { } pub(in crate::borrow_check) fn add_explanation_to_diagnostic<'gcx, 'tcx>( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, err: &mut DiagnosticBuilder<'_>, borrow_desc: &str, diff --git a/src/librustc_mir/borrow_check/nll/facts.rs b/src/librustc_mir/borrow_check/nll/facts.rs index 926f52b7cfce8..fdeec036ad043 100644 --- a/src/librustc_mir/borrow_check/nll/facts.rs +++ b/src/librustc_mir/borrow_check/nll/facts.rs @@ -15,7 +15,7 @@ crate type AllFacts = PoloniusAllFacts; crate trait AllFactsExt { /// Returns `true` if there is a need to gather `AllFacts` given the /// current `-Z` flags. - fn enabled(tcx: TyCtxt<'_, '_, '_>) -> bool; + fn enabled(tcx: TyCtxt<'_, '_>) -> bool; fn write_to_dir( &self, @@ -26,7 +26,7 @@ crate trait AllFactsExt { impl AllFactsExt for AllFacts { /// Return - fn enabled(tcx: TyCtxt<'_, '_, '_>) -> bool { + fn enabled(tcx: TyCtxt<'_, '_>) -> bool { tcx.sess.opts.debugging_opts.nll_facts || tcx.sess.opts.debugging_opts.polonius } diff --git a/src/librustc_mir/borrow_check/nll/invalidation.rs b/src/librustc_mir/borrow_check/nll/invalidation.rs index 5a8de5c9dbdda..12433ca365d68 100644 --- a/src/librustc_mir/borrow_check/nll/invalidation.rs +++ b/src/librustc_mir/borrow_check/nll/invalidation.rs @@ -18,7 +18,7 @@ use rustc::mir::{Operand, BorrowKind}; use rustc_data_structures::graph::dominators::Dominators; pub(super) fn generate_invalidates<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, all_facts: &mut Option, location_table: &LocationTable, body: &Body<'tcx>, @@ -44,7 +44,7 @@ pub(super) fn generate_invalidates<'gcx, 'tcx>( } struct InvalidationGenerator<'cx, 'tcx: 'cx, 'gcx: 'tcx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, all_facts: &'cx mut AllFacts, location_table: &'cx LocationTable, body: &'cx Body<'tcx>, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs index 2338d6a846674..a263d3be3a547 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/region_name.rs @@ -194,7 +194,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// named variants. fn give_name_from_error_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, mir_def_id: DefId, fr: RegionVid, counter: &mut usize, @@ -303,7 +303,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn get_named_span( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, error_region: &RegionKind, name: InternedString, ) -> Span { @@ -461,7 +461,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// to highlighting that closest type instead. fn give_name_if_we_can_match_hir_ty( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, needle_fr: RegionVid, argument_ty: Ty<'tcx>, argument_hir_ty: &hir::Ty, @@ -653,7 +653,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// ``` fn give_name_if_anonymous_region_appears_in_upvars( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, upvars: &[Upvar], fr: RegionVid, counter: &mut usize, diff --git a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs index 77aeb401445a0..882a52a0c4565 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/error_reporting/var_name.rs @@ -10,7 +10,7 @@ use syntax_pos::symbol::Symbol; impl<'tcx> RegionInferenceContext<'tcx> { crate fn get_var_name_and_span_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, upvars: &[Upvar], fr: RegionVid, @@ -35,7 +35,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// Search the upvars (if any) to find one that references fr. Return its index. crate fn get_upvar_index_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, fr: RegionVid, ) -> Option { let upvar_index = self @@ -69,7 +69,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// declared. crate fn get_upvar_name_and_span_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, upvars: &[Upvar], upvar_index: usize, ) -> (Symbol, Span) { @@ -91,7 +91,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// user - in particular, index 0 is not the implicit self parameter. crate fn get_argument_index_for_region( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, fr: RegionVid, ) -> Option { let implicit_inputs = self.universal_regions.defining_ty.implicit_inputs(); diff --git a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs index a2213f0c7eb58..13606f61a689c 100644 --- a/src/librustc_mir/borrow_check/nll/region_infer/mod.rs +++ b/src/librustc_mir/borrow_check/nll/region_infer/mod.rs @@ -370,7 +370,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { } /// Adds annotations for `#[rustc_regions]`; see `UniversalRegions::annotate`. - crate fn annotate(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { + crate fn annotate(&self, tcx: TyCtxt<'_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { self.universal_regions.annotate(tcx, err) } @@ -943,7 +943,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// `point`. fn eval_verify_bound( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, @@ -976,7 +976,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { fn eval_if_eq( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, generic_ty: Ty<'tcx>, lower_bound: RegionVid, @@ -1022,7 +1022,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { /// higher-ranked things and so forth, and right now the inference /// context is not permitted to make more inference variables. So /// we use this kind of hacky solution. - fn normalize_to_scc_representatives(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: T) -> T + fn normalize_to_scc_representatives(&self, tcx: TyCtxt<'_, 'tcx>, value: T) -> T where T: TypeFoldable<'tcx>, { @@ -1368,14 +1368,14 @@ impl<'tcx> RegionDefinition<'tcx> { pub trait ClosureRegionRequirementsExt<'gcx, 'tcx> { fn apply_requirements( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec>; fn subst_closure_mapping( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_mapping: &IndexVec>, value: &T, ) -> T @@ -1398,7 +1398,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi /// requirements. fn apply_requirements( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_def_id: DefId, closure_substs: SubstsRef<'tcx>, ) -> Vec> { @@ -1453,7 +1453,7 @@ impl<'gcx, 'tcx> ClosureRegionRequirementsExt<'gcx, 'tcx> for ClosureRegionRequi fn subst_closure_mapping( &self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, closure_mapping: &IndexVec>, value: &T, ) -> T diff --git a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs index 381e18f60a2e0..01dd60cc4891c 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/constraint_conversion.rs @@ -15,7 +15,7 @@ use syntax_pos::DUMMY_SP; crate struct ConstraintConversion<'a, 'gcx: 'tcx, 'tcx: 'a> { infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, universal_regions: &'a UniversalRegions<'tcx>, region_bound_pairs: &'a RegionBoundPairs<'tcx>, implicit_region_bound: Option>, diff --git a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs index f4ceb36858e07..240588b1c88d3 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/liveness/mod.rs @@ -75,7 +75,7 @@ pub(super) fn generate<'gcx, 'tcx>( // some region `R` in its type where `R` is not known to outlive a free // region (i.e., where `R` may be valid for just a subset of the fn body). fn compute_live_locals( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, free_regions: &FxHashSet, body: &Body<'tcx>, ) -> Vec { diff --git a/src/librustc_mir/borrow_check/nll/type_check/mod.rs b/src/librustc_mir/borrow_check/nll/type_check/mod.rs index 75d5987af0bc1..bbfffc68b9692 100644 --- a/src/librustc_mir/borrow_check/nll/type_check/mod.rs +++ b/src/librustc_mir/borrow_check/nll/type_check/mod.rs @@ -235,7 +235,7 @@ fn translate_outlives_facts(cx: &mut BorrowCheckContext<'_, '_>) { } } -fn mirbug(tcx: TyCtxt<'_, '_, '_>, span: Span, msg: &str) { +fn mirbug(tcx: TyCtxt<'_, '_>, span: Span, msg: &str) { // We sometimes see MIR failures (notably predicate failures) due to // the fact that we check rvalue sized predicates here. So use `delay_span_bug` // to avoid reporting bugs in those cases. @@ -391,7 +391,7 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { } } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.cx.infcx.tcx } @@ -1313,7 +1313,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { Ok(()) } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -2504,7 +2504,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { fn prove_closure_bounds( &mut self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, location: Location, diff --git a/src/librustc_mir/borrow_check/nll/universal_regions.rs b/src/librustc_mir/borrow_check/nll/universal_regions.rs index 76b1acc52ba31..6e64a6fae58d6 100644 --- a/src/librustc_mir/borrow_check/nll/universal_regions.rs +++ b/src/librustc_mir/borrow_check/nll/universal_regions.rs @@ -106,7 +106,7 @@ impl<'tcx> DefiningTy<'tcx> { /// not a closure or generator, there are no upvars, and hence it /// will be an empty list. The order of types in this list will /// match up with the upvar order in the HIR, typesystem, and MIR. - pub fn upvar_tys(self, tcx: TyCtxt<'tcx, '_, 'tcx>) -> impl Iterator> + 'tcx { + pub fn upvar_tys(self, tcx: TyCtxt<'_, 'tcx>) -> impl Iterator> + 'tcx { match self { DefiningTy::Closure(def_id, substs) => Either::Left(substs.upvar_tys(def_id, tcx)), DefiningTy::Generator(def_id, substs, _) => { @@ -218,7 +218,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// `'1: '2`, then the caller would impose the constraint that /// `V[1]: V[2]`. pub fn closure_mapping( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, closure_substs: SubstsRef<'tcx>, expected_num_vars: usize, closure_base_def_id: DefId, @@ -305,7 +305,7 @@ impl<'tcx> UniversalRegions<'tcx> { /// that this region imposes on others. The methods in this file /// handle the part about dumping the inference context internal /// state. - crate fn annotate(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { + crate fn annotate(&self, tcx: TyCtxt<'_, 'tcx>, err: &mut DiagnosticBuilder<'_>) { match self.defining_ty { DefiningTy::Closure(def_id, substs) => { err.note(&format!( @@ -744,7 +744,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> { /// Replaces all free regions in `value` with region vids, as /// returned by `to_region_vid`. - pub fn fold_to_region_vids(&self, tcx: TyCtxt<'tcx, '_, 'tcx>, value: &T) -> T + pub fn fold_to_region_vids(&self, tcx: TyCtxt<'_, 'tcx>, value: &T) -> T where T: TypeFoldable<'tcx>, { @@ -757,7 +757,7 @@ impl<'tcx> UniversalRegionIndices<'tcx> { /// Iterates over the late-bound regions defined on fn_def_id and /// invokes `f` with the liberated form of each one. fn for_each_late_bound_region_defined_on<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, fn_def_id: DefId, mut f: impl FnMut(ty::Region<'tcx>), ) { diff --git a/src/librustc_mir/borrow_check/path_utils.rs b/src/librustc_mir/borrow_check/path_utils.rs index 44d2916daa584..10a92253f9f64 100644 --- a/src/librustc_mir/borrow_check/path_utils.rs +++ b/src/librustc_mir/borrow_check/path_utils.rs @@ -24,7 +24,7 @@ pub(super) enum Control { /// Encapsulates the idea of iterating over every borrow that involves a particular path pub(super) fn each_borrow_involving_path<'tcx, 'gcx: 'tcx, F, I, S> ( s: &mut S, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, _location: Location, access_place: (AccessDepth, &Place<'tcx>), diff --git a/src/librustc_mir/borrow_check/place_ext.rs b/src/librustc_mir/borrow_check/place_ext.rs index d0c05318d90f3..b969f0fd3c7aa 100644 --- a/src/librustc_mir/borrow_check/place_ext.rs +++ b/src/librustc_mir/borrow_check/place_ext.rs @@ -12,7 +12,7 @@ crate trait PlaceExt<'tcx> { /// for borrows of raw pointer dereferents as well as shared references. fn ignore_borrow( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool; @@ -21,7 +21,7 @@ crate trait PlaceExt<'tcx> { impl<'tcx> PlaceExt<'tcx> for Place<'tcx> { fn ignore_borrow( &self, - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, body: &Body<'tcx>, locals_state_at_exit: &LocalsStateAtExit, ) -> bool { diff --git a/src/librustc_mir/borrow_check/places_conflict.rs b/src/librustc_mir/borrow_check/places_conflict.rs index 858ca958ca186..c1cbfd9e3c0ba 100644 --- a/src/librustc_mir/borrow_check/places_conflict.rs +++ b/src/librustc_mir/borrow_check/places_conflict.rs @@ -25,7 +25,7 @@ crate enum PlaceConflictBias { /// This is used to check for places conflicting outside of the borrow checking code (such as in /// dataflow). crate fn places_conflict<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, borrow_place: &Place<'tcx>, access_place: &Place<'tcx>, @@ -47,7 +47,7 @@ crate fn places_conflict<'gcx, 'tcx>( /// array indices, for example) should be interpreted - this depends on what the caller wants in /// order to make the conservative choice and preserve soundness. pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, borrow_place: &Place<'tcx>, borrow_kind: BorrowKind, @@ -84,7 +84,7 @@ pub(super) fn borrow_conflicts_with_place<'gcx, 'tcx>( } fn place_components_conflict<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, borrow_projections: (&PlaceBase<'tcx>, ProjectionsIter<'_, 'tcx>), borrow_kind: BorrowKind, @@ -299,7 +299,7 @@ fn place_components_conflict<'gcx, 'tcx>( // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. fn place_base_conflict<'gcx: 'tcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, elem1: &PlaceBase<'tcx>, elem2: &PlaceBase<'tcx>, ) -> Overlap { @@ -366,7 +366,7 @@ fn place_base_conflict<'gcx: 'tcx, 'tcx>( // or disjoint (and have the same type!), return the overlap situation // between `elem1` and `elem2`. fn place_projection_conflict<'gcx: 'tcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, pi1: &Projection<'tcx>, pi2: &Projection<'tcx>, diff --git a/src/librustc_mir/borrow_check/prefixes.rs b/src/librustc_mir/borrow_check/prefixes.rs index b7af985ad494c..dd4aac0330c1e 100644 --- a/src/librustc_mir/borrow_check/prefixes.rs +++ b/src/librustc_mir/borrow_check/prefixes.rs @@ -39,7 +39,7 @@ impl<'tcx> IsPrefixOf<'tcx> for Place<'tcx> { pub(super) struct Prefixes<'cx, 'gcx: 'tcx, 'tcx: 'cx> { body: &'cx Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, kind: PrefixSet, next: Option<&'cx Place<'tcx>>, } diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 564e2ddc64b3f..f4b6f438163f9 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -25,7 +25,7 @@ use syntax_pos::Span; use super::lints; /// Construct the MIR for a given `DefId`. -pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { +pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Body<'tcx> { let id = tcx.hir().as_local_hir_id(def_id).unwrap(); // Figure out what primary body this item has. @@ -185,7 +185,7 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Body<'tc /// to the global tcx. Sadly, we don't have a "folder" that /// can change `'tcx` so we have to transmute afterwards. struct GlobalizeMir<'gcx> { - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, span: Span } @@ -234,7 +234,7 @@ impl<'gcx: 'tcx, 'tcx> MutVisitor<'tcx> for GlobalizeMir<'gcx> { /////////////////////////////////////////////////////////////////////////// // BuildMir -- walks a crate, looking for fn items and methods to build MIR from -fn liberated_closure_env_ty<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn liberated_closure_env_ty<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, closure_expr_id: hir::HirId, body_id: hir::BodyId) -> Ty<'tcx> { @@ -551,7 +551,7 @@ macro_rules! unpack { }; } -fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn should_abort_on_panic<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, fn_def_id: DefId, abi: Abi) -> bool { diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index eb2680f749b75..458e68cfcc59e 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -44,7 +44,7 @@ const DETECTOR_SNAPSHOT_PERIOD: isize = 256; /// of a function's generic parameter will require knowledge about the bounds on the generic /// parameter. These bounds are passed to `mk_eval_cx` via the `ParamEnv` argument. pub(crate) fn mk_eval_cx<'mir, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_env: ty::ParamEnv<'tcx>, ) -> CompileTimeEvalContext<'mir, 'tcx> { @@ -53,7 +53,7 @@ pub(crate) fn mk_eval_cx<'mir, 'tcx>( } pub(crate) fn eval_promoted<'mir, 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cid: GlobalId<'tcx>, body: &'mir mir::Body<'tcx>, param_env: ty::ParamEnv<'tcx>, @@ -474,7 +474,7 @@ impl<'mir, 'tcx> interpret::Machine<'mir, 'tcx> // this function uses `unwrap` copiously, because an already validated constant must have valid // fields and can thus never fail outside of compiler bugs pub fn const_field<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, variant: Option, field: mir::Field, @@ -499,7 +499,7 @@ pub fn const_field<'tcx>( // this function uses `unwrap` copiously, because an already validated constant must have valid // fields and can thus never fail outside of compiler bugs pub fn const_variant_index<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, val: &'tcx ty::Const<'tcx>, ) -> VariantIdx { @@ -519,7 +519,7 @@ pub fn error_to_const_error<'mir, 'tcx>( } fn validate_and_turn_into_const<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, constant: RawConst<'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { @@ -562,7 +562,7 @@ fn validate_and_turn_into_const<'tcx>( } pub fn const_eval_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalResult<'tcx> { // see comment in const_eval_provider for what we're doing here @@ -586,7 +586,7 @@ pub fn const_eval_provider<'tcx>( } pub fn const_eval_raw_provider<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, key: ty::ParamEnvAnd<'tcx, GlobalId<'tcx>>, ) -> ::rustc::mir::interpret::ConstEvalRawResult<'tcx> { // Because the constant is computed twice (once per value of `Reveal`), we are at risk of diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index f7cc8c22b0451..6a536dc427bee 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -46,7 +46,7 @@ pub fn move_path_children_matching<'tcx, F>(move_data: &MoveData<'tcx>, /// is no need to maintain separate drop flags to track such state. // // FIXME: we have to do something for moving slice patterns. -fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, place: &mir::Place<'tcx>) -> bool { let ty = place.ty(body, tcx).ty; @@ -73,7 +73,7 @@ fn place_contents_drop_state_cannot_differ<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, ' } pub(crate) fn on_lookup_result_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, lookup_result: LookupResult, @@ -91,7 +91,7 @@ pub(crate) fn on_lookup_result_bits<'gcx, 'tcx, F>( } pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, @@ -99,7 +99,7 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( where F: FnMut(MovePathIndex) { fn is_terminal_path<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, path: MovePathIndex) -> bool @@ -109,7 +109,7 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( } fn on_all_children_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, move_path_index: MovePathIndex, @@ -132,7 +132,7 @@ pub(crate) fn on_all_children_bits<'gcx, 'tcx, F>( } pub(crate) fn on_all_drop_children_bits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, path: MovePathIndex, @@ -155,7 +155,7 @@ pub(crate) fn on_all_drop_children_bits<'gcx, 'tcx, F>( } pub(crate) fn drop_flag_effects_for_function_entry<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, mut callback: F) @@ -172,7 +172,7 @@ pub(crate) fn drop_flag_effects_for_function_entry<'gcx, 'tcx, F>( } pub(crate) fn drop_flag_effects_for_location<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, ctxt: &MoveDataParamEnv<'gcx, 'tcx>, loc: Location, @@ -204,7 +204,7 @@ pub(crate) fn drop_flag_effects_for_location<'gcx, 'tcx, F>( } pub(crate) fn for_location_inits<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &Body<'tcx>, move_data: &MoveData<'tcx>, loc: Location, diff --git a/src/librustc_mir/dataflow/impls/borrows.rs b/src/librustc_mir/dataflow/impls/borrows.rs index 38cb7bd9796c6..ba38ef91ebe46 100644 --- a/src/librustc_mir/dataflow/impls/borrows.rs +++ b/src/librustc_mir/dataflow/impls/borrows.rs @@ -30,7 +30,7 @@ newtype_index! { /// describing the borrow. These indexes are used for representing the /// borrows in compact bitvectors. pub struct Borrows<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, borrow_set: Rc>, @@ -135,7 +135,7 @@ fn precompute_borrows_out_of_scope<'tcx>( impl<'a, 'gcx, 'tcx> Borrows<'a, 'gcx, 'tcx> { crate fn new( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, nonlexical_regioncx: Rc>, borrow_set: &Rc>, diff --git a/src/librustc_mir/dataflow/impls/mod.rs b/src/librustc_mir/dataflow/impls/mod.rs index 3311353ebd3b6..c1d302744858e 100644 --- a/src/librustc_mir/dataflow/impls/mod.rs +++ b/src/librustc_mir/dataflow/impls/mod.rs @@ -64,13 +64,13 @@ pub(super) mod borrows; /// between this data and `MaybeUninitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. pub struct MaybeInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx> MaybeInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -119,13 +119,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeInitializedPlaces<'a, 'gcx, 'tcx /// between this data and `MaybeInitializedPlaces` yields the set of /// places that would require a dynamic drop-flag at that statement. pub struct MaybeUninitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> MaybeUninitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -173,13 +173,13 @@ impl<'a, 'gcx, 'tcx> HasMoveData<'tcx> for MaybeUninitializedPlaces<'a, 'gcx, 't /// this data and `MaybeInitializedPlaces` yields the set of places /// that would require a dynamic drop-flag at that statement. pub struct DefinitelyInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx: 'a> DefinitelyInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self @@ -222,13 +222,13 @@ impl<'a, 'gcx, 'tcx: 'a> HasMoveData<'tcx> for DefinitelyInitializedPlaces<'a, ' /// } /// ``` pub struct EverInitializedPlaces<'a, 'gcx: 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>, } impl<'a, 'gcx: 'tcx, 'tcx: 'a> EverInitializedPlaces<'a, 'gcx, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + pub fn new(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, mdpe: &'a MoveDataParamEnv<'gcx, 'tcx>) -> Self diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 89b379b95b84c..ae7690554f84e 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -121,7 +121,7 @@ pub struct MoveDataParamEnv<'gcx, 'tcx> { pub(crate) param_env: ty::ParamEnv<'gcx>, } -pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'gcx, 'tcx>, body: &'a Body<'tcx>, def_id: DefId, attributes: &[ast::Attribute], @@ -139,7 +139,7 @@ pub(crate) fn do_dataflow<'a, 'gcx, 'tcx, BD, P>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl<'a, 'gcx: 'tcx, 'tcx: 'a, BD> DataflowAnalysis<'a, 'tcx, BD> where BD: BitDenotation<'tcx> { pub(crate) fn run

(self, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, attributes: &[ast::Attribute], p: P) -> DataflowResults<'tcx, BD> diff --git a/src/librustc_mir/dataflow/move_paths/builder.rs b/src/librustc_mir/dataflow/move_paths/builder.rs index ecc252adb6dc0..e437620272134 100644 --- a/src/librustc_mir/dataflow/move_paths/builder.rs +++ b/src/librustc_mir/dataflow/move_paths/builder.rs @@ -14,13 +14,13 @@ use super::IllegalMoveOriginKind::*; struct MoveDataBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> { body: &'a Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, data: MoveData<'tcx>, errors: Vec<(Place<'tcx>, MoveError<'tcx>)>, } impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { - fn new(body: &'a Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { + fn new(body: &'a Body<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) -> Self { let mut move_paths = IndexVec::new(); let mut path_map = IndexVec::new(); let mut init_path_map = IndexVec::new(); @@ -204,7 +204,7 @@ impl<'a, 'gcx, 'tcx> MoveDataBuilder<'a, 'gcx, 'tcx> { pub(super) fn gather_moves<'gcx, 'tcx>( body: &Body<'tcx>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> ) -> Result, (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>)> { let mut builder = MoveDataBuilder::new(body, tcx); diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 2d8d3a28fd6f1..aa8a1e54a6570 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -306,7 +306,7 @@ impl<'tcx> MoveError<'tcx> { } impl<'gcx, 'tcx> MoveData<'tcx> { - pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) + pub fn gather_moves(body: &Body<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) -> Result, MoveError<'tcx>)>)> { builder::gather_moves(body, tcx) } diff --git a/src/librustc_mir/hair/constant.rs b/src/librustc_mir/hair/constant.rs index 04eeb6333fd93..934baa55a9043 100644 --- a/src/librustc_mir/hair/constant.rs +++ b/src/librustc_mir/hair/constant.rs @@ -11,7 +11,7 @@ crate enum LitToConstError { crate fn lit_to_const<'gcx, 'tcx>( lit: &'tcx ast::LitKind, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ty: Ty<'tcx>, neg: bool, ) -> Result<&'tcx ty::Const<'tcx>, LitToConstError> { diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs index e259c6171a3af..ff3383f6e14c0 100644 --- a/src/librustc_mir/hair/cx/mod.rs +++ b/src/librustc_mir/hair/cx/mod.rs @@ -22,7 +22,7 @@ use crate::hair::constant::{lit_to_const, LitToConstError}; #[derive(Clone)] pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, infcx: &'a InferCtxt<'a, 'gcx, 'tcx>, pub root_lint_level: hir::HirId, @@ -200,7 +200,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { ty.needs_drop(self.tcx.global_tcx(), param_env) } - pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx } @@ -218,7 +218,7 @@ impl<'a, 'gcx, 'tcx> Cx<'a, 'gcx, 'tcx> { } impl UserAnnotatedTyHelpers<'gcx, 'tcx> for Cx<'_, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.tcx() } diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 7a1fd7843a6ee..9da51cae21830 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -195,7 +195,7 @@ pub fn expand_pattern<'a, 'tcx>(cx: &MatchCheckCtxt<'a, 'tcx>, pat: Pattern<'tcx } struct LiteralExpander<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> } impl LiteralExpander<'tcx> { @@ -350,7 +350,7 @@ impl<'p, 'tcx> FromIterator; 2]>> for Matrix<'p, 'tc } pub struct MatchCheckCtxt<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, /// The module in which the match occurs. This is necessary for /// checking inhabited-ness of types because whether a type is (visibly) /// inhabited can depend on whether it was defined in the current module or @@ -365,7 +365,7 @@ pub struct MatchCheckCtxt<'a, 'tcx: 'a> { impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { pub fn create_and_enter( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, module: DefId, f: F) -> R @@ -827,7 +827,7 @@ struct IntRange<'tcx> { } impl<'tcx> IntRange<'tcx> { - fn from_ctor(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn from_ctor(tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>) -> Option> { // Floating-point ranges are permitted and we don't want @@ -867,7 +867,7 @@ impl<'tcx> IntRange<'tcx> { } } - fn from_pat(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn from_pat(tcx: TyCtxt<'tcx, 'tcx>, mut pat: &Pattern<'tcx>) -> Option> { let range = loop { @@ -889,7 +889,7 @@ impl<'tcx> IntRange<'tcx> { } // The return value of `signed_bias` should be XORed with an endpoint to encode/decode it. - fn signed_bias(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> u128 { + fn signed_bias(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> u128 { match ty.sty { ty::Int(ity) => { let bits = Integer::from_attr(&tcx, SignedInt(ity)).size().bits() as u128; @@ -901,7 +901,7 @@ impl<'tcx> IntRange<'tcx> { /// Converts a `RangeInclusive` to a `ConstantValue` or inclusive `ConstantRange`. fn range_to_ctor( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, r: RangeInclusive, ) -> Constructor<'tcx> { @@ -918,7 +918,7 @@ impl<'tcx> IntRange<'tcx> { /// Returns a collection of ranges that spans the values covered by `ranges`, subtracted /// by the values covered by `self`: i.e., `ranges \ self` (in set notation). fn subtract_from(self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ranges: Vec>) -> Vec> { let ranges = ranges.into_iter().filter_map(|r| { @@ -988,7 +988,7 @@ enum MissingCtors<'tcx> { // to compute the full set.) fn compute_missing_ctors<'a, 'tcx: 'a>( info: MissingCtorsInfo, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, all_ctors: &Vec>, used_ctors: &Vec>, ) -> MissingCtors<'tcx> { @@ -1424,7 +1424,7 @@ fn constructor_sub_pattern_tys<'a, 'tcx: 'a>(cx: &MatchCheckCtxt<'a, 'tcx>, // meaning all other types will compare unequal and thus equal patterns often do not cause the // second pattern to lint about unreachable match arms. fn slice_pat_covered_by_const<'tcx>( - tcx: TyCtxt<'_, 'tcx, '_>, + tcx: TyCtxt<'tcx, '_>, _span: Span, const_val: &'tcx ty::Const<'tcx>, prefix: &[Pattern<'tcx>], @@ -1477,7 +1477,7 @@ fn slice_pat_covered_by_const<'tcx>( // Whether to evaluate a constructor using exhaustive integer matching. This is true if the // constructor is a range or constant with an integer type. fn should_treat_range_exhaustively( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>, ) -> bool { let ty = match ctor { @@ -1525,7 +1525,7 @@ fn should_treat_range_exhaustively( /// between every pair of boundary points. (This essentially sums up to performing the intuitive /// merging operation depicted above.) fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctors: Vec>, &Matrix(ref m): &Matrix<'p, 'tcx>, ty: Ty<'tcx>, @@ -1603,7 +1603,7 @@ fn split_grouped_constructors<'p, 'a: 'p, 'tcx: 'a>( /// Checks whether there exists any shared value in either `ctor` or `pat` by intersecting them. fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &'p Pattern<'tcx>, ) -> Option; 2]>> { @@ -1631,7 +1631,7 @@ fn constructor_intersects_pattern<'p, 'a: 'p, 'tcx: 'a>( } fn constructor_covered_by_range<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ctor: &Constructor<'tcx>, pat: &Pattern<'tcx>, ) -> Result { diff --git a/src/librustc_mir/hair/pattern/check_match.rs b/src/librustc_mir/hair/pattern/check_match.rs index 9b85ea53fa3ec..0a60ed19b9a47 100644 --- a/src/librustc_mir/hair/pattern/check_match.rs +++ b/src/librustc_mir/hair/pattern/check_match.rs @@ -26,7 +26,7 @@ use std::slice; use syntax::ptr::P; use syntax_pos::{Span, DUMMY_SP, MultiSpan}; -pub(crate) fn check_match<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub(crate) fn check_match<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let body_id = if let Some(id) = tcx.hir().as_local_hir_id(def_id) { tcx.hir().body_owned_by(id) } else { @@ -48,7 +48,7 @@ fn create_e0004<'a>(sess: &'a Session, sp: Span, error_message: String) -> Diagn } struct MatchVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body_owner: DefId, tables: &'a ty::TypeckTables<'tcx>, param_env: ty::ParamEnv<'tcx>, diff --git a/src/librustc_mir/hair/pattern/mod.rs b/src/librustc_mir/hair/pattern/mod.rs index 1a69f37ac2ded..67325e7b75c83 100644 --- a/src/librustc_mir/hair/pattern/mod.rs +++ b/src/librustc_mir/hair/pattern/mod.rs @@ -327,7 +327,7 @@ impl<'tcx> fmt::Display for Pattern<'tcx> { } pub struct PatternContext<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, pub tables: &'a ty::TypeckTables<'tcx>, pub substs: SubstsRef<'tcx>, @@ -335,7 +335,7 @@ pub struct PatternContext<'a, 'tcx: 'a> { } impl<'a, 'tcx> Pattern<'tcx> { - pub fn from_hir(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn from_hir(tcx: TyCtxt<'tcx, 'tcx>, param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>, pat: &'tcx hir::Pat) -> Self { @@ -351,7 +351,7 @@ impl<'a, 'tcx> Pattern<'tcx> { } impl<'a, 'tcx> PatternContext<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, param_env_and_substs: ty::ParamEnvAnd<'tcx, SubstsRef<'tcx>>, tables: &'a ty::TypeckTables<'tcx>) -> Self { PatternContext { @@ -1055,7 +1055,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } impl UserAnnotatedTyHelpers<'tcx, 'tcx> for PatternContext<'_, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -1243,7 +1243,7 @@ impl<'tcx> PatternFoldable<'tcx> for PatternKind<'tcx> { } pub fn compare_const_vals<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, a: &'tcx ty::Const<'tcx>, b: &'tcx ty::Const<'tcx>, ty: ty::ParamEnvAnd<'tcx, Ty<'tcx>>, diff --git a/src/librustc_mir/hair/util.rs b/src/librustc_mir/hair/util.rs index 32ea39e35a5e5..3b52f45519030 100644 --- a/src/librustc_mir/hair/util.rs +++ b/src/librustc_mir/hair/util.rs @@ -2,7 +2,7 @@ use rustc::hir; use rustc::ty::{self, CanonicalUserType, TyCtxt, UserType}; crate trait UserAnnotatedTyHelpers<'gcx: 'tcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'gcx, 'tcx>; fn tables(&self) -> &ty::TypeckTables<'tcx>; diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index f085580f68cc7..5b91b88f276ed 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -173,7 +173,7 @@ impl<'mir, 'tcx, M> layout::HasTyCtxt<'tcx> for InterpretCx<'mir, 'tcx, M> where M: Machine<'mir, 'tcx> { #[inline] - fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'d>(&'d self) -> TyCtxt<'tcx, 'tcx> { *self.tcx } } diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 2ce3fef38f54f..9c3dc40a5e1a0 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -10,7 +10,7 @@ use std::fmt::Write; use rustc::mir::interpret::{Allocation, ConstValue}; struct AbsolutePathPrinter<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, path: String, } @@ -23,7 +23,7 @@ impl<'tcx> Printer<'tcx, 'tcx> for AbsolutePathPrinter<'tcx> { type DynExistential = Self; type Const = Self; - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -212,7 +212,7 @@ impl Write for AbsolutePathPrinter<'_> { /// Produces an absolute path representation of the given type. See also the documentation on /// `std::any::type_name` -pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { +pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty::Const<'tcx> { let alloc = alloc_type_name(tcx, ty); tcx.mk_const(ty::Const { val: ConstValue::Slice { @@ -226,7 +226,7 @@ pub fn type_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ty: Ty<'tcx>) -> &'tcx ty: /// Directly returns an `Allocation` containing an absolute path representation of the given type. pub(super) fn alloc_type_name<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx> ) -> &'tcx Allocation { let path = AbsolutePathPrinter { tcx, path: String::new() }.print_type(ty).unwrap().path; diff --git a/src/librustc_mir/interpret/snapshot.rs b/src/librustc_mir/interpret/snapshot.rs index 15ef05ca8cea4..1258dc041b83a 100644 --- a/src/librustc_mir/interpret/snapshot.rs +++ b/src/librustc_mir/interpret/snapshot.rs @@ -47,7 +47,7 @@ impl<'mir, 'tcx> InfiniteLoopDetector<'mir, 'tcx> { pub fn observe_and_analyze( &mut self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, span: Span, memory: &Memory<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, stack: &[Frame<'mir, 'tcx>], diff --git a/src/librustc_mir/lints.rs b/src/librustc_mir/lints.rs index 7e637a4130dc1..1cd48312412cc 100644 --- a/src/librustc_mir/lints.rs +++ b/src/librustc_mir/lints.rs @@ -7,7 +7,7 @@ use rustc::mir::{self, Body, TerminatorKind}; use rustc::ty::{self, AssocItem, AssocItemContainer, Instance, TyCtxt}; use rustc::ty::subst::InternalSubsts; -pub fn check(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check(tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -17,7 +17,7 @@ pub fn check(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_fn_for_unconditional_recursion(tcx: TyCtxt<'tcx, 'tcx>, fn_kind: FnKind<'_>, body: &Body<'tcx>, def_id: DefId) { diff --git a/src/librustc_mir/monomorphize/collector.rs b/src/librustc_mir/monomorphize/collector.rs index 641f1f47ea407..30d1ea726f9a8 100644 --- a/src/librustc_mir/monomorphize/collector.rs +++ b/src/librustc_mir/monomorphize/collector.rs @@ -281,7 +281,7 @@ impl<'tcx> InliningMap<'tcx> { } } -pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, mode: MonoItemCollectionMode) -> (FxHashSet>, InliningMap<'tcx>) { @@ -315,7 +315,7 @@ pub fn collect_crate_mono_items<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Find all non-generic items by walking the HIR. These items serve as roots to // start monomorphizing from. -fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, mode: MonoItemCollectionMode) -> Vec> { debug!("Collecting roots"); @@ -347,7 +347,7 @@ fn collect_roots<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } // Collect all monomorphized items reachable from `starting_point` -fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx>, starting_point: MonoItem<'tcx>, visited: MTRef<'_, MTLock>>>, recursion_depths: &mut DefIdMap, @@ -413,7 +413,7 @@ fn collect_items_rec<'a, 'tcx: 'a>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug!("END collect_items_rec({})", starting_point.to_string(tcx, true)); } -fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, caller: MonoItem<'tcx>, callees: &[MonoItem<'tcx>], inlining_map: MTRef<'_, MTLock>>) { @@ -429,7 +429,7 @@ fn record_accesses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, inlining_map.lock_mut().record_accesses(caller, accesses); } -fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, recursion_depths: &mut DefIdMap) -> (DefId, usize) { @@ -463,7 +463,7 @@ fn check_recursion_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, (def_id, recursion_depth) } -fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>) { let type_length = instance.substs.types().flat_map(|ty| ty.walk()).count(); @@ -515,7 +515,7 @@ fn check_type_length_limit<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct MirNeighborCollector<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a mir::Body<'tcx>, output: &'a mut Vec>, param_substs: SubstsRef<'tcx>, @@ -679,7 +679,7 @@ impl<'a, 'tcx> MirVisitor<'tcx> for MirNeighborCollector<'a, 'tcx> { } } -fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -688,7 +688,7 @@ fn visit_drop_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, visit_instance_use(tcx, instance, is_direct_call, output); } -fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -702,7 +702,7 @@ fn visit_fn_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: ty::Instance<'tcx>, is_direct_call: bool, output: &mut Vec>) @@ -741,7 +741,7 @@ fn visit_instance_use<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // Returns true if we should codegen an instance in the local crate. // Returns false if we can just link to the upstream crate and therefore don't // need a mono item. -fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &Instance<'tcx>) +fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: &Instance<'tcx>) -> bool { let def_id = match instance.def { ty::InstanceDef::Item(def_id) => def_id, @@ -776,7 +776,7 @@ fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &I } return true; - fn is_available_upstream_generic<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn is_available_upstream_generic<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>) -> bool { @@ -841,7 +841,7 @@ fn should_monomorphize_locally<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, instance: &I /// /// Finally, there is also the case of custom unsizing coercions, e.g., for /// smart pointers such as `Rc` and `Arc`. -fn find_vtable_types_for_unsizing<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn find_vtable_types_for_unsizing<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> (Ty<'tcx>, Ty<'tcx>) { @@ -914,7 +914,7 @@ fn create_fn_mono_item<'tcx>(instance: Instance<'tcx>) -> MonoItem<'tcx> { /// Creates a `MonoItem` for each method that is referenced by the vtable for /// the given trait/impl pair. -fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_ty: Ty<'tcx>, impl_ty: Ty<'tcx>, output: &mut Vec>) { @@ -949,7 +949,7 @@ fn create_mono_items_for_vtable_methods<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, //=----------------------------------------------------------------------------- struct RootCollector<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mode: MonoItemCollectionMode, output: &'a mut Vec>, entry_fn: Option<(DefId, EntryFnType)>, @@ -1107,12 +1107,12 @@ impl RootCollector<'_, 'v> { } } -fn item_requires_monomorphization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn item_requires_monomorphization<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { let generics = tcx.generics_of(def_id); generics.requires_monomorphization(tcx) } -fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &'tcx hir::Item, output: &mut Vec>) { match item.node { @@ -1177,7 +1177,7 @@ fn create_mono_items_for_default_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Scan the miri alloc in order to find function calls, closures, and drop-glue fn collect_miri<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, alloc_id: AllocId, output: &mut Vec>, ) { @@ -1207,7 +1207,7 @@ fn collect_miri<'tcx>( } /// Scan the MIR in order to find function calls, closures, and drop-glue -fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: Instance<'tcx>, output: &mut Vec>) { @@ -1237,7 +1237,7 @@ fn collect_neighbours<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> String { let mut output = String::new(); @@ -1247,7 +1247,7 @@ fn def_id_to_string<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn collect_const<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, constant: &'tcx ty::Const<'tcx>, param_substs: SubstsRef<'tcx>, output: &mut Vec>, diff --git a/src/librustc_mir/monomorphize/item.rs b/src/librustc_mir/monomorphize/item.rs index f23d98cfe1cd4..2ba9600dfc9f0 100644 --- a/src/librustc_mir/monomorphize/item.rs +++ b/src/librustc_mir/monomorphize/item.rs @@ -48,7 +48,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } - fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> ty::SymbolName { + fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx>) -> ty::SymbolName { match *self.as_mono_item() { MonoItem::Fn(instance) => tcx.symbol_name(instance), MonoItem::Static(def_id) => { @@ -63,7 +63,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } fn instantiation_mode(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> InstantiationMode { let inline_in_all_cgus = tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| { @@ -108,7 +108,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } - fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { let def_id = match *self.as_mono_item() { MonoItem::Fn(ref instance) => instance.def_id(), MonoItem::Static(def_id) => def_id, @@ -144,7 +144,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { /// Similarly, if a vtable method has such a signature, and therefore can't /// be used, we can just not emit it and have a placeholder (a null pointer, /// which will never be accessed) in its place. - fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> bool { + fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool { debug!("is_instantiable({:?})", self); let (def_id, substs) = match *self.as_mono_item() { MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs), @@ -156,7 +156,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { tcx.substitute_normalize_and_test_predicates((def_id, &substs)) } - fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, debug: bool) -> String { + fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx>, debug: bool) -> String { return match *self.as_mono_item() { MonoItem::Fn(instance) => { to_string_internal(tcx, "fn ", instance, debug) @@ -170,7 +170,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } }; - fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, prefix: &str, instance: Instance<'tcx>, debug: bool) @@ -183,7 +183,7 @@ pub trait MonoItemExt<'tcx>: fmt::Debug { } } - fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { + fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option { match *self.as_mono_item() { MonoItem::Fn(Instance { def, .. }) => { tcx.hir().as_local_hir_id(def.def_id()) diff --git a/src/librustc_mir/monomorphize/mod.rs b/src/librustc_mir/monomorphize/mod.rs index 1e9b13cc60c21..929c2126b4d9e 100644 --- a/src/librustc_mir/monomorphize/mod.rs +++ b/src/librustc_mir/monomorphize/mod.rs @@ -5,7 +5,7 @@ use rustc::ty::{self, Ty, TyCtxt}; pub mod collector; pub mod partitioning; -pub fn custom_coerce_unsize_info<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn custom_coerce_unsize_info<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, source_ty: Ty<'tcx>, target_ty: Ty<'tcx>) -> CustomCoerceUnsized { diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index db786b5320bb7..38c887751b68f 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -125,7 +125,7 @@ fn fallback_cgu_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>) -> Inter name_builder.build_cgu_name(LOCAL_CRATE, &["fallback"], Some("cgu")) } -pub fn partition<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn partition<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_items: I, strategy: PartitioningStrategy, inlining_map: &InliningMap<'tcx>) @@ -201,7 +201,7 @@ struct PostInliningPartitioning<'tcx> { internalization_candidates: FxHashSet>, } -fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_items: I) -> PreInliningPartitioning<'tcx> where I: Iterator> @@ -276,7 +276,7 @@ fn place_root_mono_items<'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn mono_item_linkage_and_visibility( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mono_item: &MonoItem<'tcx>, can_be_internalized: &mut bool, export_generics: bool, @@ -294,7 +294,7 @@ fn mono_item_linkage_and_visibility( } fn mono_item_visibility( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mono_item: &MonoItem<'tcx>, can_be_internalized: &mut bool, export_generics: bool, @@ -439,7 +439,7 @@ fn mono_item_visibility( } } -fn default_visibility(tcx: TyCtxt<'_, '_, '_>, id: DefId, is_generic: bool) -> Visibility { +fn default_visibility(tcx: TyCtxt<'_, '_>, id: DefId, is_generic: bool) -> Visibility { if !tcx.sess.target.target.options.default_hidden_visibility { return Visibility::Default } @@ -463,7 +463,7 @@ fn default_visibility(tcx: TyCtxt<'_, '_, '_>, id: DefId, is_generic: bool) -> V } } -fn merge_codegen_units<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn merge_codegen_units<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, initial_partitioning: &mut PreInliningPartitioning<'tcx>, target_cgu_count: usize) { assert!(target_cgu_count >= 1); @@ -585,7 +585,7 @@ fn place_inlined_mono_items<'tcx>(initial_partitioning: PreInliningPartitioning< } } -fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx>, partitioning: &mut PostInliningPartitioning<'tcx>, inlining_map: &InliningMap<'tcx>) { if partitioning.codegen_units.len() == 1 { @@ -650,7 +650,7 @@ fn internalize_symbols<'tcx>(_tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, mono_item: MonoItem<'tcx>) -> Option { match mono_item { @@ -698,7 +698,7 @@ fn characteristic_def_id_of_mono_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, type CguNameCache = FxHashMap<(DefId, bool), InternedString>; -fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_, '_>, +fn compute_codegen_unit_name(tcx: TyCtxt<'_, '_>, name_builder: &mut CodegenUnitNameBuilder<'_, '_>, def_id: DefId, volatile: bool, @@ -758,7 +758,7 @@ fn numbered_codegen_unit_name(name_builder: &mut CodegenUnitNameBuilder<'_, '_>, name_builder.build_cgu_name_no_mangle(LOCAL_CRATE, &["cgu"], Some(index)) } -fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx>, label: &str, cgus: I) where I: Iterator>, @@ -787,7 +787,7 @@ fn debug_dump<'a, 'b, 'tcx, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } #[inline(never)] // give this a place in the profiler -fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, mono_items: I) +fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx>, mono_items: I) where I: Iterator> { let mut symbols: Vec<_> = mono_items.map(|mono_item| { @@ -831,7 +831,7 @@ fn assert_symbols_are_distinct<'a, 'tcx: 'a, I>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, m } fn collect_and_partition_mono_items<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> (Arc, Arc>>>) { diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index cde7e685a0e83..f63e6996ddcbf 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -26,7 +26,7 @@ pub fn provide(providers: &mut Providers<'_>) { providers.mir_shims = make_shim; } -fn make_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn make_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, instance: ty::InstanceDef<'tcx>) -> &'tcx Body<'tcx> { @@ -166,7 +166,7 @@ fn local_decls_for_sig<'tcx>(sig: &ty::FnSig<'tcx>, span: Span) .collect() } -fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ty: Option>) -> Body<'tcx> @@ -258,7 +258,7 @@ fn build_drop_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, pub struct DropShimElaborator<'a, 'tcx: 'a> { pub body: &'a Body<'tcx>, pub patch: MirPatch<'tcx>, - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub param_env: ty::ParamEnv<'tcx>, } @@ -273,7 +273,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { fn patch(&mut self) -> &mut MirPatch<'tcx> { &mut self.patch } fn body(&self) -> &'a Body<'tcx> { self.body } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn param_env(&self) -> ty::ParamEnv<'tcx> { self.param_env } fn drop_style(&self, _path: Self::Path, mode: DropFlagMode) -> DropStyle { @@ -306,7 +306,7 @@ impl<'a, 'tcx> DropElaborator<'a, 'tcx> for DropShimElaborator<'a, 'tcx> { } /// Builds a `Clone::clone` shim for `self_ty`. Here, `def_id` is `Clone::clone`. -fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Body<'tcx> @@ -341,7 +341,7 @@ fn build_clone_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct CloneShimBuilder<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, local_decls: IndexVec>, blocks: IndexVec>, @@ -350,7 +350,7 @@ struct CloneShimBuilder<'tcx> { } impl CloneShimBuilder<'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn new(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, self_ty: Ty<'tcx>) -> Self { // we must subst the self_ty because it's @@ -691,7 +691,7 @@ impl CloneShimBuilder<'tcx> { /// /// If `untuple_args` is a vec of types, the second argument of the /// function will be untupled as these types. -fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, rcvr_adjustment: Adjustment, call_kind: CallKind, @@ -842,7 +842,7 @@ fn build_call_shim<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body } -pub fn build_adt_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: DefId) -> &'tcx Body<'tcx> { +pub fn build_adt_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ctor_id: DefId) -> &'tcx Body<'tcx> { debug_assert!(tcx.is_constructor(ctor_id)); let span = tcx.hir().span_if_local(ctor_id) diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 18b219422d1a5..f71a1b42611d1 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -32,7 +32,7 @@ pub use self::AddCallGuards::*; impl MirPass for AddCallGuards { fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { self.add_call_guards(body); diff --git a/src/librustc_mir/transform/add_moves_for_packed_drops.rs b/src/librustc_mir/transform/add_moves_for_packed_drops.rs index 1b9f2093ac120..e0b8805ebfb34 100644 --- a/src/librustc_mir/transform/add_moves_for_packed_drops.rs +++ b/src/librustc_mir/transform/add_moves_for_packed_drops.rs @@ -41,7 +41,7 @@ pub struct AddMovesForPackedDrops; impl MirPass for AddMovesForPackedDrops { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -51,7 +51,7 @@ impl MirPass for AddMovesForPackedDrops { } pub fn add_moves_for_packed_drops<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>, def_id: DefId) { @@ -60,7 +60,7 @@ pub fn add_moves_for_packed_drops<'tcx>( } fn add_moves_for_packed_drops_patch<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId) -> MirPatch<'tcx> @@ -91,7 +91,7 @@ fn add_moves_for_packed_drops_patch<'tcx>( } fn add_move_for_packed_drop<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, patch: &mut MirPatch<'tcx>, terminator: &Terminator<'tcx>, diff --git a/src/librustc_mir/transform/add_retag.rs b/src/librustc_mir/transform/add_retag.rs index 43ff3619bf168..8f6c83e170294 100644 --- a/src/librustc_mir/transform/add_retag.rs +++ b/src/librustc_mir/transform/add_retag.rs @@ -48,7 +48,7 @@ fn is_stable<'tcx>( /// Determine whether this type may have a reference in it, recursing below compound types but /// not below references. -fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> bool { +fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'gcx, 'tcx>) -> bool { match ty.sty { // Primitive types that are not references ty::Bool | ty::Char | @@ -75,7 +75,7 @@ fn may_have_reference<'gcx, 'tcx>(ty: Ty<'tcx>, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) - impl MirPass for AddRetag { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { diff --git a/src/librustc_mir/transform/check_unsafety.rs b/src/librustc_mir/transform/check_unsafety.rs index e418ac7a7c7df..84462c3940df4 100644 --- a/src/librustc_mir/transform/check_unsafety.rs +++ b/src/librustc_mir/transform/check_unsafety.rs @@ -25,7 +25,7 @@ pub struct UnsafetyChecker<'a, 'tcx: 'a> { source_scope_local_data: &'a IndexVec, violations: Vec, source_info: SourceInfo, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, /// Mark an `unsafe` block as used, so we don't lint it. used_unsafe: FxHashSet, @@ -38,7 +38,7 @@ impl<'a, 'tcx> UnsafetyChecker<'a, 'tcx> { min_const_fn: bool, body: &'a Body<'tcx>, source_scope_local_data: &'a IndexVec, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ) -> Self { // sanity check @@ -480,7 +480,7 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> { } } -fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, used_unsafe: &FxHashSet, unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>) @@ -505,7 +505,7 @@ fn check_unused_unsafe<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir::intravisit::Visitor::visit_body(&mut visitor, body); } -fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> UnsafetyCheckResult { debug!("unsafety_violations({:?})", def_id); @@ -546,7 +546,7 @@ fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) } } -fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let lint_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap_or_else(|| bug!("checking unsafety for non-local def id {:?}", def_id)); @@ -566,7 +566,7 @@ fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: Def } /// Returns the `HirId` for an enclosing scope that is also `unsafe`. -fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, +fn is_enclosed(tcx: TyCtxt<'_, '_>, used_unsafe: &FxHashSet, id: hir::HirId) -> Option<(String, hir::HirId)> { let parent_id = tcx.hir().get_parent_node_by_hir_id(id); @@ -589,7 +589,7 @@ fn is_enclosed(tcx: TyCtxt<'_, '_, '_>, } } -fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, +fn report_unused_unsafe(tcx: TyCtxt<'_, '_>, used_unsafe: &FxHashSet, id: hir::HirId) { let span = tcx.sess.source_map().def_span(tcx.hir().span_by_hir_id(id)); @@ -603,7 +603,7 @@ fn report_unused_unsafe(tcx: TyCtxt<'_, '_, '_>, db.emit(); } -fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Option { +fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { debug!("builtin_derive_def_id({:?})", def_id); if let Some(impl_def_id) = tcx.impl_of_method(def_id) { if tcx.has_attr(impl_def_id, sym::automatically_derived) { @@ -619,7 +619,7 @@ fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> } } -pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { debug!("check_unsafety({:?})", def_id); // closures are handled by their parent fn. diff --git a/src/librustc_mir/transform/cleanup_post_borrowck.rs b/src/librustc_mir/transform/cleanup_post_borrowck.rs index 0484f5c8b389c..f552e635299e9 100644 --- a/src/librustc_mir/transform/cleanup_post_borrowck.rs +++ b/src/librustc_mir/transform/cleanup_post_borrowck.rs @@ -28,7 +28,7 @@ pub struct DeleteNonCodegenStatements; impl MirPass for CleanupNonCodegenStatements { fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut delete = DeleteNonCodegenStatements; diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 1a42b01f452c2..d7c3cd52ebd05 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -32,7 +32,7 @@ pub struct ConstProp; impl MirPass for ConstProp { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { // will be evaluated by miri and produce its errors there @@ -85,7 +85,7 @@ type Const<'tcx> = OpTy<'tcx>; /// Finds optimization opportunities on the MIR. struct ConstPropagator<'mir, 'tcx> { ecx: InterpretCx<'mir, 'tcx, CompileTimeInterpreter<'mir, 'tcx>>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, places: IndexVec>>, can_const_prop: IndexVec, @@ -113,7 +113,7 @@ impl<'mir, 'tcx> HasDataLayout for ConstPropagator<'mir, 'tcx> { impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> { #[inline] - fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } @@ -121,7 +121,7 @@ impl<'mir, 'tcx> HasTyCtxt<'tcx> for ConstPropagator<'mir, 'tcx> { impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { fn new( body: &mut Body<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, ) -> ConstPropagator<'mir, 'tcx> { let param_env = tcx.param_env(source.def_id()); @@ -599,7 +599,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } } -fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index 64e139bfe9152..6282c7855f35c 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -31,7 +31,7 @@ pub struct CopyPropagation; impl MirPass for CopyPropagation { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { // We only run when the MIR optimization level is > 1. diff --git a/src/librustc_mir/transform/deaggregator.rs b/src/librustc_mir/transform/deaggregator.rs index e43f1f6f58066..5ba7ba193d00e 100644 --- a/src/librustc_mir/transform/deaggregator.rs +++ b/src/librustc_mir/transform/deaggregator.rs @@ -7,7 +7,7 @@ pub struct Deaggregator; impl MirPass for Deaggregator { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, body: &mut Body<'tcx>) { let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut(); diff --git a/src/librustc_mir/transform/dump_mir.rs b/src/librustc_mir/transform/dump_mir.rs index 77ba0ceb7c362..52aafdef87ecb 100644 --- a/src/librustc_mir/transform/dump_mir.rs +++ b/src/librustc_mir/transform/dump_mir.rs @@ -19,7 +19,7 @@ impl MirPass for Marker { } fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _source: MirSource<'tcx>, _body: &mut Body<'tcx>) { @@ -38,7 +38,7 @@ impl fmt::Display for Disambiguator { } -pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, pass_num: &dyn fmt::Display, pass_name: &str, source: MirSource<'tcx>, @@ -56,7 +56,7 @@ pub fn on_mir_pass<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } pub fn emit_mir<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, outputs: &OutputFilenames) -> io::Result<()> { diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index 66977bfabf408..2a187753626fd 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -22,7 +22,7 @@ pub struct ElaborateDrops; impl MirPass for ElaborateDrops { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { @@ -78,7 +78,7 @@ impl MirPass for ElaborateDrops { /// to not be reachable, because they are `drop` terminators /// that can't drop anything. fn find_dead_unwinds< 'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: hir::def_id::DefId, env: &MoveDataParamEnv<'tcx, 'tcx>) @@ -142,7 +142,7 @@ struct InitializationData { impl InitializationData { fn apply_location<'tcx>(&mut self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, env: &MoveDataParamEnv<'tcx, 'tcx>, loc: Location) @@ -190,7 +190,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { self.ctxt.body } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.ctxt.tcx } @@ -290,7 +290,7 @@ impl<'a, 'b, 'tcx> DropElaborator<'a, 'tcx> for Elaborator<'a, 'b, 'tcx> { } struct ElaborateDropsCtxt<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, env: &'a MoveDataParamEnv<'tcx, 'tcx>, flow_inits: DataflowResults<'tcx, MaybeInitializedPlaces<'a, 'tcx, 'tcx>>, diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 8a5a5fea393df..78713fee82cd8 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -11,11 +11,11 @@ use rustc::mir::visit::{MutVisitor, TyContext}; use crate::transform::{MirPass, MirSource}; struct EraseRegionsVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl EraseRegionsVisitor<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { + pub fn new(tcx: TyCtxt<'tcx, 'tcx>) -> Self { EraseRegionsVisitor { tcx, } @@ -51,7 +51,7 @@ pub struct EraseRegions; impl MirPass for EraseRegions { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { EraseRegionsVisitor::new(tcx).visit_body(body); diff --git a/src/librustc_mir/transform/generator.rs b/src/librustc_mir/transform/generator.rs index 0ded39e21a091..a3fef7c97b4c2 100644 --- a/src/librustc_mir/transform/generator.rs +++ b/src/librustc_mir/transform/generator.rs @@ -169,7 +169,7 @@ struct SuspensionPoint { } struct TransformVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, state_adt_ref: &'tcx AdtDef, state_substs: SubstsRef<'tcx>, @@ -311,7 +311,7 @@ impl MutVisitor<'tcx> for TransformVisitor<'tcx> { } fn make_generator_state_argument_indirect<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { let gen_ty = body.local_decls.raw[1].ty; @@ -336,7 +336,7 @@ fn make_generator_state_argument_indirect<'tcx>( } fn make_generator_state_argument_pinned<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { let ref_gen_ty = body.local_decls.raw[1].ty; @@ -416,7 +416,7 @@ struct LivenessInfo { } fn locals_live_across_suspend_points( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, source: MirSource<'tcx>, movable: bool, @@ -678,7 +678,7 @@ impl<'body, 'tcx: 'body, 's> StorageConflictVisitor<'body, 'tcx, 's> { } } -fn compute_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compute_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, upvars: &Vec>, interior: Ty<'tcx>, @@ -797,7 +797,7 @@ fn insert_switch<'tcx>(body: &mut Body<'tcx>, } } -fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &mut Body<'tcx>) { use crate::util::elaborate_drops::{elaborate_drop, Unwind}; @@ -849,7 +849,7 @@ fn elaborate_generator_drops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn create_generator_drop_shim<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, transform: &TransformVisitor<'tcx>, def_id: DefId, source: MirSource<'tcx>, @@ -939,7 +939,7 @@ fn insert_term_block<'tcx>(body: &mut Body<'tcx>, kind: TerminatorKind<'tcx>) -> term_block } -fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>, message: AssertMessage<'tcx>) -> BasicBlock { let assert_block = BasicBlock::new(body.basic_blocks().len()); @@ -970,7 +970,7 @@ fn insert_panic_block<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn create_generator_resume_function<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, transform: TransformVisitor<'tcx>, def_id: DefId, source: MirSource<'tcx>, @@ -1084,7 +1084,7 @@ fn create_cases<'tcx, F>(body: &mut Body<'tcx>, impl MirPass for StateTransform { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { let yield_ty = if let Some(yield_ty) = body.yield_ty { diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index fdbf4ea8d9f1c..2818c11da4697 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -39,7 +39,7 @@ struct CallSite<'tcx> { impl MirPass for Inline { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) { if tcx.sess.opts.debugging_opts.mir_opt_level >= 2 { @@ -49,7 +49,7 @@ impl MirPass for Inline { } struct Inliner<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, } @@ -631,7 +631,7 @@ impl Inliner<'tcx> { } } -fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn type_size_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, ty: Ty<'tcx>) -> Option { tcx.layout_of(param_env.and(ty)).ok().map(|layout| layout.size.bytes()) diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 784e3ed5187f1..89be1ba0bdf2f 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -13,7 +13,7 @@ pub struct InstCombine; impl MirPass for InstCombine { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { // We only run when optimizing MIR (at any level). @@ -65,12 +65,12 @@ impl<'tcx> MutVisitor<'tcx> for InstCombineVisitor<'tcx> { /// Finds optimization opportunities on the MIR. struct OptimizationFinder<'b, 'tcx> { body: &'b Body<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, optimizations: OptimizationList<'tcx>, } impl OptimizationFinder<'b, 'tcx> { - fn new(body: &'b Body<'tcx>, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> OptimizationFinder<'b, 'tcx> { + fn new(body: &'b Body<'tcx>, tcx: TyCtxt<'tcx, 'tcx>) -> OptimizationFinder<'b, 'tcx> { OptimizationFinder { body, tcx, diff --git a/src/librustc_mir/transform/lower_128bit.rs b/src/librustc_mir/transform/lower_128bit.rs index 47ac87ad795fa..2b28eeb801ff8 100644 --- a/src/librustc_mir/transform/lower_128bit.rs +++ b/src/librustc_mir/transform/lower_128bit.rs @@ -11,7 +11,7 @@ pub struct Lower128Bit; impl MirPass for Lower128Bit { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let debugging_override = tcx.sess.opts.debugging_opts.lower_128bit_ops; @@ -25,7 +25,7 @@ impl MirPass for Lower128Bit { } impl Lower128Bit { - fn lower_128bit_ops<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { + fn lower_128bit_ops<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { let mut new_blocks = Vec::new(); let cur_len = body.basic_blocks().len(); @@ -126,7 +126,7 @@ fn check_lang_item_type<'tcx, D>( lhs: &Operand<'tcx>, rhs: &Operand<'tcx>, local_decls: &D, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>) + tcx: TyCtxt<'tcx, 'tcx>) -> DefId where D: HasLocalDecls<'tcx> { @@ -142,7 +142,7 @@ fn check_lang_item_type<'tcx, D>( did } -fn lower_to<'tcx, D>(statement: &Statement<'tcx>, local_decls: &D, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +fn lower_to<'tcx, D>(statement: &Statement<'tcx>, local_decls: &D, tcx: TyCtxt<'tcx, 'tcx>) -> Option<(LangItem, RhsKind)> where D: HasLocalDecls<'tcx> { @@ -172,7 +172,7 @@ enum RhsKind { } impl RhsKind { - fn ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option> { + fn ty<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option> { match *self { RhsKind::Unchanged => None, RhsKind::ForceU128 => Some(tcx.types.u128), diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index c569f8d65f6c5..eb89648826748 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -50,13 +50,13 @@ pub(crate) fn provide(providers: &mut Providers<'_>) { }; } -fn is_mir_available<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_mir_available<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { tcx.mir_keys(def_id.krate).contains(&def_id) } /// Finds the full set of `DefId`s within the current crate that have /// MIR associated with them. -fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) +fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum) -> &'tcx DefIdSet { assert_eq!(krate, LOCAL_CRATE); @@ -68,7 +68,7 @@ fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) // Additionally, tuple struct/variant constructors have MIR, but // they don't have a BodyId, so we need to build them separately. struct GatherCtors<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, set: &'a mut DefIdSet, } impl<'a, 'tcx> Visitor<'tcx> for GatherCtors<'a, 'tcx> { @@ -95,7 +95,7 @@ fn mir_keys<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) tcx.arena.alloc(set) } -fn mir_built<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_built<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let mir = build::mir_build(tcx, def_id); tcx.alloc_steal_mir(mir) } @@ -143,13 +143,13 @@ pub trait MirPass { } fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>); } pub fn run_passes( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>, instance: InstanceDef<'tcx>, mir_phase: MirPhase, @@ -196,7 +196,7 @@ pub fn run_passes( } } -fn mir_const<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_const<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { // Unsafety check uses the raw mir, so make sure it is run let _ = tcx.unsafety_check_result(def_id); @@ -210,7 +210,7 @@ fn mir_const<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal< tcx.alloc_steal_mir(body) } -fn mir_validated(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { +fn mir_validated(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal> { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); if let hir::BodyOwnerKind::Const = tcx.hir().body_owner_kind_by_hir_id(hir_id) { // Ensure that we compute the `mir_const_qualif` for constants at @@ -227,7 +227,7 @@ fn mir_validated(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Steal(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { +fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx Body<'tcx> { if tcx.is_constructor(def_id) { // There's no reason to run all of the MIR passes on constructors when // we can just output the MIR we want directly. This also saves const diff --git a/src/librustc_mir/transform/no_landing_pads.rs b/src/librustc_mir/transform/no_landing_pads.rs index 38a5fc4c2398d..638aa1e7e02de 100644 --- a/src/librustc_mir/transform/no_landing_pads.rs +++ b/src/librustc_mir/transform/no_landing_pads.rs @@ -10,14 +10,14 @@ pub struct NoLandingPads; impl MirPass for NoLandingPads { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { no_landing_pads(tcx, body) } } -pub fn no_landing_pads<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, body: &mut Body<'tcx>) { +pub fn no_landing_pads<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { NoLandingPads.visit_body(body); } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index 63cd10f8e26fc..7bbaa99798d5f 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -148,7 +148,7 @@ pub fn collect_temps(body: &Body<'_>, } struct Promoter<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, source: &'a mut Body<'tcx>, promoted: Body<'tcx>, temps: &'a mut IndexVec, @@ -370,7 +370,7 @@ impl<'a, 'tcx> MutVisitor<'tcx> for Promoter<'a, 'tcx> { } pub fn promote_candidates<'tcx>(body: &mut Body<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, mut temps: IndexVec, candidates: Vec) { // Visit candidates in reverse, in case they're nested. diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index c0ff2d00a3979..32d3b4589629c 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -124,7 +124,7 @@ impl IndexMut for PerQualif { } struct ConstCx<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, mode: Mode, body: &'a Body<'tcx>, @@ -652,7 +652,7 @@ impl Deref for Checker<'a, 'tcx> { } impl<'a, 'tcx> Checker<'a, 'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn new(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>, mode: Mode) @@ -1472,7 +1472,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> (u8, &'tcx BitSet) { // N.B., this `borrow()` is guaranteed to be valid (i.e., the value @@ -1493,7 +1493,7 @@ pub struct QualifyAndPromoteConstants; impl MirPass for QualifyAndPromoteConstants { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { // There's not really any point in promoting errorful MIR. @@ -1668,7 +1668,7 @@ impl MirPass for QualifyAndPromoteConstants { } } -fn args_required_const(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option> { +fn args_required_const(tcx: TyCtxt<'_, '_>, def_id: DefId) -> Option> { let attrs = tcx.get_attrs(def_id); let attr = attrs.iter().find(|a| a.check_name(sym::rustc_args_required_const))?; let mut ret = FxHashSet::default(); diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 952d8f1ba0832..449d2d32456bd 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -9,7 +9,7 @@ use syntax_pos::Span; type McfResult = Result<(), (Span, Cow<'static, str>)>; pub fn is_min_const_fn( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, body: &'a Body<'tcx>, ) -> McfResult { @@ -80,7 +80,7 @@ pub fn is_min_const_fn( } fn check_ty( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>, span: Span, fn_def_id: DefId, @@ -129,7 +129,7 @@ fn check_ty( } fn check_rvalue( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, rvalue: &Rvalue<'tcx>, span: Span, @@ -209,7 +209,7 @@ fn check_rvalue( } fn check_statement( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, statement: &Statement<'tcx>, ) -> McfResult { @@ -279,7 +279,7 @@ fn check_place( } fn check_terminator( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &'a Body<'tcx>, terminator: &Terminator<'tcx>, ) -> McfResult { @@ -375,7 +375,7 @@ fn check_terminator( /// for being called from stable `const fn`s (`min_const_fn`). /// /// Adding more intrinsics requires sign-off from @rust-lang/lang. -fn is_intrinsic_whitelisted(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_intrinsic_whitelisted(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { match &tcx.item_name(def_id).as_str()[..] { | "size_of" | "min_align_of" diff --git a/src/librustc_mir/transform/remove_noop_landing_pads.rs b/src/librustc_mir/transform/remove_noop_landing_pads.rs index 5a9b30d32de3c..23541a6e6bc7e 100644 --- a/src/librustc_mir/transform/remove_noop_landing_pads.rs +++ b/src/librustc_mir/transform/remove_noop_landing_pads.rs @@ -10,7 +10,7 @@ use crate::util::patch::MirPatch; pub struct RemoveNoopLandingPads; pub fn remove_noop_landing_pads<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, body: &mut Body<'tcx>) { if tcx.sess.no_landing_pads() { @@ -23,7 +23,7 @@ pub fn remove_noop_landing_pads<'tcx>( impl MirPass for RemoveNoopLandingPads { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { remove_noop_landing_pads(tcx, body); diff --git a/src/librustc_mir/transform/rustc_peek.rs b/src/librustc_mir/transform/rustc_peek.rs index adaea15a17a10..2a25cd2c9573a 100644 --- a/src/librustc_mir/transform/rustc_peek.rs +++ b/src/librustc_mir/transform/rustc_peek.rs @@ -25,7 +25,7 @@ use crate::dataflow::has_rustc_mir_with; pub struct SanityCheck; impl MirPass for SanityCheck { - fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn run_pass<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &mut Body<'tcx>) { let def_id = src.def_id(); if !tcx.has_attr(def_id, sym::rustc_mir) { @@ -84,7 +84,7 @@ impl MirPass for SanityCheck { /// (If there are any calls to `rustc_peek` that do not match the /// expression form above, then that emits an error as well, but those /// errors are not intended to be used for unit tests.) -pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, def_id: DefId, _attributes: &[ast::Attribute], @@ -101,7 +101,7 @@ pub fn sanity_check_via_rustc_peek<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx>, body: &Body<'tcx>, results: &DataflowResults<'tcx, O>, bb: mir::BasicBlock) where @@ -214,7 +214,7 @@ fn each_block<'tcx, O>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, form `&expr`")); } -fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_rustc_peek<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, terminator: &'a Option>) -> Option<(&'a [mir::Operand<'tcx>], Span)> { if let Some(mir::Terminator { ref kind, source_info, .. }) = *terminator { diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index 92b7a76c5fa37..65838946a7859 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -58,7 +58,7 @@ impl MirPass for SimplifyCfg { } fn run_pass<'tcx>(&self, - _tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { debug!("SimplifyCfg({:?}) - simplifying {:?}", self.label, body); @@ -297,7 +297,7 @@ pub struct SimplifyLocals; impl MirPass for SimplifyLocals { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut marker = DeclMarker { locals: BitSet::new_empty(body.local_decls.len()) }; diff --git a/src/librustc_mir/transform/simplify_branches.rs b/src/librustc_mir/transform/simplify_branches.rs index 41f2572c2f562..6f6dd1a7c8095 100644 --- a/src/librustc_mir/transform/simplify_branches.rs +++ b/src/librustc_mir/transform/simplify_branches.rs @@ -20,7 +20,7 @@ impl MirPass for SimplifyBranches { } fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { for block in body.basic_blocks_mut() { diff --git a/src/librustc_mir/transform/uniform_array_move_out.rs b/src/librustc_mir/transform/uniform_array_move_out.rs index 7eae82c019c88..f71c30e587d7b 100644 --- a/src/librustc_mir/transform/uniform_array_move_out.rs +++ b/src/librustc_mir/transform/uniform_array_move_out.rs @@ -38,7 +38,7 @@ pub struct UniformArrayMoveOut; impl MirPass for UniformArrayMoveOut { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut patch = MirPatch::new(body); @@ -53,7 +53,7 @@ impl MirPass for UniformArrayMoveOut { struct UniformArrayMoveOutVisitor<'a, 'tcx: 'a> { body: &'a Body<'tcx>, patch: &'a mut MirPatch<'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl<'a, 'tcx> Visitor<'tcx> for UniformArrayMoveOutVisitor<'a, 'tcx> { @@ -163,7 +163,7 @@ pub struct RestoreSubsliceArrayMoveOut; impl MirPass for RestoreSubsliceArrayMoveOut { fn run_pass<'tcx>(&self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _src: MirSource<'tcx>, body: &mut Body<'tcx>) { let mut patch = MirPatch::new(body); diff --git a/src/librustc_mir/util/alignment.rs b/src/librustc_mir/util/alignment.rs index 5ca867d796e99..c171bef4c96c4 100644 --- a/src/librustc_mir/util/alignment.rs +++ b/src/librustc_mir/util/alignment.rs @@ -4,7 +4,7 @@ use rustc::mir::*; /// Returns `true` if this place is allowed to be less aligned /// than its containing struct (because it is within a packed /// struct). -pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, local_decls: &L, param_env: ty::ParamEnv<'tcx>, place: &Place<'tcx>) @@ -32,7 +32,7 @@ pub fn is_disaligned<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn is_within_packed<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn is_within_packed<'tcx, L>(tcx: TyCtxt<'tcx, 'tcx>, local_decls: &L, place: &Place<'tcx>) -> bool diff --git a/src/librustc_mir/util/borrowck_errors.rs b/src/librustc_mir/util/borrowck_errors.rs index 6740fe5ff6ebd..551cccf3d7d7f 100644 --- a/src/librustc_mir/util/borrowck_errors.rs +++ b/src/librustc_mir/util/borrowck_errors.rs @@ -788,7 +788,7 @@ pub trait BorrowckErrors<'cx>: Sized + Copy { } } -impl BorrowckErrors<'tcx> for TyCtxt<'tcx, 'gcx, 'tcx> { +impl BorrowckErrors<'tcx> for TyCtxt<'gcx, 'tcx> { fn struct_span_err_with_code>( self, sp: S, diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index d18abeeeb15c4..efcb23aab2ed9 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -75,7 +75,7 @@ pub trait DropElaborator<'a, 'tcx: 'a> : fmt::Debug { fn patch(&mut self) -> &mut MirPatch<'tcx>; fn body(&self) -> &'a Body<'tcx>; - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; fn param_env(&self) -> ty::ParamEnv<'tcx>; fn drop_style(&self, path: Self::Path, mode: DropFlagMode) -> DropStyle; @@ -126,7 +126,7 @@ where place.ty(self.elaborator.body(), self.tcx()).ty } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.elaborator.tcx() } diff --git a/src/librustc_mir/util/graphviz.rs b/src/librustc_mir/util/graphviz.rs index ba00fab7b8d57..2dc6c9061bf7a 100644 --- a/src/librustc_mir/util/graphviz.rs +++ b/src/librustc_mir/util/graphviz.rs @@ -8,7 +8,7 @@ use std::io::{self, Write}; use super::pretty::dump_mir_def_ids; /// Write a graphviz DOT graph of a list of MIRs. -pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'tcx, '_, 'tcx>, +pub fn write_mir_graphviz<'tcx, W>(tcx: TyCtxt<'_, 'tcx>, single: Option, w: &mut W) -> io::Result<()> @@ -32,7 +32,7 @@ pub fn graphviz_safe_def_name(def_id: DefId) -> String { } /// Write a graphviz DOT graph of the MIR. -pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'tcx, '_, 'tcx>, +pub fn write_mir_fn_graphviz<'tcx, W>(tcx: TyCtxt<'_, 'tcx>, def_id: DefId, body: &Body<'_>, w: &mut W) -> io::Result<()> @@ -133,7 +133,7 @@ fn write_edges(source: BasicBlock, body: &Body<'_>, w: &mut W) -> io:: /// Write the graphviz DOT label for the overall graph. This is essentially a block of text that /// will appear below the graph, showing the type of the `fn` this MIR represents and the types of /// all the variables and temporaries. -fn write_graph_label<'gcx, 'tcx, W: Write>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn write_graph_label<'gcx, 'tcx, W: Write>(tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, body: &Body<'_>, w: &mut W) diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs index 900e3d19670bf..39840432c690e 100644 --- a/src/librustc_mir/util/liveness.rs +++ b/src/librustc_mir/util/liveness.rs @@ -255,7 +255,7 @@ fn block<'tcx>( } pub fn dump_mir<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, body: &Body<'tcx>, @@ -272,7 +272,7 @@ pub fn dump_mir<'tcx>( } fn dump_matched_mir_node<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, pass_name: &str, node_path: &str, source: MirSource<'tcx>, @@ -295,7 +295,7 @@ fn dump_matched_mir_node<'tcx>( } pub fn write_mir_fn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, w: &mut dyn Write, diff --git a/src/librustc_mir/util/mod.rs b/src/librustc_mir/util/mod.rs index da3735e87f6b4..3563ad43051dc 100644 --- a/src/librustc_mir/util/mod.rs +++ b/src/librustc_mir/util/mod.rs @@ -22,7 +22,7 @@ pub use self::graphviz::write_node_label as write_graphviz_node_label; /// If possible, suggest replacing `ref` with `ref mut`. pub fn suggest_ref_mut<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, binding_span: Span, ) -> Option<(String)> { let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).unwrap(); diff --git a/src/librustc_mir/util/pretty.rs b/src/librustc_mir/util/pretty.rs index d5c13610e2f7a..8bf491acc26d9 100644 --- a/src/librustc_mir/util/pretty.rs +++ b/src/librustc_mir/util/pretty.rs @@ -63,7 +63,7 @@ pub enum PassWhere { /// - `foo & nll | bar & typeck` == match if `foo` and `nll` both appear in the name /// or `typeck` and `bar` both appear in the name. pub fn dump_mir<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, disambiguator: &dyn Display, @@ -94,7 +94,7 @@ pub fn dump_mir<'gcx, 'tcx, F>( } pub fn dump_enabled<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, pass_name: &str, source: MirSource<'tcx>, ) -> bool { @@ -118,7 +118,7 @@ pub fn dump_enabled<'gcx, 'tcx>( // run while we are already attempting to evaluate `type_of`. fn dump_matched_mir_node<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, pass_num: Option<&dyn Display>, pass_name: &str, node_path: &str, @@ -158,7 +158,7 @@ fn dump_matched_mir_node<'gcx, 'tcx, F>( /// Also used by other bits of code (e.g., NLL inference) that dump /// graphviz data or other things. fn dump_path( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, extension: &str, pass_num: Option<&dyn Display>, pass_name: &str, @@ -225,7 +225,7 @@ fn dump_path( /// bits of code (e.g., NLL inference) that dump graphviz data or /// other things, and hence takes the extension as an argument. pub(crate) fn create_dump_file( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, extension: &str, pass_num: Option<&dyn Display>, pass_name: &str, @@ -241,7 +241,7 @@ pub(crate) fn create_dump_file( /// Write out a human-readable textual representation for the given MIR. pub fn write_mir_pretty<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, single: Option, w: &mut dyn Write, ) -> io::Result<()> { @@ -280,7 +280,7 @@ pub fn write_mir_pretty<'gcx, 'tcx>( } pub fn write_mir_fn<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'tcx>, extra_data: &mut F, @@ -304,7 +304,7 @@ where /// Write out a human-readable textual representation for the given basic block. pub fn write_basic_block<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, block: BasicBlock, body: &Body<'tcx>, extra_data: &mut F, @@ -371,7 +371,7 @@ where /// information. There's often a lot of little things "nuzzled up" in /// a statement. fn write_extra<'gcx, 'tcx, F>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, write: &mut dyn Write, mut visit_op: F, ) -> io::Result<()> @@ -390,7 +390,7 @@ where } struct ExtraComments<'gcx, 'tcx> { - _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, // don't need it now, but bet we will soon + _tcx: TyCtxt<'gcx, 'tcx>, // don't need it now, but bet we will soon comments: Vec, } @@ -453,7 +453,7 @@ impl Visitor<'tcx> for ExtraComments<'gcx, 'tcx> { } } -fn comment(tcx: TyCtxt<'_, '_, '_>, SourceInfo { span, scope }: SourceInfo) -> String { +fn comment(tcx: TyCtxt<'_, '_>, SourceInfo { span, scope }: SourceInfo) -> String { format!( "scope {} at {}", scope.index(), @@ -463,7 +463,7 @@ fn comment(tcx: TyCtxt<'_, '_, '_>, SourceInfo { span, scope }: SourceInfo) -> S /// Prints local variables in a scope tree. fn write_scope_tree( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, body: &Body<'_>, scope_tree: &FxHashMap>, w: &mut dyn Write, @@ -539,7 +539,7 @@ fn write_scope_tree( /// Write out a human-readable textual representation of the MIR's `fn` type and the types of its /// local variables (both user-defined bindings and compiler temporaries). pub fn write_mir_intro<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, src: MirSource<'tcx>, body: &Body<'_>, w: &mut dyn Write, @@ -570,7 +570,7 @@ pub fn write_mir_intro<'gcx, 'tcx>( } fn write_mir_sig( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, src: MirSource<'tcx>, body: &Body<'_>, w: &mut dyn Write, @@ -642,7 +642,7 @@ fn write_user_type_annotations(body: &Body<'_>, w: &mut dyn Write) -> io::Result Ok(()) } -pub fn dump_mir_def_ids(tcx: TyCtxt<'_, '_, '_>, single: Option) -> Vec { +pub fn dump_mir_def_ids(tcx: TyCtxt<'_, '_>, single: Option) -> Vec { if let Some(i) = single { vec![i] } else { diff --git a/src/librustc_passes/layout_test.rs b/src/librustc_passes/layout_test.rs index b256ff487401e..c4ebd9cf89db2 100644 --- a/src/librustc_passes/layout_test.rs +++ b/src/librustc_passes/layout_test.rs @@ -14,7 +14,7 @@ use rustc::ty::TyCtxt; use syntax::ast::Attribute; use syntax::symbol::sym; -pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { if tcx.features().rustc_attrs { // if the `rustc_attrs` feature is not enabled, don't bother testing layout tcx.hir() @@ -24,7 +24,7 @@ pub fn test_layout<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct VarianceTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> { @@ -105,7 +105,7 @@ impl VarianceTest<'tcx> { } struct UnwrapLayoutCx<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, param_env: ParamEnv<'tcx>, } @@ -119,7 +119,7 @@ impl LayoutOf for UnwrapLayoutCx<'tcx> { } impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'tcx> { self.tcx } } diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 6bcf4365db0a4..4c361e975b2e0 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -45,7 +45,7 @@ struct CheckLoopVisitor<'a, 'hir: 'a> { cx: Context, } -fn check_mod_loops<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_loops<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckLoopVisitor { sess: &tcx.sess, hir_map: &tcx.hir(), diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs index 29d6bd3002785..6a26d942537c7 100644 --- a/src/librustc_passes/rvalue_promotion.rs +++ b/src/librustc_passes/rvalue_promotion.rs @@ -39,7 +39,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { @@ -51,7 +51,7 @@ fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id) } -fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ItemLocalSet { @@ -81,7 +81,7 @@ fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct CheckCrateVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, in_fn: bool, in_static: bool, mut_rvalue_borrows: HirIdSet, diff --git a/src/librustc_plugin/build.rs b/src/librustc_plugin/build.rs index 31dec72c0e41b..f269d3af91f89 100644 --- a/src/librustc_plugin/build.rs +++ b/src/librustc_plugin/build.rs @@ -30,12 +30,12 @@ impl<'v> ItemLikeVisitor<'v> for RegistrarFinder { } /// Finds the function marked with `#[plugin_registrar]`, if any. -pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Option { +pub fn find_plugin_registrar<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Option { tcx.plugin_registrar_fn(LOCAL_CRATE) } fn plugin_registrar_fn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum, ) -> Option { assert_eq!(cnum, LOCAL_CRATE); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 9cf433abc6e68..38e102345b3e7 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -49,7 +49,7 @@ mod error_codes; /// manually. Second, it doesn't visit some type components like signatures of fn types, or traits /// in `impl Trait`, see individual comments in `DefIdVisitorSkeleton::visit_ty`. trait DefIdVisitor<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx>; + fn tcx(&self) -> TyCtxt<'tcx, 'tcx>; fn shallow(&self) -> bool { false } fn skip_assoc_tys(&self) -> bool { false } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool; @@ -78,7 +78,7 @@ struct DefIdVisitorSkeleton<'v, 'tcx, V> { def_id_visitor: &'v mut V, visited_opaque_tys: FxHashSet, - dummy: PhantomData>, + dummy: PhantomData>, } impl<'tcx, V> DefIdVisitorSkeleton<'_, 'tcx, V> @@ -220,7 +220,7 @@ impl<'tcx, V> TypeVisitor<'tcx> for DefIdVisitorSkeleton<'_, 'tcx, V> } } -fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) +fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> (ty::Visibility, Span, &'static str) { match tcx.hir().as_local_hir_id(def_id) { Some(hir_id) => { @@ -323,7 +323,7 @@ fn def_id_visibility<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) // Set the correct `TypeckTables` for the given `item_id` (or an empty table if // there is no `TypeckTables` for the item). -fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>) -> &'a ty::TypeckTables<'tcx> { @@ -331,7 +331,7 @@ fn item_tables<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, if tcx.has_typeck_tables(def_id) { tcx.typeck_tables_of(def_id) } else { empty_tables } } -fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx>) -> ty::Visibility { if vis1.is_at_least(vis2, tcx) { vis2 } else { vis1 } } @@ -343,7 +343,7 @@ fn min<'tcx>(vis1: ty::Visibility, vis2: ty::Visibility, tcx: TyCtxt<'tcx, 'tcx, /// in crates that have been updated to use pub(restricted). //////////////////////////////////////////////////////////////////////////////// struct PubRestrictedVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, has_pub_restricted: bool, } @@ -361,13 +361,13 @@ impl Visitor<'tcx> for PubRestrictedVisitor<'tcx> { //////////////////////////////////////////////////////////////////////////////// struct FindMin<'a, 'tcx, VL: VisibilityLike> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a AccessLevels, min: VL, } impl<'a, 'tcx, VL: VisibilityLike> DefIdVisitor<'tcx> for FindMin<'a, 'tcx, VL> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn shallow(&self) -> bool { VL::SHALLOW } fn skip_assoc_tys(&self) -> bool { true } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { @@ -383,7 +383,7 @@ trait VisibilityLike: Sized { // Returns an over-approximation (`skip_assoc_tys` = true) of visibility due to // associated types for which we can't determine visibility precisely. - fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + fn of_impl<'a, 'tcx>(hir_id: hir::HirId, tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a AccessLevels) -> Self { let mut find = FindMin { tcx, access_levels, min: Self::MAX }; let def_id = tcx.hir().local_def_id_from_hir_id(hir_id); @@ -426,7 +426,7 @@ impl VisibilityLike for Option { //////////////////////////////////////////////////////////////////////////////// struct EmbargoVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, // Accessibility levels for reachable nodes. access_levels: AccessLevels, @@ -815,7 +815,7 @@ impl ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { } impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.ev.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.ev.tcx } fn visit_def_id(&mut self, def_id: DefId, _kind: &str, _descr: &dyn fmt::Display) -> bool { if let Some(hir_id) = self.ev.tcx.hir().as_local_hir_id(def_id) { self.ev.update(hir_id, self.access_level); @@ -832,7 +832,7 @@ impl DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { ////////////////////////////////////////////////////////////////////////////////////// struct NamePrivacyVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: hir::HirId, empty_tables: &'a ty::TypeckTables<'tcx>, @@ -959,7 +959,7 @@ impl<'a, 'tcx> Visitor<'tcx> for NamePrivacyVisitor<'a, 'tcx> { //////////////////////////////////////////////////////////////////////////////////////////// struct TypePrivacyVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'a ty::TypeckTables<'tcx>, current_item: DefId, in_body: bool, @@ -1178,7 +1178,7 @@ impl<'a, 'tcx> Visitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { } impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { self.check_def_id(def_id, kind, descr) } @@ -1192,7 +1192,7 @@ impl DefIdVisitor<'tcx> for TypePrivacyVisitor<'a, 'tcx> { /////////////////////////////////////////////////////////////////////////////// struct ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, access_levels: &'a AccessLevels, in_variant: bool, // Set of errors produced by this obsolete visitor. @@ -1536,7 +1536,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> { /////////////////////////////////////////////////////////////////////////////// struct SearchInterfaceForPrivateItemsVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId, item_def_id: DefId, span: Span, @@ -1634,14 +1634,14 @@ impl SearchInterfaceForPrivateItemsVisitor<'tcx> { } impl DefIdVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { self.tcx } + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.tcx } fn visit_def_id(&mut self, def_id: DefId, kind: &str, descr: &dyn fmt::Display) -> bool { self.check_def_id(def_id, kind, descr) } } struct PrivateItemsInPublicInterfacesVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, has_pub_restricted: bool, old_error_set: &'a HirIdSet, } @@ -1814,7 +1814,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { let empty_tables = ty::TypeckTables::empty(None); // Check privacy of names not checked in previous compilation stages. @@ -1842,7 +1842,7 @@ fn check_mod_privacy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) } fn privacy_access_levels<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum, ) -> &'tcx AccessLevels { assert_eq!(krate, LOCAL_CRATE); @@ -1868,7 +1868,7 @@ fn privacy_access_levels<'tcx>( tcx.arena.alloc(visitor.access_levels) } -fn check_private_in_public<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, krate: CrateNum) { +fn check_private_in_public<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, krate: CrateNum) { assert_eq!(krate, LOCAL_CRATE); let access_levels = tcx.privacy_access_levels(LOCAL_CRATE); diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index e000679ffe36a..3b4ea384a09a3 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -77,7 +77,7 @@ macro_rules! access_from_vis { pub struct DumpVisitor<'l, 'tcx: 'l, 'll, O: DumpOutput> { save_ctxt: SaveContext<'l, 'tcx>, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, dumper: &'ll mut JsonDumper, span: SpanUtils<'l>, diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index 1e143942a791c..139fd640d628c 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -52,7 +52,7 @@ use log::{debug, error, info}; pub struct SaveContext<'l, 'tcx: 'l> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, tables: &'l ty::TypeckTables<'tcx>, access_levels: &'l AccessLevels, span_utils: SpanUtils<'tcx>, @@ -1115,7 +1115,7 @@ impl<'b> SaveHandler for CallbackHandler<'b> { } pub fn process_crate<'l, 'tcx, H: SaveHandler>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, krate: &ast::Crate, cratename: &str, input: &'l Input, diff --git a/src/librustc_traits/chalk_context/mod.rs b/src/librustc_traits/chalk_context/mod.rs index fede04fdce23e..77f59ae6c32ce 100644 --- a/src/librustc_traits/chalk_context/mod.rs +++ b/src/librustc_traits/chalk_context/mod.rs @@ -52,7 +52,7 @@ crate struct ChalkArenas<'gcx> { #[derive(Copy, Clone)] crate struct ChalkContext<'gcx> { _arenas: ChalkArenas<'gcx>, - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, } #[derive(Copy, Clone)] @@ -527,7 +527,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_ex_clause_to_tcx( ex_clause: &ChalkExClause<'a>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> ) -> Option { Some(ChalkExClause { subst: tcx.lift(&ex_clause.subst)?, @@ -539,7 +539,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_delayed_literal_to_tcx( literal: &DelayedLiteral>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> ) -> Option { Some(match literal { DelayedLiteral::CannotProve(()) => DelayedLiteral::CannotProve(()), @@ -553,7 +553,7 @@ impl ChalkContextLift<'tcx> for ChalkArenas<'a> { fn lift_literal_to_tcx( literal: &Literal>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, ) -> Option { Some(match literal { Literal::Negative(goal) => Literal::Negative(tcx.lift(goal)?), @@ -673,7 +673,7 @@ crate fn provide(p: &mut Providers<'_>) { } crate fn evaluate_goal<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: ChalkCanonicalGoal<'tcx> ) -> Result< &'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, diff --git a/src/librustc_traits/chalk_context/program_clauses/builtin.rs b/src/librustc_traits/chalk_context/program_clauses/builtin.rs index 53375bd4cc9da..7dc8264832249 100644 --- a/src/librustc_traits/chalk_context/program_clauses/builtin.rs +++ b/src/librustc_traits/chalk_context/program_clauses/builtin.rs @@ -15,7 +15,7 @@ use crate::generic_types; /// `Implemented(ty: Trait) :- Implemented(nested: Trait)...` /// where `Trait` is specified by `trait_def_id`. fn builtin_impl_clause( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, ty: Ty<'tcx>, nested: &[Kind<'tcx>], trait_def_id: DefId @@ -43,7 +43,7 @@ fn builtin_impl_clause( } crate fn assemble_builtin_unsize_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, unsize_def_id: DefId, source: Ty<'tcx>, target: Ty<'tcx>, @@ -119,7 +119,7 @@ crate fn assemble_builtin_unsize_impls<'tcx>( } crate fn assemble_builtin_sized_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, sized_def_id: DefId, ty: Ty<'tcx>, clauses: &mut Vec> @@ -223,7 +223,7 @@ crate fn assemble_builtin_sized_impls<'tcx>( } crate fn assemble_builtin_copy_clone_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, ty: Ty<'tcx>, clauses: &mut Vec> diff --git a/src/librustc_traits/chalk_context/program_clauses/mod.rs b/src/librustc_traits/chalk_context/program_clauses/mod.rs index 2bd3902c74350..8702bc7dbc089 100644 --- a/src/librustc_traits/chalk_context/program_clauses/mod.rs +++ b/src/librustc_traits/chalk_context/program_clauses/mod.rs @@ -19,7 +19,7 @@ use self::primitive::*; use self::builtin::*; fn assemble_clauses_from_impls<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, clauses: &mut Vec> ) { @@ -33,7 +33,7 @@ fn assemble_clauses_from_impls<'tcx>( } fn assemble_clauses_from_assoc_ty_values<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, trait_def_id: DefId, clauses: &mut Vec> ) { diff --git a/src/librustc_traits/chalk_context/program_clauses/primitive.rs b/src/librustc_traits/chalk_context/program_clauses/primitive.rs index a4c3b62a6b772..a1d9e7e0cde23 100644 --- a/src/librustc_traits/chalk_context/program_clauses/primitive.rs +++ b/src/librustc_traits/chalk_context/program_clauses/primitive.rs @@ -16,7 +16,7 @@ use crate::generic_types; use std::iter; crate fn wf_clause_for_raw_ptr<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability ) -> Clauses<'tcx> { let ptr_ty = generic_types::raw_ptr(tcx, mutbl); @@ -33,7 +33,7 @@ crate fn wf_clause_for_raw_ptr<'tcx>( } crate fn wf_clause_for_fn_ptr<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, arity_and_output: usize, variadic: bool, unsafety: hir::Unsafety, @@ -53,7 +53,7 @@ crate fn wf_clause_for_fn_ptr<'tcx>( tcx.mk_clauses(iter::once(wf_clause)) } -crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Clauses<'tcx> { +crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'_, 'tcx>) -> Clauses<'tcx> { let ty = generic_types::bound(tcx, 0); let slice_ty = tcx.mk_slice(ty); @@ -83,7 +83,7 @@ crate fn wf_clause_for_slice<'tcx>(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Clauses<'tcx> } crate fn wf_clause_for_array<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, length: &'tcx ty::Const<'tcx> ) -> Clauses<'tcx> { let ty = generic_types::bound(tcx, 0); @@ -115,7 +115,7 @@ crate fn wf_clause_for_array<'tcx>( } crate fn wf_clause_for_tuple<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, arity: usize ) -> Clauses<'tcx> { let type_list = generic_types::type_list(tcx, arity); @@ -159,7 +159,7 @@ crate fn wf_clause_for_tuple<'tcx>( } crate fn wf_clause_for_ref<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability ) -> Clauses<'tcx> { let region = tcx.mk_region( @@ -186,7 +186,7 @@ crate fn wf_clause_for_ref<'tcx>( } crate fn wf_clause_for_fn_def<'tcx>( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, def_id: DefId ) -> Clauses<'tcx> { let fn_def = generic_types::fn_def(tcx, def_id); diff --git a/src/librustc_traits/chalk_context/resolvent_ops.rs b/src/librustc_traits/chalk_context/resolvent_ops.rs index d894c6c2a03e9..ff2cfc87297de 100644 --- a/src/librustc_traits/chalk_context/resolvent_ops.rs +++ b/src/librustc_traits/chalk_context/resolvent_ops.rs @@ -170,7 +170,7 @@ impl AnswerSubstitutor<'cx, 'gcx, 'tcx> { } impl TypeRelation<'gcx, 'tcx> for AnswerSubstitutor<'cx, 'gcx, 'tcx> { - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc_traits/dropck_outlives.rs b/src/librustc_traits/dropck_outlives.rs index 3de64f4f4c43e..02b9b078fca91 100644 --- a/src/librustc_traits/dropck_outlives.rs +++ b/src/librustc_traits/dropck_outlives.rs @@ -18,7 +18,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn dropck_outlives<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonical_goal: CanonicalTyGoal<'tcx>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, DropckOutlivesResult<'tcx>>>, NoSolution> { debug!("dropck_outlives(goal={:#?})", canonical_goal); @@ -147,7 +147,7 @@ fn dropck_outlives<'tcx>( /// Returns a set of constraints that needs to be satisfied in /// order for `ty` to be valid for destruction. fn dtorck_constraint_for_ty<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, span: Span, for_ty: Ty<'tcx>, depth: usize, @@ -280,7 +280,7 @@ fn dtorck_constraint_for_ty<'gcx, 'tcx>( /// Calculates the dtorck constraint for a type. crate fn adt_dtorck_constraint<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Result, NoSolution> { let def = tcx.adt_def(def_id); diff --git a/src/librustc_traits/evaluate_obligation.rs b/src/librustc_traits/evaluate_obligation.rs index 789da125ba91f..be3a8340e6006 100644 --- a/src/librustc_traits/evaluate_obligation.rs +++ b/src/librustc_traits/evaluate_obligation.rs @@ -14,7 +14,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn evaluate_obligation<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonical_goal: CanonicalPredicateGoal<'tcx>, ) -> Result { tcx.infer_ctxt().enter_with_canonical( diff --git a/src/librustc_traits/generic_types.rs b/src/librustc_traits/generic_types.rs index a9aa540acc11c..7eb1cd093a82f 100644 --- a/src/librustc_traits/generic_types.rs +++ b/src/librustc_traits/generic_types.rs @@ -6,7 +6,7 @@ use rustc::hir; use rustc::hir::def_id::DefId; use rustc_target::spec::abi; -crate fn bound(tcx: TyCtxt<'tcx, '_, 'tcx>, index: u32) -> Ty<'tcx> { +crate fn bound(tcx: TyCtxt<'_, 'tcx>, index: u32) -> Ty<'tcx> { let ty = ty::Bound( ty::INNERMOST, ty::BoundVar::from_u32(index).into() @@ -14,7 +14,7 @@ crate fn bound(tcx: TyCtxt<'tcx, '_, 'tcx>, index: u32) -> Ty<'tcx> { tcx.mk_ty(ty) } -crate fn raw_ptr(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { +crate fn raw_ptr(tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { tcx.mk_ptr(ty::TypeAndMut { ty: bound(tcx, 0), mutbl, @@ -22,7 +22,7 @@ crate fn raw_ptr(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx } crate fn fn_ptr( - tcx: TyCtxt<'tcx, '_, 'tcx>, + tcx: TyCtxt<'_, 'tcx>, arity_and_output: usize, c_variadic: bool, unsafety: hir::Unsafety, @@ -44,7 +44,7 @@ crate fn fn_ptr( tcx.mk_fn_ptr(fn_sig) } -crate fn type_list(tcx: TyCtxt<'tcx, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> { +crate fn type_list(tcx: TyCtxt<'_, 'tcx>, arity: usize) -> SubstsRef<'tcx> { tcx.mk_substs( (0..arity).into_iter() .map(|i| ty::BoundVar::from(i)) @@ -53,7 +53,7 @@ crate fn type_list(tcx: TyCtxt<'tcx, '_, 'tcx>, arity: usize) -> SubstsRef<'tcx> ) } -crate fn ref_ty(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { +crate fn ref_ty(tcx: TyCtxt<'_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> { let region = tcx.mk_region( ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(0)) ); @@ -64,17 +64,17 @@ crate fn ref_ty(tcx: TyCtxt<'tcx, '_, 'tcx>, mutbl: hir::Mutability) -> Ty<'tcx> }) } -crate fn fn_def(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn fn_def(tcx: TyCtxt<'_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_ty(ty::FnDef(def_id, InternalSubsts::bound_vars_for_item(tcx, def_id))) } -crate fn closure(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn closure(tcx: TyCtxt<'_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_closure(def_id, ty::ClosureSubsts { substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }) } -crate fn generator(tcx: TyCtxt<'tcx, '_, 'tcx>, def_id: DefId) -> Ty<'tcx> { +crate fn generator(tcx: TyCtxt<'_, 'tcx>, def_id: DefId) -> Ty<'tcx> { tcx.mk_generator(def_id, ty::GeneratorSubsts { substs: InternalSubsts::bound_vars_for_item(tcx, def_id), }, hir::GeneratorMovability::Movable) diff --git a/src/librustc_traits/implied_outlives_bounds.rs b/src/librustc_traits/implied_outlives_bounds.rs index 03976ace692ea..88bc61886b7d4 100644 --- a/src/librustc_traits/implied_outlives_bounds.rs +++ b/src/librustc_traits/implied_outlives_bounds.rs @@ -23,7 +23,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn implied_outlives_bounds<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: CanonicalTyGoal<'tcx>, ) -> Result< &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, Vec>>>, diff --git a/src/librustc_traits/lowering/environment.rs b/src/librustc_traits/lowering/environment.rs index 569836680b5fe..537b6d3e09012 100644 --- a/src/librustc_traits/lowering/environment.rs +++ b/src/librustc_traits/lowering/environment.rs @@ -12,12 +12,12 @@ use rustc::hir::def_id::DefId; use rustc_data_structures::fx::FxHashSet; struct ClauseVisitor<'a, 'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, round: &'a mut FxHashSet>, } impl ClauseVisitor<'a, 'tcx> { - fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, round: &'a mut FxHashSet>) -> Self { + fn new(tcx: TyCtxt<'tcx, 'tcx>, round: &'a mut FxHashSet>) -> Self { ClauseVisitor { tcx, round, @@ -128,7 +128,7 @@ impl ClauseVisitor<'a, 'tcx> { } crate fn program_clauses_for_env<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, environment: Environment<'tcx>, ) -> Clauses<'tcx> { debug!("program_clauses_for_env(environment={:?})", environment); @@ -161,7 +161,7 @@ crate fn program_clauses_for_env<'tcx>( } crate fn environment<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId ) -> Environment<'tcx> { use super::{Lower, IntoFromEnvGoal}; diff --git a/src/librustc_traits/lowering/mod.rs b/src/librustc_traits/lowering/mod.rs index 59b61abee8f52..c73f61f070e37 100644 --- a/src/librustc_traits/lowering/mod.rs +++ b/src/librustc_traits/lowering/mod.rs @@ -156,7 +156,7 @@ impl<'tcx> IntoWellFormedGoal for DomainGoal<'tcx> { } crate fn program_clauses_for<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // FIXME(eddyb) this should only be using `def_kind`. @@ -185,7 +185,7 @@ crate fn program_clauses_for<'tcx>( } fn program_clauses_for_trait<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // `trait Trait where WC { .. } // P0 == Self` @@ -300,7 +300,7 @@ fn program_clauses_for_trait<'tcx>( ) } -fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { +fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Clauses<'tcx> { if let ImplPolarity::Negative = tcx.impl_polarity(def_id) { return List::empty(); } @@ -344,7 +344,7 @@ fn program_clauses_for_impl(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Cla } pub fn program_clauses_for_type_def<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Clauses<'tcx> { // Rule WellFormed-Type @@ -421,7 +421,7 @@ pub fn program_clauses_for_type_def<'tcx>( } pub fn program_clauses_for_associated_type_def<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { // Rule ProjectionEq-Placeholder @@ -559,7 +559,7 @@ pub fn program_clauses_for_associated_type_def<'tcx>( } pub fn program_clauses_for_associated_type_value<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: DefId, ) -> Clauses<'tcx> { // Rule Normalize-From-Impl (see rustc guide) @@ -620,7 +620,7 @@ pub fn program_clauses_for_associated_type_value<'tcx>( tcx.mk_clauses(iter::once(normalize_clause)) } -pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { if !tcx.features().rustc_attrs { return; } @@ -632,7 +632,7 @@ pub fn dump_program_clauses<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct ClauseDumper<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ClauseDumper<'tcx> { diff --git a/src/librustc_traits/normalize_erasing_regions.rs b/src/librustc_traits/normalize_erasing_regions.rs index 448c544afbb27..5dec1613f1e95 100644 --- a/src/librustc_traits/normalize_erasing_regions.rs +++ b/src/librustc_traits/normalize_erasing_regions.rs @@ -12,7 +12,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn normalize_ty_after_erasing_regions<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: ParamEnvAnd<'tcx, Ty<'tcx>>, ) -> Ty<'tcx> { debug!("normalize_ty_after_erasing_regions(goal={:#?})", goal); diff --git a/src/librustc_traits/normalize_projection_ty.rs b/src/librustc_traits/normalize_projection_ty.rs index a080ffcb2c1a7..448d42dc9b051 100644 --- a/src/librustc_traits/normalize_projection_ty.rs +++ b/src/librustc_traits/normalize_projection_ty.rs @@ -15,7 +15,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn normalize_projection_ty<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, goal: CanonicalProjectionGoal<'tcx>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> { debug!("normalize_provider(goal={:#?})", goal); diff --git a/src/librustc_traits/type_op.rs b/src/librustc_traits/type_op.rs index a00e66fa56cac..f2ceff6185e92 100644 --- a/src/librustc_traits/type_op.rs +++ b/src/librustc_traits/type_op.rs @@ -35,7 +35,7 @@ crate fn provide(p: &mut Providers<'_>) { } fn type_op_ascribe_user_type<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, AscribeUserType<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -94,7 +94,7 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { ); } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.infcx.tcx } @@ -167,7 +167,7 @@ impl AscribeUserTypeCx<'me, 'gcx, 'tcx> { } fn type_op_eq<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Eq<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -197,7 +197,7 @@ where } fn type_op_normalize_ty( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, Ty<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -205,7 +205,7 @@ fn type_op_normalize_ty( } fn type_op_normalize_predicate( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, Predicate<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -213,7 +213,7 @@ fn type_op_normalize_predicate( } fn type_op_normalize_fn_sig( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, FnSig<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -221,7 +221,7 @@ fn type_op_normalize_fn_sig( } fn type_op_normalize_poly_fn_sig( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Normalize>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, PolyFnSig<'tcx>>>, NoSolution> { tcx.infer_ctxt() @@ -229,7 +229,7 @@ fn type_op_normalize_poly_fn_sig( } fn type_op_subtype<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, Subtype<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() @@ -243,7 +243,7 @@ fn type_op_subtype<'tcx>( } fn type_op_prove_predicate<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, canonicalized: Canonical<'tcx, ParamEnvAnd<'tcx, ProvePredicate<'tcx>>>, ) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, ()>>, NoSolution> { tcx.infer_ctxt() diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 92a28defa5553..9730623b552ac 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -41,7 +41,7 @@ use rustc_data_structures::fx::FxHashSet; pub struct PathSeg(pub DefId, pub usize); pub trait AstConv<'gcx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx>; + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx>; /// Returns the set of bounds in scope for the type parameter with /// the given id. @@ -208,7 +208,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Report error if there is an explicit type parameter when using `impl Trait`. fn check_impl_trait( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, span: Span, seg: &hir::PathSegment, generics: &ty::Generics, @@ -239,7 +239,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Checks that the correct number of generic arguments have been provided. /// Used specifically for function calls. pub fn check_generic_arg_count_for_call( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, span: Span, def: &ty::Generics, seg: &hir::PathSegment, @@ -271,7 +271,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// Checks that the correct number of generic arguments have been provided. /// This is used both for datatypes and function calls. fn check_generic_arg_count( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, span: Span, def: &ty::Generics, args: &hir::GenericArgs, @@ -462,7 +462,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { /// - `inferred_kind`: if no parameter was provided, and inference is enabled, then /// creates a suitable inference variable. pub fn create_substs_for_generic_args<'b>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, def_id: DefId, parent_substs: &[Kind<'tcx>], has_self: bool, @@ -1810,7 +1810,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o { has_err } - pub fn prohibit_assoc_ty_binding(tcx: TyCtxt<'_, '_, '_>, span: Span) { + pub fn prohibit_assoc_ty_binding(tcx: TyCtxt<'_, '_>, span: Span) { let mut err = struct_span_err!(tcx.sess, span, E0229, "associated type bindings are not allowed here"); err.span_label(span, "associated type not allowed here").emit(); @@ -2420,7 +2420,7 @@ impl<'gcx, 'tcx> Bounds<'tcx> { /// where-clauses). Because some of our bounds listings (e.g., /// regions) don't include the self-type, you must supply the /// self-type here (the `param_ty` parameter). - pub fn predicates(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>, param_ty: Ty<'tcx>) + pub fn predicates(&self, tcx: TyCtxt<'gcx, 'tcx>, param_ty: Ty<'tcx>) -> Vec<(ty::Predicate<'tcx>, Span)> { // If it could be sized, and is, add the `Sized` predicate. diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 6281b20f24af2..8cb4360e65d3d 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -240,7 +240,7 @@ impl<'a, 'gcx, 'tcx> Autoderef<'a, 'gcx, 'tcx> { } pub fn report_autoderef_recursion_limit_error<'gcx, 'tcx>( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) + tcx: TyCtxt<'gcx, 'tcx>, span: Span, ty: Ty<'tcx>) { // We've reached the recursion limit, error gracefully. let suggested_limit = *tcx.sess.recursion_limit.get() * 2; diff --git a/src/librustc_typeck/check/callee.rs b/src/librustc_typeck/check/callee.rs index 8d32583da4b22..8e13bbed89e78 100644 --- a/src/librustc_typeck/check/callee.rs +++ b/src/librustc_typeck/check/callee.rs @@ -18,7 +18,7 @@ use rustc::hir; /// Checks that it is legal to call methods of the trait corresponding /// to `trait_id` (this only cares about the trait, not the specific /// method that is called). -pub fn check_legal_trait_for_method_call(tcx: TyCtxt<'_, '_, '_>, span: Span, trait_id: DefId) { +pub fn check_legal_trait_for_method_call(tcx: TyCtxt<'_, '_>, span: Span, trait_id: DefId) { if tcx.lang_items().drop_trait() == Some(trait_id) { struct_span_err!(tcx.sess, span, E0040, "explicit use of destructor method") .span_label(span, "explicit destructor calls not allowed") diff --git a/src/librustc_typeck/check/compare_method.rs b/src/librustc_typeck/check/compare_method.rs index 920dbff7b8cc6..7c24ea1641493 100644 --- a/src/librustc_typeck/check/compare_method.rs +++ b/src/librustc_typeck/check/compare_method.rs @@ -23,7 +23,7 @@ use super::{Inherited, FnCtxt, potentially_plural_count}; /// - `trait_m`: the method in the trait /// - `impl_trait_ref`: the TraitRef corresponding to the trait implementation -pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -73,7 +73,7 @@ pub fn compare_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -355,7 +355,7 @@ fn compare_predicate_entailment<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn check_region_bounds_on_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_region_bounds_on_impl_method<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem, @@ -495,7 +495,7 @@ fn extract_spans_for_error_reporting<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a } } -fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -581,7 +581,7 @@ fn compare_self_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn compare_number_of_generics<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impl_: &ty::AssocItem, _impl_span: Span, trait_: &ty::AssocItem, @@ -695,7 +695,7 @@ fn compare_number_of_generics<'tcx>( } } -fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, impl_m_span: Span, trait_m: &ty::AssocItem, @@ -779,7 +779,7 @@ fn compare_number_of_method_arguments<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, Ok(()) } -fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_m: &ty::AssocItem, trait_m: &ty::AssocItem) -> Result<(), ErrorReported> { @@ -951,7 +951,7 @@ fn compare_synthetic_generics<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -pub fn compare_const_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn compare_const_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_c: &ty::AssocItem, impl_c_span: Span, trait_c: &ty::AssocItem, diff --git a/src/librustc_typeck/check/dropck.rs b/src/librustc_typeck/check/dropck.rs index 6094fd1f5f2fc..1e6ae1e030912 100644 --- a/src/librustc_typeck/check/dropck.rs +++ b/src/librustc_typeck/check/dropck.rs @@ -30,7 +30,7 @@ use syntax_pos::Span; /// cannot do `struct S; impl Drop for S { ... }`). /// pub fn check_drop_impl<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, drop_impl_did: DefId, ) -> Result<(), ErrorReported> { let dtor_self_type = tcx.type_of(drop_impl_did); @@ -65,7 +65,7 @@ pub fn check_drop_impl<'tcx>( } fn ensure_drop_params_and_item_params_correspond<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, drop_impl_did: DefId, drop_impl_ty: Ty<'tcx>, self_type_did: DefId, @@ -141,7 +141,7 @@ fn ensure_drop_params_and_item_params_correspond<'tcx>( /// Confirms that every predicate imposed by dtor_predicates is /// implied by assuming the predicates attached to self_type_did. fn ensure_drop_predicates_are_implied_by_item_defn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, drop_impl_did: DefId, dtor_predicates: &ty::GenericPredicates<'tcx>, self_type_did: DefId, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index 21f4660b08e5c..2a553db5e5dde 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -14,7 +14,7 @@ use rustc::hir; use std::iter; fn equate_intrinsic_type<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem, n_tps: usize, abi: Abi, @@ -79,7 +79,7 @@ pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety { /// Remember to add all intrinsics here, in librustc_codegen_llvm/intrinsic.rs, /// and in libcore/intrinsics.rs -pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| tcx.mk_ty_param(n, InternedString::intern(&format!("P{}", n))); let name = it.ident.as_str(); @@ -400,7 +400,7 @@ pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// Type-check `extern "platform-intrinsic" { ... }` functions. -pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &hir::ForeignItem) { let param = |n| { let name = InternedString::intern(&format!("P{}", n)); diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 96ee140bcfecb..8d55f3afdfd8a 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -395,7 +395,7 @@ pub fn provide(providers: &mut ty::query::Providers<'_>) { providers.method_autoderef_steps = method_autoderef_steps; } -fn method_autoderef_steps<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, +fn method_autoderef_steps<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, goal: CanonicalTyGoal<'tcx>) -> MethodAutoderefStepsResult<'gcx> { diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 05da24bb62c99..227b0c7035451 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -775,12 +775,12 @@ impl Ord for TraitInfo { } /// Retrieves all traits in this crate and any dependent crates. -pub fn all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { +pub fn all_traits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Vec { tcx.all_traits(LOCAL_CRATE).iter().map(|&def_id| TraitInfo { def_id }).collect() } /// Computes all traits in this crate and any dependent crates. -fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { +fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>) -> Vec { use hir::itemlikevisit; let mut traits = vec![]; @@ -817,7 +817,7 @@ fn compute_all_traits<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Vec { // Cross-crate: let mut external_mods = FxHashSet::default(); - fn handle_external_res(tcx: TyCtxt<'_, '_, '_>, + fn handle_external_res(tcx: TyCtxt<'_, '_>, traits: &mut Vec, external_mods: &mut FxHashSet, res: Res) { @@ -859,12 +859,12 @@ struct UsePlacementFinder<'tcx, 'gcx> { target_module: hir::HirId, span: Option, found_use: bool, - tcx: TyCtxt<'tcx, 'gcx, 'tcx> + tcx: TyCtxt<'gcx, 'tcx> } impl UsePlacementFinder<'tcx, 'gcx> { fn check( - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, krate: &'tcx hir::Crate, target_module: hir::HirId, ) -> (Option, bool) { diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index c1111e3ae4695..ba30f481596df 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -594,7 +594,7 @@ pub struct InheritedBuilder<'gcx, 'tcx> { } impl Inherited<'_, 'gcx, 'tcx> { - pub fn build(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, def_id: DefId) + pub fn build(tcx: TyCtxt<'gcx, 'gcx>, def_id: DefId) -> InheritedBuilder<'gcx, 'tcx> { let hir_id_root = if def_id.is_local() { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -685,7 +685,7 @@ impl Inherited<'a, 'gcx, 'tcx> { } } -struct CheckItemTypesVisitor<'tcx> { tcx: TyCtxt<'tcx, 'tcx, 'tcx> } +struct CheckItemTypesVisitor<'tcx> { tcx: TyCtxt<'tcx, 'tcx> } impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> { fn visit_item(&mut self, i: &'tcx hir::Item) { @@ -695,33 +695,33 @@ impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> { fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) { } } -pub fn check_wf_new<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Result<(), ErrorReported> { +pub fn check_wf_new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.track_errors(|| { let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx); tcx.hir().krate().par_visit_all_item_likes(&mut visit); }) } -fn check_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx }); } -fn typeck_item_bodies<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) { +fn typeck_item_bodies<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) { debug_assert!(crate_num == LOCAL_CRATE); tcx.par_body_owners(|body_owner_def_id| { tcx.ensure().typeck_tables_of(body_owner_def_id); }); } -fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { wfcheck::check_item_well_formed(tcx, def_id); } -fn check_trait_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_trait_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { wfcheck::check_trait_item(tcx, def_id); } -fn check_impl_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn check_impl_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { wfcheck::check_impl_item(tcx, def_id); } @@ -741,7 +741,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Option { tcx.calculate_dtor(def_id, &mut dropck::check_drop_impl) @@ -756,7 +756,7 @@ fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// may not succeed. In some cases where this function returns `None` /// (notably closures), `typeck_tables(def_id)` would wind up /// redirecting to the owning function. -fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> { @@ -797,7 +797,7 @@ fn primary_body_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { // Closures' tables come from their outermost function, @@ -811,13 +811,13 @@ fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, primary_body_of(tcx, id).is_some() } -fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx DefIdSet { &*tcx.typeck_tables_of(def_id).used_trait_imports } -fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TypeckTables<'tcx> { // Closures' tables come from their outermost function, @@ -919,7 +919,7 @@ fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, tables } -fn check_abi<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, abi: Abi) { +fn check_abi<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, abi: Abi) { if !tcx.sess.target.target.is_abi_supported(abi) { struct_span_err!(tcx.sess, span, E0570, "The ABI `{}` is not supported for the current target", abi).emit() @@ -1287,7 +1287,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>, (fcx, gen_ty) } -fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1303,7 +1303,7 @@ fn check_struct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, check_packed(tcx, span, def_id); } -fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: hir::HirId, span: Span) { let def_id = tcx.hir().local_def_id_from_hir_id(id); @@ -1315,7 +1315,7 @@ fn check_union<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } fn check_opaque<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, substs: SubstsRef<'tcx>, span: Span, @@ -1335,7 +1335,7 @@ fn check_opaque<'tcx>( } } -pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &'tcx hir::Item) { +pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, it: &'tcx hir::Item) { debug!( "check_item_type(it.hir_id={}, it.name={})", it.hir_id, @@ -1434,7 +1434,7 @@ pub fn check_item_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, it: &'tcx hir::Item) } } -fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span: Span) { +fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_>, id: DefId, span: Span) { // Only restricted on wasm32 target for now if !tcx.sess.opts.target_triple.triple().starts_with("wasm32") { return @@ -1472,7 +1472,7 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_, '_, '_>, id: DefId, span } } -fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId, item: &hir::Item) { let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -1480,7 +1480,7 @@ fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id); } -fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item: &hir::ImplItem, parent_impl: DefId) { @@ -1506,7 +1506,7 @@ fn report_forbidden_specialization<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, err.emit(); } -fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def: &ty::TraitDef, trait_item: &ty::AssocItem, impl_id: DefId, @@ -1532,7 +1532,7 @@ fn check_specialization_validity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_span: Span, impl_id: DefId, impl_trait_ref: ty::TraitRef<'tcx>, @@ -1693,7 +1693,7 @@ fn check_impl_items_against_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Checks whether a type can be represented in memory. In particular, it /// identifies types that contain themselves without indirection through a /// pointer, which would mean their size is unbounded. -fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, item_def_id: DefId) -> bool { @@ -1718,7 +1718,7 @@ fn check_representable<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, return true } -pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { let t = tcx.type_of(def_id); if let ty::Adt(def, substs) = t.sty { if def.is_struct() { @@ -1747,7 +1747,7 @@ pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) } } -fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { let repr = tcx.adt_def(def_id).repr; if repr.packed() { for attr in tcx.get_attrs(def_id).iter() { @@ -1771,7 +1771,7 @@ fn check_packed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { } } -fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, stack: &mut Vec) -> bool { let t = tcx.type_of(def_id); @@ -1801,7 +1801,7 @@ fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, false } -fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefId) { +fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, def_id: DefId) { let adt = tcx.adt_def(def_id); if !adt.repr.transparent() { return; @@ -1881,7 +1881,7 @@ fn check_transparent<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, sp: Span, def_id: DefI } #[allow(trivial_numeric_casts)] -pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, sp: Span, vs: &'tcx [hir::Variant], id: hir::HirId) { @@ -1945,7 +1945,7 @@ pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, check_transparent(tcx, sp, def_id); } -fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, res: Res, span: Span, qpath: &QPath) { @@ -1956,7 +1956,7 @@ fn report_unexpected_variant_res<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> AstConv<'gcx, 'tcx> for FnCtxt<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } fn get_type_parameter_bounds(&self, _: Span, def_id: DefId) -> &'tcx ty::GenericPredicates<'tcx> @@ -5700,7 +5700,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn check_bounds_are_used<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, generics: &ty::Generics, ty: Ty<'tcx>) { let own_counts = generics.own_counts(); diff --git a/src/librustc_typeck/check/upvar.rs b/src/librustc_typeck/check/upvar.rs index 82c173a6f7a57..2f3861b8d3478 100644 --- a/src/librustc_typeck/check/upvar.rs +++ b/src/librustc_typeck/check/upvar.rs @@ -651,6 +651,6 @@ impl<'a, 'gcx, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'gcx, 'tcx> { } } -fn var_name(tcx: TyCtxt<'_, '_, '_>, var_hir_id: hir::HirId) -> ast::Name { +fn var_name(tcx: TyCtxt<'_, '_>, var_hir_id: hir::HirId) -> ast::Name { tcx.hir().name_by_hir_id(var_hir_id) } diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 34d6892c18f57..31d85be17b4c0 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -35,7 +35,7 @@ struct CheckWfFcxBuilder<'gcx, 'tcx> { impl<'gcx, 'tcx> CheckWfFcxBuilder<'gcx, 'tcx> { fn with_fcx(&'tcx mut self, f: F) where F: for<'b> FnOnce(&FnCtxt<'b, 'gcx, 'tcx>, - TyCtxt<'gcx, 'gcx, 'gcx>) -> Vec> + TyCtxt<'gcx, 'gcx>) -> Vec> { let id = self.id; let span = self.span; @@ -68,7 +68,7 @@ impl<'gcx, 'tcx> CheckWfFcxBuilder<'gcx, 'tcx> { /// We do this check as a pre-pass before checking fn bodies because if these constraints are /// not included it frequently leads to confusing errors in fn bodies. So it's better to check /// the types first. -pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -156,7 +156,7 @@ pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId } } -pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let trait_item = tcx.hir().expect_trait_item(hir_id); @@ -167,7 +167,7 @@ pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, trait_item.hir_id, trait_item.span, method_sig); } -pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let impl_item = tcx.hir().expect_impl_item(hir_id); @@ -178,7 +178,7 @@ pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig); } -fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId, span: Span, sig_if_method: Option<&hir::MethodSig>) { @@ -225,12 +225,12 @@ fn check_associated_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn for_item<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, item: &hir::Item) +fn for_item<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, item: &hir::Item) -> CheckWfFcxBuilder<'gcx, 'tcx> { for_id(tcx, item.hir_id, item.span) } -fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, id: hir::HirId, span: Span) +fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'gcx, 'tcx> { let def_id = tcx.hir().local_def_id_from_hir_id(id); CheckWfFcxBuilder { @@ -242,7 +242,7 @@ fn for_id<'gcx: 'tcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, id: hir::HirId, span: } /// In a type definition, we check that to ensure that the types of the fields are well-formed. -fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, all_sized: bool, mut lookup_fields: F) where F: for<'fcx, 'gcx, 'tcx2> FnMut(&FnCtxt<'fcx, 'gcx, 'tcx2>) -> Vec> { @@ -312,7 +312,7 @@ fn check_type_defn<'tcx, F>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }); } -fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { +fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item) { debug!("check_trait: {:?}", item.hir_id); let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id); @@ -335,7 +335,7 @@ fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { }); } -fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { +fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item) { for_item(tcx, item).with_fcx(|fcx, tcx| { let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id); let sig = fcx.tcx.fn_sig(def_id); @@ -348,7 +348,7 @@ fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item: &hir::Item) { } fn check_item_type<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId, ty_span: Span, allow_foreign_ty: bool, @@ -380,7 +380,7 @@ fn check_item_type<'tcx>( }); } -fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, ast_self_ty: &hir::Ty, ast_trait_ref: &Option) @@ -422,7 +422,7 @@ fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// Checks where-clauses and inline bounds that are declared on `def_id`. fn check_where_clauses<'gcx, 'fcx, 'tcx>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, def_id: DefId, @@ -574,7 +574,7 @@ fn check_where_clauses<'gcx, 'fcx, 'tcx>( } } -fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, +fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, span: Span, sig: ty::PolyFnSig<'tcx>, @@ -617,7 +617,7 @@ fn check_fn_or_method<'fcx, 'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'gcx, 'gcx>, /// ``` /// fn check_existential_types<'fcx, 'gcx, 'tcx>( - tcx: TyCtxt<'gcx, 'gcx, 'gcx>, + tcx: TyCtxt<'gcx, 'gcx>, fcx: &FnCtxt<'fcx, 'gcx, 'tcx>, fn_def_id: DefId, span: Span, @@ -930,7 +930,7 @@ fn receiver_is_valid<'fcx, 'tcx, 'gcx>( true } -fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: &hir::Item, hir_generics: &hir::Generics) { @@ -971,7 +971,7 @@ fn check_variances_for_type_defn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } } -fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_name: ast::Name) { @@ -987,7 +987,7 @@ fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, err.emit(); } -fn reject_shadowing_parameters(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) { +fn reject_shadowing_parameters(tcx: TyCtxt<'_, '_>, def_id: DefId) { let generics = tcx.generics_of(def_id); let parent = tcx.generics_of(generics.parent.unwrap()); let impl_params: FxHashMap<_, _> = parent.params.iter().flat_map(|param| match param.kind { @@ -1053,11 +1053,11 @@ fn check_false_global_bounds<'a, 'gcx, 'tcx>( } pub struct CheckTypeWellFormedVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl CheckTypeWellFormedVisitor<'gcx> { - pub fn new(tcx: TyCtxt<'gcx, 'gcx, 'gcx>) -> CheckTypeWellFormedVisitor<'gcx> { + pub fn new(tcx: TyCtxt<'gcx, 'gcx>) -> CheckTypeWellFormedVisitor<'gcx> { CheckTypeWellFormedVisitor { tcx, } @@ -1133,7 +1133,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } -fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::Name) +fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span, param_name: ast::Name) -> DiagnosticBuilder<'tcx> { let mut err = struct_span_err!(tcx.sess, span, E0392, "parameter `{}` is never used", param_name); @@ -1141,7 +1141,7 @@ fn error_392<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span, param_name: ast::N err } -fn error_194(tcx: TyCtxt<'_, '_, '_>, span: Span, trait_decl_span: Span, name: &str) { +fn error_194(tcx: TyCtxt<'_, '_>, span: Span, trait_decl_span: Span, name: &str) { struct_span_err!(tcx.sess, span, E0194, "type parameter `{}` shadows another type parameter of the same name", name) diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 7683f8cfbc4a6..cc9097ea8c83b 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -123,7 +123,7 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } } - fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'gcx, 'tcx> { self.fcx.tcx } @@ -762,24 +762,24 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { } trait Locatable { - fn to_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span; + fn to_span(&self, tcx: TyCtxt<'_, '_>) -> Span; } impl Locatable for Span { - fn to_span(&self, _: TyCtxt<'_, '_, '_>) -> Span { + fn to_span(&self, _: TyCtxt<'_, '_>) -> Span { *self } } impl Locatable for DefIndex { - fn to_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn to_span(&self, tcx: TyCtxt<'_, '_>) -> Span { let hir_id = tcx.hir().def_index_to_hir_id(*self); tcx.hir().span_by_hir_id(hir_id) } } impl Locatable for hir::HirId { - fn to_span(&self, tcx: TyCtxt<'_, '_, '_>) -> Span { + fn to_span(&self, tcx: TyCtxt<'_, '_>) -> Span { tcx.hir().span_by_hir_id(*self) } } @@ -789,7 +789,7 @@ impl Locatable for hir::HirId { // unresolved types and so forth. struct Resolver<'cx, 'gcx: 'cx + 'tcx, 'tcx: 'cx> { - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, infcx: &'cx InferCtxt<'cx, 'gcx, 'tcx>, span: &'cx dyn Locatable, body: &'gcx hir::Body, @@ -819,7 +819,7 @@ impl<'cx, 'gcx, 'tcx> Resolver<'cx, 'gcx, 'tcx> { } impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Resolver<'cx, 'gcx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustc_typeck/check_unused.rs b/src/librustc_typeck/check_unused.rs index bb587da9314f8..5f4f88d954490 100644 --- a/src/librustc_typeck/check_unused.rs +++ b/src/librustc_typeck/check_unused.rs @@ -13,7 +13,7 @@ use rustc::util::nodemap::DefIdSet; use rustc_data_structures::fx::FxHashMap; -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let mut used_trait_imports = DefIdSet::default(); for &body_id in tcx.hir().krate().bodies.keys() { let item_def_id = tcx.hir().body_owner_def_id(body_id); @@ -46,7 +46,7 @@ impl ItemLikeVisitor<'v> for CheckVisitor<'tcx> { } struct CheckVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, used_trait_imports: DefIdSet, } @@ -70,7 +70,7 @@ impl CheckVisitor<'tcx> { } } -fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let lint = lint::builtin::UNUSED_EXTERN_CRATES; // Collect first the crates that are completely unused. These we @@ -195,7 +195,7 @@ fn unused_crates_lint<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } struct CollectExternCrateVisitor<'a, 'tcx: 'a> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, crates_to_lint: &'a mut Vec, } diff --git a/src/librustc_typeck/coherence/builtin.rs b/src/librustc_typeck/coherence/builtin.rs index 497392e7661f4..653095e41f425 100644 --- a/src/librustc_typeck/coherence/builtin.rs +++ b/src/librustc_typeck/coherence/builtin.rs @@ -17,7 +17,7 @@ use rustc::hir::def_id::DefId; use hir::Node; use rustc::hir::{self, ItemKind}; -pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) { +pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId) { Checker { tcx, trait_def_id } .check(tcx.lang_items().drop_trait(), visit_implementation_of_drop) .check(tcx.lang_items().copy_trait(), visit_implementation_of_copy) @@ -27,13 +27,13 @@ pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_def_id: DefId) { } struct Checker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId } impl<'tcx> Checker<'tcx> { fn check(&self, trait_def_id: Option, mut f: F) -> &Self - where F: FnMut(TyCtxt<'tcx, 'tcx, 'tcx>, DefId) + where F: FnMut(TyCtxt<'tcx, 'tcx>, DefId) { if Some(self.trait_def_id) == trait_def_id { for &impl_id in self.tcx.hir().trait_impls(self.trait_def_id) { @@ -45,7 +45,7 @@ impl<'tcx> Checker<'tcx> { } } -fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId) { if let ty::Adt(..) = tcx.type_of(impl_did).sty { /* do nothing */ } else { @@ -73,7 +73,7 @@ fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: D } } -fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_copy: impl_did={:?}", impl_did); let impl_hir_id = if let Some(n) = tcx.hir().as_local_hir_id(impl_did) { @@ -140,7 +140,7 @@ fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: D } } -fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_did: DefId) { +fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId) { debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did); @@ -154,7 +154,7 @@ fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_di } fn visit_implementation_of_dispatch_from_dyn<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impl_did: DefId, ) { debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", @@ -324,7 +324,7 @@ fn visit_implementation_of_dispatch_from_dyn<'tcx>( } } -pub fn coerce_unsized_info<'gcx>(gcx: TyCtxt<'gcx, 'gcx, 'gcx>, +pub fn coerce_unsized_info<'gcx>(gcx: TyCtxt<'gcx, 'gcx>, impl_did: DefId) -> CoerceUnsizedInfo { debug!("compute_coerce_unsized_info(impl_did={:?})", impl_did); diff --git a/src/librustc_typeck/coherence/inherent_impls.rs b/src/librustc_typeck/coherence/inherent_impls.rs index edef389726112..8214fc50fed87 100644 --- a/src/librustc_typeck/coherence/inherent_impls.rs +++ b/src/librustc_typeck/coherence/inherent_impls.rs @@ -17,7 +17,7 @@ use syntax::ast; use syntax_pos::Span; /// On-demand query: yields a map containing all types mapped to their inherent impls. -pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateInherentImpls { assert_eq!(crate_num, LOCAL_CRATE); @@ -32,7 +32,7 @@ pub fn crate_inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } /// On-demand query: yields a vector of the inherent impls for a specific type. -pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty_def_id: DefId) -> &'tcx [DefId] { assert!(ty_def_id.is_local()); @@ -69,7 +69,7 @@ pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct InherentCollect<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, impls_map: CrateInherentImpls, } diff --git a/src/librustc_typeck/coherence/inherent_impls_overlap.rs b/src/librustc_typeck/coherence/inherent_impls_overlap.rs index e1b8169e0c90c..feddd9f0b3cb0 100644 --- a/src/librustc_typeck/coherence/inherent_impls_overlap.rs +++ b/src/librustc_typeck/coherence/inherent_impls_overlap.rs @@ -5,7 +5,7 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::traits::{self, IntercrateMode}; use rustc::ty::TyCtxt; -pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) { assert_eq!(crate_num, LOCAL_CRATE); let krate = tcx.hir().krate(); @@ -13,7 +13,7 @@ pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } struct InherentOverlapChecker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> } impl InherentOverlapChecker<'tcx> { diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 3ec88cbbd29dd..421fdccc1fa25 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -18,7 +18,7 @@ mod inherent_impls_overlap; mod orphan; mod unsafety; -fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); // If there are no traits, then this implementation must have a @@ -41,7 +41,7 @@ fn check_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { } fn enforce_trait_manually_implementable( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, impl_def_id: DefId, trait_def_id: DefId ) { @@ -97,7 +97,7 @@ fn enforce_trait_manually_implementable( /// We allow impls of marker traits to overlap, so they can't override impls /// as that could make it ambiguous which associated item to use. fn enforce_empty_impls_for_marker_traits( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, impl_def_id: DefId, trait_def_id: DefId ) { @@ -132,7 +132,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { +fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) { let impls = tcx.hir().trait_impls(def_id); for &impl_id in impls { check_impl(tcx, impl_id); @@ -143,7 +143,7 @@ fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) { builtin::check_trait(tcx, def_id); } -pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { for &trait_def_id in tcx.hir().krate().trait_impls.keys() { tcx.ensure().coherent_trait(trait_def_id); } @@ -159,7 +159,7 @@ pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { /// Overlap: no two impls for the same trait are implemented for the /// same type. Likewise, no two inherent impls for a given type /// constructor provide a method with the same name. -fn check_impl_overlap<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_id: HirId) { +fn check_impl_overlap<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: HirId) { let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id); let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let trait_def_id = trait_ref.def_id; diff --git a/src/librustc_typeck/coherence/orphan.rs b/src/librustc_typeck/coherence/orphan.rs index a9307f2669553..4e81102fd3b84 100644 --- a/src/librustc_typeck/coherence/orphan.rs +++ b/src/librustc_typeck/coherence/orphan.rs @@ -6,13 +6,13 @@ use rustc::ty::{self, TyCtxt}; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir; -pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let mut orphan = OrphanChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut orphan); } struct OrphanChecker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'v> for OrphanChecker<'tcx> { diff --git a/src/librustc_typeck/coherence/unsafety.rs b/src/librustc_typeck/coherence/unsafety.rs index b5369a8777d22..c3a97bc538941 100644 --- a/src/librustc_typeck/coherence/unsafety.rs +++ b/src/librustc_typeck/coherence/unsafety.rs @@ -5,13 +5,13 @@ use rustc::ty::TyCtxt; use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::hir::{self, Unsafety}; -pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { let mut unsafety = UnsafetyChecker { tcx }; tcx.hir().krate().visit_all_item_likes(&mut unsafety); } struct UnsafetyChecker<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl UnsafetyChecker<'tcx> { diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index b012468f50966..02edf63dd5c7e 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -56,7 +56,7 @@ struct OnlySelfBounds(bool); /////////////////////////////////////////////////////////////////////////// // Main entry point -fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn collect_mod_item_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut CollectItemTypesVisitor { tcx }.as_deep_visitor() @@ -97,14 +97,14 @@ pub fn provide(providers: &mut Providers<'_>) { /// `get_type_parameter_bounds` requests, drawing the information from /// the AST (`hir::Generics`), recursively. pub struct ItemCtxt<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId, } /////////////////////////////////////////////////////////////////////////// struct CollectItemTypesVisitor<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { @@ -161,7 +161,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> { // Utility types and common code for the above passes. impl ItemCtxt<'tcx> { - pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) -> ItemCtxt<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId) -> ItemCtxt<'tcx> { ItemCtxt { tcx, item_def_id } } @@ -171,7 +171,7 @@ impl ItemCtxt<'tcx> { } impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'tcx> { self.tcx } @@ -254,7 +254,7 @@ impl AstConv<'tcx, 'tcx> for ItemCtxt<'tcx> { } fn type_param_predicates<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, (item_def_id, def_id): (DefId, DefId), ) -> &'tcx ty::GenericPredicates<'tcx> { use rustc::hir::*; @@ -382,7 +382,7 @@ impl ItemCtxt<'tcx> { /// `ast_ty_to_ty`, because we want to avoid triggering an all-out /// conversion of the type to avoid inducing unnecessary cycles. fn is_param<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, ast_ty: &hir::Ty, param_id: hir::HirId, ) -> bool { @@ -398,7 +398,7 @@ fn is_param<'tcx>( } } -fn convert_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { +fn convert_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_id: hir::HirId) { let it = tcx.hir().expect_item_by_hir_id(item_id); debug!("convert: item {} with id {}", it.ident, it.hir_id); let def_id = tcx.hir().local_def_id_from_hir_id(item_id); @@ -480,7 +480,7 @@ fn convert_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_id: hir::HirId) { } } -fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hir::HirId) { +fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, trait_item_id: hir::HirId) { let trait_item = tcx.hir().expect_trait_item(trait_item_id); let def_id = tcx.hir().local_def_id_from_hir_id(trait_item.hir_id); tcx.generics_of(def_id); @@ -501,7 +501,7 @@ fn convert_trait_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_item_id: hir::H tcx.predicates_of(def_id); } -fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir::HirId) { +fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(impl_item_id); tcx.generics_of(def_id); tcx.type_of(def_id); @@ -511,7 +511,7 @@ fn convert_impl_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, impl_item_id: hir::Hir } } -fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: hir::HirId) { +fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ctor_id: hir::HirId) { let def_id = tcx.hir().local_def_id_from_hir_id(ctor_id); tcx.generics_of(def_id); tcx.type_of(def_id); @@ -519,7 +519,7 @@ fn convert_variant_ctor<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, ctor_id: hir::HirId } fn convert_enum_variant_types<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, variants: &[hir::Variant], ) { @@ -571,7 +571,7 @@ fn convert_enum_variant_types<'tcx>( } fn convert_variant<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, variant_did: Option, ctor_did: Option, ident: Ident, @@ -627,7 +627,7 @@ fn convert_variant<'tcx>( ) } -fn adt_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { +fn adt_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtDef { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -695,7 +695,7 @@ fn adt_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::AdtD /// of `trait_def_id` are converted and stored. This also ensures that /// the transitive super-predicates are converted. fn super_predicates_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, trait_def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { debug!("super_predicates(trait_def_id={:?})", trait_def_id); @@ -748,7 +748,7 @@ fn super_predicates_of<'tcx>( }) } -fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { +fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::TraitDef { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); let item = tcx.hir().expect_item_by_hir_id(hir_id); @@ -780,11 +780,11 @@ fn trait_def<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Tr } fn has_late_bound_regions<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, node: Node<'tcx>, ) -> Option { struct LateBoundRegionsDetector<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, outer_index: ty::DebruijnIndex, has_late_bound_regions: Option, } @@ -841,7 +841,7 @@ fn has_late_bound_regions<'tcx>( } fn has_late_bound_regions<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, generics: &'tcx hir::Generics, decl: &'tcx hir::FnDecl, ) -> Option { @@ -890,7 +890,7 @@ fn has_late_bound_regions<'tcx>( } } -fn generics_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { +fn generics_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ty::Generics { use rustc::hir::*; let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); @@ -1133,7 +1133,7 @@ fn generics_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> &'tcx ty:: }) } -fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: Span) { +fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, span: Span) { span_err!( tcx.sess, span, @@ -1142,7 +1142,7 @@ fn report_assoc_ty_on_inherent_impl<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, span: S ); } -fn type_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { +fn type_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { checked_type_of(tcx, def_id, true).unwrap() } @@ -1151,7 +1151,7 @@ fn type_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> Ty<'tcx> { /// If you want to fail anyway, you can set the `fail` parameter to true, but in this case, /// you'd better just call [`type_of`] directly. pub fn checked_type_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, fail: bool, ) -> Option> { @@ -1480,7 +1480,7 @@ pub fn checked_type_of<'tcx>( } fn find_existential_constraints<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Ty<'tcx> { use rustc::hir::{ImplItem, Item, TraitItem}; @@ -1488,7 +1488,7 @@ fn find_existential_constraints<'tcx>( debug!("find_existential_constraints({:?})", def_id); struct ConstraintLocator<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, // (first found type span, actual type, mapping from the existential type's generic // parameters to the concrete type's generic parameters) @@ -1700,7 +1700,7 @@ fn find_existential_constraints<'tcx>( } } -fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { +fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<'tcx> { use rustc::hir::*; use rustc::hir::Node::*; @@ -1777,7 +1777,7 @@ fn fn_sig<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> ty::PolyFnSig<' } fn impl_trait_ref<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Option> { let icx = ItemCtxt::new(tcx, def_id); @@ -1794,7 +1794,7 @@ fn impl_trait_ref<'tcx>( } } -fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { +fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> hir::ImplPolarity { let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap(); match tcx.hir().expect_item_by_hir_id(hir_id).node { hir::ItemKind::Impl(_, polarity, ..) => polarity, @@ -1808,7 +1808,7 @@ fn impl_polarity<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> hir::Imp /// screen out those that do not appear in any where-clauses etc using /// `resolve_lifetime::early_bound_lifetimes`. fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, generics: &'a hir::Generics, ) -> impl Iterator + Captures<'tcx> { generics @@ -1826,7 +1826,7 @@ fn early_bound_lifetimes_from_generics<'a, 'tcx: 'a>( /// lifetime constraints. This includes all predicates returned by `explicit_predicates_of`, plus /// inferred constraints concerning which regions outlive other regions. fn predicates_defined_on<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { debug!("predicates_defined_on({:?})", def_id); @@ -1856,7 +1856,7 @@ fn predicates_defined_on<'tcx>( /// ID `def_id`. This includes all predicates returned by `predicates_defined_on`, plus /// `Self: Trait` predicates for traits. fn predicates_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { let mut result = tcx.predicates_defined_on(def_id); @@ -1886,7 +1886,7 @@ fn predicates_of<'tcx>( /// Returns a list of user-specified type predicates for the definition with ID `def_id`. /// N.B., this does not include any implied/inferred constraints. fn explicit_predicates_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &'tcx ty::GenericPredicates<'tcx> { use rustc::hir::*; @@ -2249,7 +2249,7 @@ fn predicates_from_bound<'tcx>( } fn compute_sig_of_foreign_fn_decl<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, decl: &hir::FnDecl, abi: abi::Abi, @@ -2293,7 +2293,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>( fty } -fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { +fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool { match tcx.hir().get_if_local(def_id) { Some(Node::ForeignItem(..)) => true, Some(_) => false, @@ -2302,7 +2302,7 @@ fn is_foreign_item<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId) -> bool { } fn static_mutability<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> Option { match tcx.hir().get_if_local(def_id) { @@ -2318,7 +2318,7 @@ fn static_mutability<'tcx>( } fn from_target_feature( - tcx: TyCtxt<'_, '_, '_>, + tcx: TyCtxt<'_, '_>, id: DefId, attr: &ast::Attribute, whitelist: &FxHashMap>, @@ -2412,7 +2412,7 @@ fn from_target_feature( } } -fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { +fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, name: &str) -> Linkage { use rustc::mir::mono::Linkage::*; // Use the names from src/llvm/docs/LangRef.rst here. Most types are only @@ -2447,7 +2447,7 @@ fn linkage_by_name<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, def_id: DefId, name: &st } } -fn codegen_fn_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { +fn codegen_fn_attrs<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, id: DefId) -> CodegenFnAttrs { let attrs = tcx.get_attrs(id); let mut codegen_fn_attrs = CodegenFnAttrs::new(); diff --git a/src/librustc_typeck/constrained_generic_params.rs b/src/librustc_typeck/constrained_generic_params.rs index a0f592586b43f..c26de71a20ba3 100644 --- a/src/librustc_typeck/constrained_generic_params.rs +++ b/src/librustc_typeck/constrained_generic_params.rs @@ -86,7 +86,7 @@ impl<'tcx> TypeVisitor<'tcx> for ParameterCollector { } } -pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, predicates: &ty::GenericPredicates<'tcx>, impl_trait_ref: Option>, input_parameters: &mut FxHashSet) @@ -136,7 +136,7 @@ pub fn identify_constrained_generic_params<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, /// which is determined by 1, which requires `U`, that is determined /// by 0. I should probably pick a less tangled example, but I can't /// think of any. -pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt<'_, '_, '_>, +pub fn setup_constraining_predicates<'tcx>(tcx: TyCtxt<'_, '_>, predicates: &mut [(ty::Predicate<'tcx>, Span)], impl_trait_ref: Option>, input_parameters: &mut FxHashSet) diff --git a/src/librustc_typeck/impl_wf_check.rs b/src/librustc_typeck/impl_wf_check.rs index 834e939f40f77..6a7bdf48ae9d4 100644 --- a/src/librustc_typeck/impl_wf_check.rs +++ b/src/librustc_typeck/impl_wf_check.rs @@ -49,7 +49,7 @@ use syntax_pos::Span; /// impl<'a> Trait for Bar { type X = &'a i32; } /// // ^ 'a is unused and appears in assoc type, error /// ``` -pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { // We will tag this as part of the WF check -- logically, it is, // but it's one that we must perform earlier than the rest of // WfCheck. @@ -58,7 +58,7 @@ pub fn impl_wf_check<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { } } -fn check_mod_impl_wf<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, module_def_id: DefId) { +fn check_mod_impl_wf<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, module_def_id: DefId) { tcx.hir().visit_item_likes_in_module( module_def_id, &mut ImplWfCheck { tcx } @@ -73,7 +73,7 @@ pub fn provide(providers: &mut Providers<'_>) { } struct ImplWfCheck<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> { @@ -92,7 +92,7 @@ impl ItemLikeVisitor<'tcx> for ImplWfCheck<'tcx> { fn visit_impl_item(&mut self, _impl_item: &'tcx hir::ImplItem) { } } -fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_def_id: DefId, impl_item_refs: &[hir::ImplItemRef]) { @@ -171,7 +171,7 @@ fn enforce_impl_params_are_constrained<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, // used elsewhere are not projected back out. } -fn report_unused_parameter(tcx: TyCtxt<'_, '_, '_>, +fn report_unused_parameter(tcx: TyCtxt<'_, '_>, span: Span, kind: &str, name: &str) @@ -186,7 +186,7 @@ fn report_unused_parameter(tcx: TyCtxt<'_, '_, '_>, } /// Enforce that we do not have two items in an impl with the same name. -fn enforce_impl_items_are_distinct<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn enforce_impl_items_are_distinct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, impl_item_refs: &[hir::ImplItemRef]) { let mut seen_type_items = FxHashMap::default(); diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 74ff8ad0f1753..cb8e699351aa6 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -124,7 +124,7 @@ pub struct TypeAndSubsts<'tcx> { ty: Ty<'tcx>, } -fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, +fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'gcx, 'tcx>, span: Span) { if !tcx.features().type_alias_enum_variants { let mut err = tcx.sess.struct_span_err( @@ -140,7 +140,7 @@ fn check_type_alias_enum_variants_enabled<'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 't } } -fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, +fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_>, decl: &hir::FnDecl, abi: Abi, span: Span) { @@ -151,7 +151,7 @@ fn require_c_abi_if_c_variadic(tcx: TyCtxt<'_, '_, '_>, } } -fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cause: &ObligationCause<'tcx>, expected: Ty<'tcx>, actual: Ty<'tcx>) @@ -179,7 +179,7 @@ fn require_same_types<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, }) } -fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) { +fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, main_def_id: DefId) { let main_id = tcx.hir().as_local_hir_id(main_def_id).unwrap(); let main_span = tcx.def_span(main_def_id); let main_t = tcx.type_of(main_def_id); @@ -244,7 +244,7 @@ fn check_main_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, main_def_id: DefId) { } } -fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefId) { +fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, start_def_id: DefId) { let start_id = tcx.hir().as_local_hir_id(start_def_id).unwrap(); let start_span = tcx.def_span(start_def_id); let start_t = tcx.type_of(start_def_id); @@ -301,7 +301,7 @@ fn check_start_fn_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, start_def_id: DefId) { } } -fn check_for_entry_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +fn check_for_entry_fn<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { match tcx.entry_fn(LOCAL_CRATE) { Some((def_id, EntryFnType::Main)) => check_main_fn_ty(tcx, def_id), Some((def_id, EntryFnType::Start)) => check_start_fn_ty(tcx, def_id), @@ -318,7 +318,7 @@ pub fn provide(providers: &mut Providers<'_>) { impl_wf_check::provide(providers); } -pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) +pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) -> Result<(), ErrorReported> { tcx.sess.profiler(|p| p.start_activity("type-check crate")); @@ -381,7 +381,7 @@ pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) /// A quasi-deprecated helper used in rustdoc and clippy to get /// the type from a HIR node. -pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { +pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty<'tcx> { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in // scope. This is derived from the enclosing item-like thing. @@ -392,7 +392,7 @@ pub fn hir_ty_to_ty<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_ty: &hir::Ty) -> Ty astconv::AstConv::ast_ty_to_ty(&item_cx, hir_ty) } -pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, hir_trait: &hir::TraitRef) +pub fn hir_trait_to_predicates<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_trait: &hir::TraitRef) -> (ty::PolyTraitRef<'tcx>, Bounds<'tcx>) { // In case there are any projections, etc., find the "environment" // def-ID that will be used to determine the traits/predicates in diff --git a/src/librustc_typeck/outlives/explicit.rs b/src/librustc_typeck/outlives/explicit.rs index 87ba9a466a82d..9d621407caf5f 100644 --- a/src/librustc_typeck/outlives/explicit.rs +++ b/src/librustc_typeck/outlives/explicit.rs @@ -18,7 +18,7 @@ impl<'tcx> ExplicitPredicatesMap<'tcx> { pub fn explicit_predicates_of( &mut self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId, ) -> &RequiredPredicates<'tcx> { self.map.entry(def_id).or_insert_with(|| { diff --git a/src/librustc_typeck/outlives/implicit_infer.rs b/src/librustc_typeck/outlives/implicit_infer.rs index 354be95c05007..73a1be0027ae4 100644 --- a/src/librustc_typeck/outlives/implicit_infer.rs +++ b/src/librustc_typeck/outlives/implicit_infer.rs @@ -15,7 +15,7 @@ use super::utils::*; /// was generated by walking the items in the crate. This will /// now be filled with inferred predicates. pub fn infer_predicates<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, explicit_map: &mut ExplicitPredicatesMap<'tcx>, ) -> FxHashMap> { debug!("infer_predicates"); @@ -44,7 +44,7 @@ pub fn infer_predicates<'tcx>( } pub struct InferVisitor<'cx, 'tcx: 'cx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, global_inferred_outlives: &'cx mut FxHashMap>, predicates_added: &'cx mut bool, explicit_map: &'cx mut ExplicitPredicatesMap<'tcx>, @@ -117,7 +117,7 @@ impl<'cx, 'tcx> ItemLikeVisitor<'tcx> for InferVisitor<'cx, 'tcx> { } fn insert_required_predicates_to_be_wf<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, field_ty: Ty<'tcx>, global_inferred_outlives: &FxHashMap>, required_predicates: &mut RequiredPredicates<'tcx>, @@ -255,7 +255,7 @@ pub struct IgnoreSelfTy(bool); /// can ignore, but we will want to process `U: 'static`, /// applying the substitution as above. pub fn check_explicit_predicates<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, def_id: &DefId, substs: &[Kind<'tcx>], required_predicates: &mut RequiredPredicates<'tcx>, diff --git a/src/librustc_typeck/outlives/mod.rs b/src/librustc_typeck/outlives/mod.rs index 3966a7c1776a1..03e1a6e4d44bc 100644 --- a/src/librustc_typeck/outlives/mod.rs +++ b/src/librustc_typeck/outlives/mod.rs @@ -21,7 +21,7 @@ pub fn provide(providers: &mut Providers<'_>) { } fn inferred_outlives_of<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId, ) -> &'tcx [ty::Predicate<'tcx>] { let id = tcx @@ -71,7 +71,7 @@ fn inferred_outlives_of<'tcx>( } fn inferred_outlives_crate<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum, ) -> &'tcx CratePredicatesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); diff --git a/src/librustc_typeck/outlives/test.rs b/src/librustc_typeck/outlives/test.rs index 2b0ab90693685..7055bbd3c51d2 100644 --- a/src/librustc_typeck/outlives/test.rs +++ b/src/librustc_typeck/outlives/test.rs @@ -3,14 +3,14 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_inferred_outlives<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_inferred_outlives<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.hir() .krate() .visit_all_item_likes(&mut OutlivesTest { tcx }); } struct OutlivesTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, } impl ItemLikeVisitor<'tcx> for OutlivesTest<'tcx> { diff --git a/src/librustc_typeck/outlives/utils.rs b/src/librustc_typeck/outlives/utils.rs index 26243c765ed13..2aa2efbb6236b 100644 --- a/src/librustc_typeck/outlives/utils.rs +++ b/src/librustc_typeck/outlives/utils.rs @@ -11,7 +11,7 @@ pub type RequiredPredicates<'tcx> = BTreeSet, t /// Given a requirement `T: 'a` or `'b: 'a`, deduce the /// outlives_component and add it to `required_predicates` pub fn insert_outlives_predicate<'tcx>( - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, kind: Kind<'tcx>, outlived_region: Region<'tcx>, required_predicates: &mut RequiredPredicates<'tcx>, @@ -125,7 +125,7 @@ pub fn insert_outlives_predicate<'tcx>( } } -fn is_free_region<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region: Region<'_>) -> bool { +fn is_free_region<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, region: Region<'_>) -> bool { // First, screen for regions that might appear in a type header. match region { // These correspond to `T: 'a` relationships: diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 325f632ad6dee..5433afa2a7b89 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -124,7 +124,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { self.build_constraints_for_item(def_id); } - fn tcx(&self) -> TyCtxt<'tcx, 'tcx, 'tcx> { + fn tcx(&self) -> TyCtxt<'tcx, 'tcx> { self.terms_cx.tcx } diff --git a/src/librustc_typeck/variance/mod.rs b/src/librustc_typeck/variance/mod.rs index a9d12a0b291b4..c8079210022f6 100644 --- a/src/librustc_typeck/variance/mod.rs +++ b/src/librustc_typeck/variance/mod.rs @@ -34,7 +34,7 @@ pub fn provide(providers: &mut Providers<'_>) { }; } -fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) +fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, crate_num: CrateNum) -> &'tcx CrateVariancesMap<'tcx> { assert_eq!(crate_num, LOCAL_CRATE); let mut arena = arena::TypedArena::default(); @@ -43,7 +43,7 @@ fn crate_variances<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, crate_num: CrateNum) tcx.arena.alloc(solve::solve_constraints(constraints_cx)) } -fn variances_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, item_def_id: DefId) +fn variances_of<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item_def_id: DefId) -> &'tcx [ty::Variance] { let id = tcx.hir().as_local_hir_id(item_def_id).expect("expected local def-id"); let unsupported = || { diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 2faae2b2a97b2..e566500571335 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -48,7 +48,7 @@ impl<'a> fmt::Debug for VarianceTerm<'a> { // The first pass over the crate simply builds up the set of inferreds. pub struct TermsContext<'a, 'tcx: 'a> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub arena: &'a TypedArena>, // For marker types, UnsafeCell, and other lang items where @@ -64,7 +64,7 @@ pub struct TermsContext<'a, 'tcx: 'a> { pub inferred_terms: Vec>, } -pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, +pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx>, arena: &'a mut TypedArena>) -> TermsContext<'a, 'tcx> { let mut terms_cx = TermsContext { @@ -85,7 +85,7 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tc terms_cx } -fn lang_items(tcx: TyCtxt<'_, '_, '_>) -> Vec<(hir::HirId, Vec)> { +fn lang_items(tcx: TyCtxt<'_, '_>) -> Vec<(hir::HirId, Vec)> { let lang_items = tcx.lang_items(); let all = vec![ (lang_items.phantom_data(), vec![ty::Covariant]), diff --git a/src/librustc_typeck/variance/test.rs b/src/librustc_typeck/variance/test.rs index 0ff86f5a8cfde..3f55b3360154c 100644 --- a/src/librustc_typeck/variance/test.rs +++ b/src/librustc_typeck/variance/test.rs @@ -3,12 +3,12 @@ use rustc::hir::itemlikevisit::ItemLikeVisitor; use rustc::ty::TyCtxt; use syntax::symbol::sym; -pub fn test_variance<'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) { +pub fn test_variance<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) { tcx.hir().krate().visit_all_item_likes(&mut VarianceTest { tcx }); } struct VarianceTest<'tcx> { - tcx: TyCtxt<'tcx, 'tcx, 'tcx> + tcx: TyCtxt<'tcx, 'tcx> } impl ItemLikeVisitor<'tcx> for VarianceTest<'tcx> { diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 2bf80198381da..b0f274ac6b791 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -315,7 +315,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { fn extract_for_generics<'c, 'd>( &self, - tcx: TyCtxt<'d, 'c, 'd>, + tcx: TyCtxt<'c, 'd>, pred: ty::Predicate<'d>, ) -> FxHashSet { pred.walk_tys() @@ -450,7 +450,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // * We explcitly add a '?Sized' bound if we didn't find any 'Sized' predicates for a type fn param_env_to_generics<'c, 'cx>( &self, - tcx: TyCtxt<'cx, 'c, 'cx>, + tcx: TyCtxt<'c, 'cx>, param_env_def_id: DefId, param_env: ty::ParamEnv<'cx>, mut existing_predicates: Vec, @@ -776,7 +776,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { vec.sort_by_cached_key(|x| format!("{:?}", x)) } - fn is_fn_ty(&self, tcx: TyCtxt<'_, '_, '_>, ty: &Type) -> bool { + fn is_fn_ty(&self, tcx: TyCtxt<'_, '_>, ty: &Type) -> bool { match &ty { &&Type::ResolvedPath { ref did, .. } => { *did == tcx.require_lang_item(lang_items::FnTraitLangItem) @@ -791,11 +791,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { // Replaces all ReVars in a type with ty::Region's, using the provided map struct RegionReplacer<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { vid_to_region: &'a FxHashMap>, - tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + tcx: TyCtxt<'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'gcx, 'tcx> { self.tcx } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index e44c35b55ffad..559dcaf5a8d3b 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -4432,7 +4432,7 @@ where // Start of code copied from rust-clippy -pub fn path_to_def_local(tcx: TyCtxt<'_, '_, '_>, path: &[Symbol]) -> Option { +pub fn path_to_def_local(tcx: TyCtxt<'_, '_>, path: &[Symbol]) -> Option { let krate = tcx.hir().krate(); let mut items = krate.module.item_ids.clone(); let mut path_it = path.iter().peekable(); @@ -4457,7 +4457,7 @@ pub fn path_to_def_local(tcx: TyCtxt<'_, '_, '_>, path: &[Symbol]) -> Option, path: &[Symbol]) -> Option { +pub fn path_to_def(tcx: TyCtxt<'_, '_>, path: &[Symbol]) -> Option { let crates = tcx.crates(); let krate = crates diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 2a3bc5e99617f..b48ed12cc6baa 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -44,7 +44,7 @@ pub type ExternalPaths = FxHashMap, clean::TypeKind)>; pub struct DocContext<'tcx> { - pub tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + pub tcx: TyCtxt<'tcx, 'tcx>, pub resolver: Rc>>, /// The stack of module NodeIds up till this point pub crate_name: Option, diff --git a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs index 7e9f004684d38..7fc3e5a097920 100644 --- a/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs +++ b/src/test/run-make-fulldeps/hotplug_codegen_backend/the_backend.rs @@ -60,7 +60,7 @@ impl CodegenBackend for TheBackend { fn codegen_crate<'a, 'tcx>( &self, - tcx: TyCtxt<'tcx, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx>, _metadata: EncodedMetadata, _need_metadata_module: bool, _rx: mpsc::Receiver> diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs index 075ce8b1a1cb2..00190ed12b4d6 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.rs @@ -11,26 +11,26 @@ use rustc::ty::{Ty, TyCtxt}; fn ty_by_ref( ty_val: Ty<'_>, ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, //~ ERROR passing `TyCtxt<'_, '_, '_>` by reference + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, //~ ERROR passing `TyCtxt<'_, '_>` by reference ) { } -fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} +fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} //~^ ERROR passing `Ty<'_>` by reference -//~^^ ERROR passing `TyCtxt<'_, '_, '_>` by reference +//~^^ ERROR passing `TyCtxt<'_, '_>` by reference trait T { fn ty_by_ref_in_trait( ty_val: Ty<'_>, ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, //~ ERROR passing `TyCtxt<'_, '_, '_>` by reference + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, //~ ERROR passing `TyCtxt<'_, '_>` by reference ); - fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>); + fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>); //~^ ERROR passing `Ty<'_>` by reference - //~^^ ERROR passing `TyCtxt<'_, '_, '_>` by reference + //~^^ ERROR passing `TyCtxt<'_, '_>` by reference } struct Foo; @@ -39,26 +39,26 @@ impl T for Foo { fn ty_by_ref_in_trait( ty_val: Ty<'_>, ty_ref: &Ty<'_>, - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, ) { } - fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} + fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} } impl Foo { fn ty_by_ref_assoc( ty_val: Ty<'_>, ty_ref: &Ty<'_>, //~ ERROR passing `Ty<'_>` by reference - ty_ctxt_val: TyCtxt<'_, '_, '_>, - ty_ctxt_ref: &TyCtxt<'_, '_, '_>, //~ ERROR passing `TyCtxt<'_, '_, '_>` by reference + ty_ctxt_val: TyCtxt<'_, '_>, + ty_ctxt_ref: &TyCtxt<'_, '_>, //~ ERROR passing `TyCtxt<'_, '_>` by reference ) { } - fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} + fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} //~^ ERROR passing `Ty<'_>` by reference - //~^^ ERROR passing `TyCtxt<'_, '_, '_>` by reference + //~^^ ERROR passing `TyCtxt<'_, '_>` by reference } fn main() {} diff --git a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr index f3e630f3be238..94440f0385a92 100644 --- a/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr +++ b/src/test/ui-fulldeps/internal-lints/pass_ty_by_ref.stderr @@ -10,23 +10,23 @@ note: lint level defined here LL | #![deny(ty_pass_by_reference)] | ^^^^^^^^^^^^^^^^^^^^ -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:15:18 | -LL | ty_ctxt_ref: &TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_ref: &TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:19:28 | -LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} +LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:19:55 | -LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | fn ty_multi_ref(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:26:17 @@ -34,23 +34,23 @@ error: passing `Ty<'_>` by reference LL | ty_ref: &Ty<'_>, | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:28:22 | -LL | ty_ctxt_ref: &TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_ref: &TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:31:41 | -LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>); +LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>); | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:31:68 | -LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>); - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | fn ty_multi_ref_in_trait(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>); + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:53:17 @@ -58,23 +58,23 @@ error: passing `Ty<'_>` by reference LL | ty_ref: &Ty<'_>, | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:55:22 | -LL | ty_ctxt_ref: &TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_ref: &TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: passing `Ty<'_>` by reference --> $DIR/pass_ty_by_ref.rs:59:38 | -LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} +LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} | ^^^^^^^ help: try passing by value: `Ty<'_>` -error: passing `TyCtxt<'_, '_, '_>` by reference +error: passing `TyCtxt<'_, '_>` by reference --> $DIR/pass_ty_by_ref.rs:59:65 | -LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_, '_>) {} - | ^^^^^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_, '_>` +LL | fn ty_multi_ref_assoc(ty_multi: &&Ty<'_>, ty_ctxt_multi: &&&&TyCtxt<'_, '_>) {} + | ^^^^^^^^^^^^^^^ help: try passing by value: `TyCtxt<'_, '_>` error: aborting due to 12 previous errors diff --git a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs index 5e10697ec66d4..fa019dfe3ae09 100644 --- a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs +++ b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.rs @@ -13,8 +13,8 @@ macro_rules! qualified_macro { fn ty_in_macro( ty_q: ty::Ty<'_>, ty: Ty<'_>, - ty_ctxt_q: ty::TyCtxt<'_, '_, '_>, - ty_ctxt: TyCtxt<'_, '_, '_>, + ty_ctxt_q: ty::TyCtxt<'_, '_>, + ty_ctxt: TyCtxt<'_, '_>, ) { println!("{}", stringify!($a)); } @@ -24,8 +24,8 @@ macro_rules! qualified_macro { fn ty_qualified( ty_q: ty::Ty<'_>, //~ ERROR usage of qualified `ty::Ty<'_>` ty: Ty<'_>, - ty_ctxt_q: ty::TyCtxt<'_, '_, '_>, //~ ERROR usage of qualified `ty::TyCtxt<'_, '_, '_>` - ty_ctxt: TyCtxt<'_, '_, '_>, + ty_ctxt_q: ty::TyCtxt<'_, '_>, //~ ERROR usage of qualified `ty::TyCtxt<'_, '_>` + ty_ctxt: TyCtxt<'_, '_>, ) { } diff --git a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr index 31d776cd9e00a..445546ab6eec0 100644 --- a/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr +++ b/src/test/ui-fulldeps/internal-lints/qualified_ty_ty_ctxt.stderr @@ -10,11 +10,11 @@ note: lint level defined here LL | #![deny(usage_of_qualified_ty)] | ^^^^^^^^^^^^^^^^^^^^^ -error: usage of qualified `ty::TyCtxt<'_, '_, '_>` +error: usage of qualified `ty::TyCtxt<'_, '_>` --> $DIR/qualified_ty_ty_ctxt.rs:27:16 | -LL | ty_ctxt_q: ty::TyCtxt<'_, '_, '_>, - | ^^^^^^^^^^^^^^^^^^^^^^ help: try using it unqualified: `TyCtxt<'_, '_, '_>` +LL | ty_ctxt_q: ty::TyCtxt<'_, '_>, + | ^^^^^^^^^^^^^^^^^^ help: try using it unqualified: `TyCtxt<'_, '_>` error: aborting due to 2 previous errors