diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-06-11 22:03:44 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2019-06-12 13:38:27 +0300 |
| commit | 37799a5552d308da5d74d9654036f2f541f3c8c3 (patch) | |
| tree | f50866c051bcb3543a04dbc694bc24bb92c130f4 /src/librustc/traits | |
| parent | 3f511ade5b0bc42028e42b81392feec770d90ead (diff) | |
| download | rust-37799a5552d308da5d74d9654036f2f541f3c8c3.tar.gz rust-37799a5552d308da5d74d9654036f2f541f3c8c3.zip | |
rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.
Diffstat (limited to 'src/librustc/traits')
25 files changed, 125 insertions, 125 deletions
diff --git a/src/librustc/traits/auto_trait.rs b/src/librustc/traits/auto_trait.rs index 9ce35d15d3c..480d76b308d 100644 --- a/src/librustc/traits/auto_trait.rs +++ b/src/librustc/traits/auto_trait.rs @@ -47,12 +47,12 @@ pub struct AutoTraitInfo<'cx> { pub vid_to_region: FxHashMap<ty::RegionVid, ty::Region<'cx>>, } -pub struct AutoTraitFinder<'a, 'tcx: 'a> { - tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub struct AutoTraitFinder<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, } -impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { - pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self { +impl<'tcx> AutoTraitFinder<'tcx> { + pub fn new(tcx: TyCtxt<'tcx, 'tcx, 'tcx>) -> Self { AutoTraitFinder { tcx } } @@ -232,7 +232,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { } } -impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { +impl AutoTraitFinder<'tcx> { // The core logic responsible for computing the bounds for our synthesized impl. // // To calculate the bounds, we call SelectionContext.select in a loop. Like FulfillmentContext, @@ -834,11 +834,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, '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<ty::RegionVid, ty::Region<'tcx>>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, } impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionReplacer<'a, 'gcx, 'tcx> { - fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.tcx } diff --git a/src/librustc/traits/codegen/mod.rs b/src/librustc/traits/codegen/mod.rs index 591557eb2be..d576c13844d 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<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, +pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'tcx, 'tcx, 'tcx>, (param_env, trait_ref): (ty::ParamEnv<'tcx>, ty::PolyTraitRef<'tcx>)) -> Vtable<'tcx, ()> @@ -74,7 +74,7 @@ pub fn codegen_fulfill_obligation<'a, 'tcx>(ty: TyCtxt<'a, 'tcx, 'tcx>, }) } -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, '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 c6521a931bb..db9e7fc4b6d 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>, + tcx: TyCtxt<'gcx, '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<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>) -> Option<Conflict> { @@ -229,7 +229,7 @@ pub fn trait_ref_is_knowable<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, } } -pub fn trait_ref_is_local_or_fundamental<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub fn trait_ref_is_local_or_fundamental<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, '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<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub fn orphan_check<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) -> Result<(), OrphanCheckErr<'tcx>> { diff --git a/src/librustc/traits/engine.rs b/src/librustc/traits/engine.rs index 2f019d823ff..23bbd9192b1 100644 --- a/src/librustc/traits/engine.rs +++ b/src/librustc/traits/engine.rs @@ -78,7 +78,7 @@ impl<T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T { } impl dyn TraitEngine<'tcx> { - pub fn new(tcx: TyCtxt<'_, '_, 'tcx>) -> Box<Self> { + pub fn new(tcx: TyCtxt<'tcx, '_, 'tcx>) -> Box<Self> { 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 50d2eeef421..5b3e0dde0cc 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<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn build_fn_sig_string<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, '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<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, '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<'b, 'gcx, 'tcx> { self.infcx.tcx } + fn tcx<'b>(&'b self) -> TyCtxt<'tcx, '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 fd2d8fd0661..774150ce7ad 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<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Span { + pub fn span<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, '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<'a, 'gcx>( domain_goal: PolyDomainGoal<'tcx>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, region_context: DefId, cause: ObligationCause<'tcx>, elaborated_env: ty::ParamEnv<'tcx>, @@ -795,7 +795,7 @@ fn do_normalize_predicates<'a, 'tcx>(tcx: TyCtxt<'a, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub fn normalize_param_env_or_error<'a, 'tcx>(tcx: TyCtxt<'tcx, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, predicates: Vec<ty::Predicate<'tcx>>) -> bool { @@ -965,7 +965,7 @@ fn normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, result } -fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'tcx, 'tcx, 'tcx>, key: (DefId, SubstsRef<'tcx>)) -> bool { @@ -984,7 +984,7 @@ fn substitute_normalize_and_test_predicates<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx /// that come from `trait_ref`, including its supertraits. #[inline] // FIXME(#35870): avoid closures being unexported due to `impl Trait`. fn vtable_methods<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) -> &'tcx [Option<(DefId, SubstsRef<'tcx>)>] { @@ -1207,16 +1207,16 @@ where fn lift_ex_clause_to_tcx<'a, 'gcx>( ex_clause: &chalk_engine::ExClause<Self>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option<Self::LiftedExClause>; fn lift_delayed_literal_to_tcx<'a, 'gcx>( ex_clause: &chalk_engine::DelayedLiteral<Self>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option<Self::LiftedDelayedLiteral>; fn lift_literal_to_tcx<'a, 'gcx>( ex_clause: &chalk_engine::Literal<Self>, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, ) -> Option<Self::LiftedLiteral>; } diff --git a/src/librustc/traits/object_safety.rs b/src/librustc/traits/object_safety.rs index 5006ff75667..9e8cb58e6ea 100644 --- a/src/librustc/traits/object_safety.rs +++ b/src/librustc/traits/object_safety.rs @@ -83,7 +83,7 @@ pub enum MethodViolationCode { UndispatchableReceiver, } -impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { +impl<'a, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Returns the object safety violations that affect /// astconv -- currently, `Self` in supertraits. This is needed @@ -703,7 +703,7 @@ impl<'a, 'tcx> TyCtxt<'a, 'tcx, 'tcx> { } } -pub(super) fn is_object_safe_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub(super) fn is_object_safe_provider<'a, 'tcx>(tcx: TyCtxt<'tcx, '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 b78396c90dc..5ddc3e8fe51 100644 --- a/src/librustc/traits/on_unimplemented.rs +++ b/src/librustc/traits/on_unimplemented.rs @@ -52,7 +52,7 @@ fn parse_error(tcx: TyCtxt<'_, '_, '_>, span: Span, } impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { - fn parse(tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, items: &[NestedMetaItem], span: Span, @@ -133,7 +133,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { } - pub fn of_item(tcx: TyCtxt<'a, 'gcx, 'tcx>, + pub fn of_item(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, impl_def_id: DefId) -> Result<Option<Self>, ErrorReported> @@ -165,7 +165,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { } pub fn evaluate(&self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &[(Symbol, Option<String>)]) -> OnUnimplementedNote @@ -215,7 +215,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedDirective { } impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { - fn try_parse(tcx: TyCtxt<'a, 'gcx, 'tcx>, + fn try_parse(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, from: LocalInternedString, err_sp: Span) @@ -228,7 +228,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { fn verify( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId, span: Span, ) -> Result<(), ErrorReported> { @@ -274,7 +274,7 @@ impl<'a, 'gcx, 'tcx> OnUnimplementedFormatString { pub fn format( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::TraitRef<'tcx>, options: &FxHashMap<Symbol, String>, ) -> String { diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index 3ee6d0cc67b..6f52aaa0205 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<'c, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.selcx.tcx() } @@ -836,7 +836,7 @@ struct Progress<'tcx> { } impl<'tcx> Progress<'tcx> { - fn error<'a,'gcx>(tcx: TyCtxt<'a,'gcx,'tcx>) -> Self { + fn error<'a,'gcx>(tcx: TyCtxt<'tcx, '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 c4aa14d2b7e..7fdf3ddceb5 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: TyCtxt<'tcx, '_, '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: TyCtxt<'tcx, '_, 'tcx>, span: Span, ty: Ty<'tcx>, ) -> Vec<Kind<'tcx>> { @@ -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>, ty: Ty<'tcx>) -> bool { +pub fn trivial_dropck_outlives<'tcx>(tcx: TyCtxt<'tcx, '_, '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 0b20ec884fc..8ee5447ab29 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<'c, 'gcx, 'tcx> { + fn tcx<'c>(&'c self) -> TyCtxt<'tcx, '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 0c1252680c1..6c8f0d77929 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<'cx, 'tcx> TyCtxt<'cx, 'tcx, 'tcx> { +impl<'cx, 'tcx> TyCtxt<'tcx, 'tcx, 'tcx> { /// Erase the regions in `value` and then fully normalize all the /// types found within. The result will also have regions erased. /// @@ -62,13 +62,13 @@ impl<'cx, 'tcx> TyCtxt<'cx, 'tcx, 'tcx> { } } -struct NormalizeAfterErasingRegionsFolder<'cx, 'tcx: 'cx> { - tcx: TyCtxt<'cx, 'tcx, 'tcx>, +struct NormalizeAfterErasingRegionsFolder<'tcx> { + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, } -impl<'cx, 'tcx> TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'cx, 'tcx> { - fn tcx<'a>(&'a self) -> TyCtxt<'a, 'tcx, 'tcx> { +impl TypeFolder<'tcx, 'tcx> for NormalizeAfterErasingRegionsFolder<'tcx> { + fn tcx<'a>(&'a self) -> TyCtxt<'tcx, '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 d9f573eb7e2..bb6b2272c78 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<'_, 'gcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option<Self::QueryResponse> { None } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> { 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 5c3ccc9a995..a8e78680946 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<'_, 'gcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Eq<'tcx>>, ) -> Option<Self::QueryResponse> { 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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> { 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 c48ca33b13f..537f6ccee62 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<OutlivesBound<'tcx>>; fn try_fast_path( - _tcx: TyCtxt<'_, 'gcx, 'tcx>, + _tcx: TyCtxt<'tcx, 'gcx, 'tcx>, _key: &ParamEnvAnd<'tcx, Self>, ) -> Option<Self::QueryResponse> { None } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> { // 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 fd13acc7796..c1f76eb2f2f 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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option<Self::QueryResponse>; @@ -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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>>; diff --git a/src/librustc/traits/query/type_op/normalize.rs b/src/librustc/traits/query/type_op/normalize.rs index 594f55e52f8..3fc3d9607e7 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<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> { + fn try_fast_path(_tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<T> { if !key.value.value.has_projections() { Some(key.value.value) } else { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> { 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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>>; @@ -64,7 +64,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> { tcx.type_op_normalize_ty(canonicalized) @@ -82,7 +82,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> { tcx.type_op_normalize_predicate(canonicalized) @@ -100,7 +100,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> { tcx.type_op_normalize_poly_fn_sig(canonicalized) @@ -118,7 +118,7 @@ where 'gcx: 'tcx, { fn type_op_method( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Normalize<Self>>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self>> { 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 fc0c1c022fc..ee5cd30bde8 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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option<Self::QueryResponse> { if trivial_dropck_outlives(tcx, key.value.dropped_ty) { @@ -33,7 +33,7 @@ where } fn perform_query( - tcx: TyCtxt<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, Self::QueryResponse>> { // 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 50dedf6e87f..6a46ea40575 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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>, ) -> Option<Self::QueryResponse> { // 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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> { 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 c45fb06313e..346af0dd9df 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<'_, 'gcx, 'tcx>, key: &ParamEnvAnd<'tcx, Self>) -> Option<()> { + fn try_fast_path(_tcx: TyCtxt<'tcx, '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<'_, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, canonicalized: Canonicalized<'gcx, ParamEnvAnd<'tcx, Self>>, ) -> Fallible<CanonicalizedQueryResponse<'gcx, ()>> { tcx.type_op_subtype(canonicalized) diff --git a/src/librustc/traits/select.rs b/src/librustc/traits/select.rs index af0b51e637a..4643e2498fc 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'cx, 'gcx, 'tcx> { + pub fn tcx(&self) -> TyCtxt<'tcx, 'gcx, 'tcx> { self.infcx.tcx } diff --git a/src/librustc/traits/specialize/mod.rs b/src/librustc/traits/specialize/mod.rs index b5d45d040fb..8043bca8e09 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<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, param_env: ty::ParamEnv<'tcx>, item: &ty::AssocItem, substs: SubstsRef<'tcx>, @@ -149,7 +149,7 @@ pub fn find_associated_item<'a, '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<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, +pub(super) fn specializes<'a, 'tcx>(tcx: TyCtxt<'tcx, '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<'a, 'tcx>( - tcx: TyCtxt<'a, 'tcx, 'tcx>, + tcx: TyCtxt<'tcx, 'tcx, 'tcx>, trait_id: DefId, ) -> &'tcx specialization_graph::Graph { let mut sg = specialization_graph::Graph::new(); diff --git a/src/librustc/traits/specialize/specialization_graph.rs b/src/librustc/traits/specialize/specialization_graph.rs index 9a90b9fdaea..8b386f3c0a0 100644 --- a/src/librustc/traits/specialize/specialization_graph.rs +++ b/src/librustc/traits/specialize/specialization_graph.rs @@ -84,7 +84,7 @@ enum Inserted { impl<'a, 'gcx, 'tcx> Children { /// Insert an impl into this set of children without comparing to any existing impls. fn insert_blindly(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, '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<'a, '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<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) { let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap(); let vec: &mut Vec<DefId>; @@ -119,7 +119,7 @@ impl<'a, 'gcx, 'tcx> Children { /// Attempt to insert an impl into this set of children, while comparing for /// specialization relationships. fn insert(&mut self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId, simplified_self: Option<SimplifiedType>) -> Result<Inserted, OverlapError> @@ -294,7 +294,7 @@ impl<'a, '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<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, impl_def_id: DefId) -> Result<Option<FutureCompatOverlapError>, OverlapError> { assert!(impl_def_id.is_local()); @@ -387,7 +387,7 @@ impl<'a, '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<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, parent: DefId, child: DefId) { if self.parent.insert(child, parent).is_some() { @@ -425,8 +425,8 @@ impl<'a, 'gcx, 'tcx> Node { /// Iterate over the items defined directly by the given (impl or trait) node. pub fn items( &self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, - ) -> ty::AssocItemsIterator<'a, 'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, + ) -> ty::AssocItemsIterator<'gcx, 'tcx> { tcx.associated_items(self.def_id()) } @@ -475,18 +475,18 @@ impl<T> NodeItem<T> { } } -impl<'a, 'gcx, 'tcx> Ancestors<'gcx> { +impl<'gcx, 'tcx> Ancestors<'gcx> { /// Search the items from the given ancestors, returning each definition /// with the given name and the given kind. // FIXME(#35870): avoid closures being unexported due to `impl Trait`. #[inline] pub fn defs( self, - tcx: TyCtxt<'a, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_item_name: Ident, trait_item_kind: ty::AssocKind, trait_def_id: DefId, - ) -> impl Iterator<Item = NodeItem<ty::AssocItem>> + Captures<'gcx> + Captures<'tcx> + 'a { + ) -> impl Iterator<Item = NodeItem<ty::AssocItem>> + Captures<'gcx> + 'tcx { self.flat_map(move |node| { use crate::ty::AssocKind::*; node.items(tcx).filter(move |impl_item| match (trait_item_kind, impl_item.kind) { diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index f6108f2a286..1591cad9ae5 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { 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<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { <C as traits::ChalkContextLift>::lift_ex_clause_to_tcx(self, tcx) } } @@ -733,7 +733,7 @@ where { type Lifted = C::LiftedDelayedLiteral; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { <C as traits::ChalkContextLift>::lift_delayed_literal_to_tcx(self, tcx) } } @@ -745,7 +745,7 @@ where { type Lifted = C::LiftedLiteral; - fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Option<Self::Lifted> { + fn lift_to_tcx<'a, 'gcx>(&self, tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Option<Self::Lifted> { <C as traits::ChalkContextLift>::lift_literal_to_tcx(self, tcx) } } diff --git a/src/librustc/traits/util.rs b/src/librustc/traits/util.rs index 2f87a743a01..3f0ac9036f8 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<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, +fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, pred: &ty::Predicate<'tcx>) -> ty::Predicate<'tcx> { match *pred { @@ -45,13 +45,13 @@ fn anonymize_predicate<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>, } } -struct PredicateSet<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +struct PredicateSet<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, set: FxHashSet<ty::Predicate<'tcx>>, } -impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> { - fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self { +impl PredicateSet<'gcx, 'tcx> { + fn new(tcx: TyCtxt<'tcx, 'gcx, 'tcx>) -> Self { Self { tcx: tcx, set: Default::default() } } @@ -70,7 +70,7 @@ impl<'a, 'gcx, 'tcx> PredicateSet<'a, 'gcx, 'tcx> { } } -impl<'a, 'gcx, 'tcx, T: AsRef<ty::Predicate<'tcx>>> Extend<T> for PredicateSet<'a, 'gcx, 'tcx> { +impl<T: AsRef<ty::Predicate<'tcx>>> Extend<T> for PredicateSet<'gcx, 'tcx> { fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) { for pred in iter { self.insert(pred.as_ref()); @@ -88,39 +88,39 @@ impl<'a, 'gcx, 'tcx, T: AsRef<ty::Predicate<'tcx>>> Extend<T> for PredicateSet<' /// if we know that `T: Ord`, the elaborator would deduce that `T: PartialOrd` /// holds as well. Similarly, if we have `trait Foo: 'static`, and we know that /// `T: Foo`, then we know that `T: 'static`. -pub struct Elaborator<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { +pub struct Elaborator<'gcx, 'tcx> { stack: Vec<ty::Predicate<'tcx>>, - visited: PredicateSet<'a, 'gcx, 'tcx>, + visited: PredicateSet<'gcx, 'tcx>, } pub fn elaborate_trait_ref<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) - -> Elaborator<'cx, 'gcx, 'tcx> + -> Elaborator<'gcx, 'tcx> { elaborate_predicates(tcx, vec![trait_ref.to_predicate()]) } pub fn elaborate_trait_refs<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_refs: impl Iterator<Item = ty::PolyTraitRef<'tcx>>) - -> Elaborator<'cx, 'gcx, 'tcx> + -> Elaborator<'gcx, 'tcx> { let predicates = trait_refs.map(|trait_ref| trait_ref.to_predicate()).collect(); elaborate_predicates(tcx, predicates) } pub fn elaborate_predicates<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, mut predicates: Vec<ty::Predicate<'tcx>>) - -> Elaborator<'cx, 'gcx, 'tcx> + -> Elaborator<'gcx, 'tcx> { let mut visited = PredicateSet::new(tcx); predicates.retain(|pred| visited.insert(pred)); Elaborator { stack: predicates, visited } } -impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> { +impl Elaborator<'gcx, 'tcx> { pub fn filter_to_traits(self) -> FilterToTraits<Self> { FilterToTraits::new(self) } @@ -232,7 +232,7 @@ impl<'cx, 'gcx, 'tcx> Elaborator<'cx, 'gcx, 'tcx> { } } -impl<'cx, 'gcx, 'tcx> Iterator for Elaborator<'cx, 'gcx, 'tcx> { +impl Iterator for Elaborator<'gcx, 'tcx> { type Item = ty::Predicate<'tcx>; fn size_hint(&self) -> (usize, Option<usize>) { @@ -254,17 +254,17 @@ impl<'cx, 'gcx, 'tcx> Iterator for Elaborator<'cx, 'gcx, 'tcx> { // Supertrait iterator /////////////////////////////////////////////////////////////////////////// -pub type Supertraits<'cx, 'gcx, 'tcx> = FilterToTraits<Elaborator<'cx, 'gcx, 'tcx>>; +pub type Supertraits<'gcx, 'tcx> = FilterToTraits<Elaborator<'gcx, 'tcx>>; -pub fn supertraits<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, +pub fn supertraits<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_ref: ty::PolyTraitRef<'tcx>) - -> Supertraits<'cx, 'gcx, 'tcx> { + -> Supertraits<'gcx, 'tcx> { elaborate_trait_ref(tcx, trait_ref).filter_to_traits() } -pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, +pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, bounds: impl Iterator<Item = ty::PolyTraitRef<'tcx>>) - -> Supertraits<'cx, 'gcx, 'tcx> { + -> Supertraits<'gcx, 'tcx> { elaborate_trait_refs(tcx, bounds).filter_to_traits() } @@ -280,8 +280,8 @@ pub fn transitive_bounds<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, /// `Read + Write + Sync + Send`. /// Expansion is done via a DFS (depth-first search), and the `visited` field /// is used to avoid cycles. -pub struct TraitAliasExpander<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct TraitAliasExpander<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, stack: Vec<TraitAliasExpansionInfo<'tcx>>, } @@ -338,9 +338,9 @@ impl<'tcx> TraitAliasExpansionInfo<'tcx> { } pub fn expand_trait_aliases<'cx, 'gcx, 'tcx>( - tcx: TyCtxt<'cx, 'gcx, 'tcx>, + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_refs: impl IntoIterator<Item = (ty::PolyTraitRef<'tcx>, Span)> -) -> TraitAliasExpander<'cx, 'gcx, 'tcx> { +) -> TraitAliasExpander<'gcx, 'tcx> { let items: Vec<_> = trait_refs .into_iter() .map(|(trait_ref, span)| TraitAliasExpansionInfo::new(trait_ref, span)) @@ -348,7 +348,7 @@ pub fn expand_trait_aliases<'cx, 'gcx, 'tcx>( TraitAliasExpander { tcx, stack: items } } -impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'cx, 'gcx, 'tcx> { +impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'gcx, 'tcx> { /// If `item` is a trait alias and its predicate has not yet been visited, then expands `item` /// to the definition, pushes the resulting expansion onto `self.stack`, and returns `false`. /// Otherwise, immediately returns `true` if `item` is a regular trait, or `false` if it is a @@ -393,7 +393,7 @@ impl<'cx, 'gcx, 'tcx> TraitAliasExpander<'cx, 'gcx, 'tcx> { } } -impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'cx, 'gcx, 'tcx> { +impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'gcx, 'tcx> { type Item = TraitAliasExpansionInfo<'tcx>; fn size_hint(&self) -> (usize, Option<usize>) { @@ -414,15 +414,15 @@ impl<'cx, 'gcx, 'tcx> Iterator for TraitAliasExpander<'cx, 'gcx, 'tcx> { // Iterator over def-IDs of supertraits /////////////////////////////////////////////////////////////////////////// -pub struct SupertraitDefIds<'a, 'gcx: 'a+'tcx, 'tcx: 'a> { - tcx: TyCtxt<'a, 'gcx, 'tcx>, +pub struct SupertraitDefIds<'gcx, 'tcx> { + tcx: TyCtxt<'tcx, 'gcx, 'tcx>, stack: Vec<DefId>, visited: FxHashSet<DefId>, } -pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, +pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'tcx, 'gcx, 'tcx>, trait_def_id: DefId) - -> SupertraitDefIds<'cx, 'gcx, 'tcx> + -> SupertraitDefIds<'gcx, 'tcx> { SupertraitDefIds { tcx, @@ -431,7 +431,7 @@ pub fn supertrait_def_ids<'cx, 'gcx, 'tcx>(tcx: TyCtxt<'cx, 'gcx, 'tcx>, } } -impl<'cx, 'gcx, 'tcx> Iterator for SupertraitDefIds<'cx, 'gcx, 'tcx> { +impl Iterator for SupertraitDefIds<'gcx, 'tcx> { type Item = DefId; fn next(&mut self) -> Option<DefId> { @@ -552,7 +552,7 @@ pub fn predicate_for_trait_ref<'tcx>( } } -impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { +impl<'a, 'gcx, 'tcx> TyCtxt<'tcx, 'gcx, 'tcx> { pub fn predicate_for_trait_def(self, param_env: ty::ParamEnv<'tcx>, cause: ObligationCause<'tcx>, |
