From 375524014f1c0939f4e5a17c841eb49e79982255 Mon Sep 17 00:00:00 2001 From: LegionMammal978 Date: Mon, 13 Dec 2021 16:50:58 -0500 Subject: [PATCH] Remove `in_band_lifetimes` from `rustc_infer` This crate actually had a typo `'ctx` in one of its functions: ```diff -pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool { +pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { ``` --- .../src/infer/canonical/canonicalizer.rs | 10 +++++----- compiler/rustc_infer/src/infer/combine.rs | 4 ++-- compiler/rustc_infer/src/infer/equate.rs | 2 +- .../rustc_infer/src/infer/error_reporting/mod.rs | 12 ++++++------ .../nice_region_error/find_anon_type.rs | 8 ++++---- .../nice_region_error/placeholder_error.rs | 2 +- .../nice_region_error/static_impl_trait.rs | 2 +- .../nice_region_error/trait_impl_difference.rs | 4 ++-- compiler/rustc_infer/src/infer/glb.rs | 2 +- compiler/rustc_infer/src/infer/lub.rs | 2 +- compiler/rustc_infer/src/infer/mod.rs | 4 ++-- compiler/rustc_infer/src/infer/nll_relate/mod.rs | 14 +++++++------- .../rustc_infer/src/infer/outlives/components.rs | 6 +++--- .../src/infer/region_constraints/mod.rs | 4 ++-- compiler/rustc_infer/src/infer/sub.rs | 2 +- compiler/rustc_infer/src/lib.rs | 1 - compiler/rustc_infer/src/traits/engine.rs | 2 +- .../rustc_infer/src/traits/error_reporting/mod.rs | 2 +- compiler/rustc_infer/src/traits/mod.rs | 4 ++-- compiler/rustc_infer/src/traits/project.rs | 2 +- compiler/rustc_infer/src/traits/util.rs | 8 ++++---- 21 files changed, 48 insertions(+), 49 deletions(-) diff --git a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs index 934ada9932e71..6023973665360 100644 --- a/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs +++ b/compiler/rustc_infer/src/infer/canonical/canonicalizer.rs @@ -134,7 +134,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> { /// response*, then we don't typically replace free regions, as they /// must have been introduced from other parts of the system. trait CanonicalizeRegionMode { - fn canonicalize_free_region( + fn canonicalize_free_region<'tcx>( &self, canonicalizer: &mut Canonicalizer<'_, 'tcx>, r: ty::Region<'tcx>, @@ -146,7 +146,7 @@ trait CanonicalizeRegionMode { struct CanonicalizeQueryResponse; impl CanonicalizeRegionMode for CanonicalizeQueryResponse { - fn canonicalize_free_region( + fn canonicalize_free_region<'tcx>( &self, canonicalizer: &mut Canonicalizer<'_, 'tcx>, r: ty::Region<'tcx>, @@ -203,7 +203,7 @@ impl CanonicalizeRegionMode for CanonicalizeQueryResponse { struct CanonicalizeUserTypeAnnotation; impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation { - fn canonicalize_free_region( + fn canonicalize_free_region<'tcx>( &self, canonicalizer: &mut Canonicalizer<'_, 'tcx>, r: ty::Region<'tcx>, @@ -226,7 +226,7 @@ impl CanonicalizeRegionMode for CanonicalizeUserTypeAnnotation { struct CanonicalizeAllFreeRegions; impl CanonicalizeRegionMode for CanonicalizeAllFreeRegions { - fn canonicalize_free_region( + fn canonicalize_free_region<'tcx>( &self, canonicalizer: &mut Canonicalizer<'_, 'tcx>, r: ty::Region<'tcx>, @@ -242,7 +242,7 @@ impl CanonicalizeRegionMode for CanonicalizeAllFreeRegions { struct CanonicalizeFreeRegionsOtherThanStatic; impl CanonicalizeRegionMode for CanonicalizeFreeRegionsOtherThanStatic { - fn canonicalize_free_region( + fn canonicalize_free_region<'tcx>( &self, canonicalizer: &mut Canonicalizer<'_, 'tcx>, r: ty::Region<'tcx>, diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index 09bfb3290f4ca..7a82d5f3f2658 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -533,7 +533,7 @@ struct Generalization<'tcx> { needs_wf: bool, } -impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> { +impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx> { self.infcx.tcx } @@ -827,7 +827,7 @@ struct ConstInferUnifier<'cx, 'tcx> { // We use `TypeRelation` here to propagate `RelateResult` upwards. // // Both inputs are expected to be the same. -impl TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> { +impl<'tcx> TypeRelation<'tcx> for ConstInferUnifier<'_, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx> { self.infcx.tcx } diff --git a/compiler/rustc_infer/src/infer/equate.rs b/compiler/rustc_infer/src/infer/equate.rs index cbc735c98a65f..90c0ff9226f77 100644 --- a/compiler/rustc_infer/src/infer/equate.rs +++ b/compiler/rustc_infer/src/infer/equate.rs @@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Equate<'combine, 'infcx, 'tcx> { } } -impl TypeRelation<'tcx> for Equate<'combine, 'infcx, 'tcx> { +impl<'tcx> TypeRelation<'tcx> for Equate<'_, '_, 'tcx> { fn tag(&self) -> &'static str { "Equate" } diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 1e3f9f7464deb..b92f7e96da62c 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -83,7 +83,7 @@ pub use need_type_info::TypeAnnotationNeeded; pub mod nice_region_error; -pub(super) fn note_and_explain_region( +pub(super) fn note_and_explain_region<'tcx>( tcx: TyCtxt<'tcx>, err: &mut DiagnosticBuilder<'_>, prefix: &str, @@ -116,7 +116,7 @@ pub(super) fn note_and_explain_region( emit_msg_span(err, prefix, description, span, suffix); } -fn explain_free_region( +fn explain_free_region<'tcx>( tcx: TyCtxt<'tcx>, err: &mut DiagnosticBuilder<'_>, prefix: &str, @@ -128,7 +128,7 @@ fn explain_free_region( label_msg_span(err, prefix, description, span, suffix); } -fn msg_span_from_free_region( +fn msg_span_from_free_region<'tcx>( tcx: TyCtxt<'tcx>, region: ty::Region<'tcx>, alt_span: Option, @@ -145,7 +145,7 @@ fn msg_span_from_free_region( } } -fn msg_span_from_early_bound_and_free_regions( +fn msg_span_from_early_bound_and_free_regions<'tcx>( tcx: TyCtxt<'tcx>, region: ty::Region<'tcx>, ) -> (String, Span) { @@ -226,7 +226,7 @@ fn label_msg_span( } } -pub fn unexpected_hidden_region_diagnostic( +pub fn unexpected_hidden_region_diagnostic<'tcx>( tcx: TyCtxt<'tcx>, span: Span, hidden_ty: Ty<'tcx>, @@ -316,7 +316,7 @@ pub fn unexpected_hidden_region_diagnostic( /// with the other type. A TyVar inference type is compatible with any type, and an IntVar or /// FloatVar inference type are compatible with themselves or their concrete types (Int and /// Float types, respectively). When comparing two ADTs, these rules apply recursively. -pub fn same_type_modulo_infer(a: Ty<'tcx>, b: Ty<'ctx>) -> bool { +pub fn same_type_modulo_infer<'tcx>(a: Ty<'tcx>, b: Ty<'tcx>) -> bool { match (&a.kind(), &b.kind()) { (&ty::Adt(did_a, substs_a), &ty::Adt(did_b, substs_b)) => { if did_a != did_b { diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs index 58eb1e9aa12cb..89023101f3cd2 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -20,7 +20,7 @@ use rustc_middle::ty::{self, Region, TyCtxt}; /// ``` /// The function returns the nested type corresponding to the anonymous region /// for e.g., `&u8` and `Vec<&u8>`. -pub(crate) fn find_anon_type( +pub(crate) fn find_anon_type<'tcx>( tcx: TyCtxt<'tcx>, region: Region<'tcx>, br: &ty::BoundRegionKind, @@ -50,7 +50,7 @@ pub(crate) fn find_anon_type( // This method creates a FindNestedTypeVisitor which returns the type corresponding // to the anonymous region. -fn find_component_for_bound_region( +fn find_component_for_bound_region<'tcx>( tcx: TyCtxt<'tcx>, arg: &'tcx hir::Ty<'tcx>, br: &ty::BoundRegionKind, @@ -83,7 +83,7 @@ struct FindNestedTypeVisitor<'tcx> { current_index: ty::DebruijnIndex, } -impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for FindNestedTypeVisitor<'tcx> { type Map = Map<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap { @@ -207,7 +207,7 @@ struct TyPathVisitor<'tcx> { current_index: ty::DebruijnIndex, } -impl Visitor<'tcx> for TyPathVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for TyPathVisitor<'tcx> { type Map = Map<'tcx>; fn nested_visit_map(&mut self) -> NestedVisitorMap> { diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs index 1a4a280382189..24652a3a6bc10 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/placeholder_error.rs @@ -13,7 +13,7 @@ use rustc_middle::ty::{self, TyCtxt}; use std::fmt::{self, Write}; -impl NiceRegionError<'me, 'tcx> { +impl<'tcx> NiceRegionError<'_, 'tcx> { /// When given a `ConcreteFailure` for a function with arguments containing a named region and /// an anonymous region, emit a descriptive diagnostic error. pub(super) fn try_report_placeholder_conflict(&self) -> Option> { diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs index 80d4a2e57da4a..51f33a206f48e 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -287,7 +287,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } pub fn suggest_new_region_bound( - tcx: TyCtxt<'tcx>, + tcx: TyCtxt<'_>, err: &mut DiagnosticBuilder<'_>, fn_returns: Vec<&rustc_hir::Ty<'_>>, lifetime_name: String, diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs index 452ca5eeabd49..c12367409a2d1 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/trait_impl_difference.rs @@ -86,7 +86,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { counter: usize, } - impl HighlightBuilder<'tcx> { + impl<'tcx> HighlightBuilder<'tcx> { fn build(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> RegionHighlightMode { let mut builder = HighlightBuilder { highlight: RegionHighlightMode::default(), counter: 1, tcx }; @@ -186,7 +186,7 @@ struct TypeParamSpanVisitor<'tcx> { types: Vec, } -impl Visitor<'tcx> for TypeParamSpanVisitor<'tcx> { +impl<'tcx> Visitor<'tcx> for TypeParamSpanVisitor<'tcx> { type Map = rustc_middle::hir::map::Map<'tcx>; fn nested_visit_map(&mut self) -> hir::intravisit::NestedVisitorMap { diff --git a/compiler/rustc_infer/src/infer/glb.rs b/compiler/rustc_infer/src/infer/glb.rs index d769667c2fb09..862f5a5fbb8c1 100644 --- a/compiler/rustc_infer/src/infer/glb.rs +++ b/compiler/rustc_infer/src/infer/glb.rs @@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Glb<'combine, 'infcx, 'tcx> { } } -impl TypeRelation<'tcx> for Glb<'combine, 'infcx, 'tcx> { +impl<'tcx> TypeRelation<'tcx> for Glb<'_, '_, 'tcx> { fn tag(&self) -> &'static str { "Glb" } diff --git a/compiler/rustc_infer/src/infer/lub.rs b/compiler/rustc_infer/src/infer/lub.rs index cbad66397fd0d..5191d1c1cc100 100644 --- a/compiler/rustc_infer/src/infer/lub.rs +++ b/compiler/rustc_infer/src/infer/lub.rs @@ -23,7 +23,7 @@ impl<'combine, 'infcx, 'tcx> Lub<'combine, 'infcx, 'tcx> { } } -impl TypeRelation<'tcx> for Lub<'combine, 'infcx, 'tcx> { +impl<'tcx> TypeRelation<'tcx> for Lub<'_, '_, 'tcx> { fn tag(&self) -> &'static str { "Lub" } diff --git a/compiler/rustc_infer/src/infer/mod.rs b/compiler/rustc_infer/src/infer/mod.rs index 48dfa0b6342d9..9db815548d8cc 100644 --- a/compiler/rustc_infer/src/infer/mod.rs +++ b/compiler/rustc_infer/src/infer/mod.rs @@ -554,7 +554,7 @@ pub trait TyCtxtInferExt<'tcx> { fn infer_ctxt(self) -> InferCtxtBuilder<'tcx>; } -impl TyCtxtInferExt<'tcx> for TyCtxt<'tcx> { +impl<'tcx> TyCtxtInferExt<'tcx> for TyCtxt<'tcx> { fn infer_ctxt(self) -> InferCtxtBuilder<'tcx> { InferCtxtBuilder { tcx: self, @@ -1718,7 +1718,7 @@ pub enum TyOrConstInferVar<'tcx> { Const(ConstVid<'tcx>), } -impl TyOrConstInferVar<'tcx> { +impl<'tcx> TyOrConstInferVar<'tcx> { /// Tries to extract an inference variable from a type or a constant, returns `None` /// for types other than `ty::Infer(_)` (or `InferTy::Fresh*`) and /// for constants other than `ty::ConstKind::Infer(_)` (or `InferConst::Fresh`). diff --git a/compiler/rustc_infer/src/infer/nll_relate/mod.rs b/compiler/rustc_infer/src/infer/nll_relate/mod.rs index 29a9cbc7a99c3..ebc0e80cdf267 100644 --- a/compiler/rustc_infer/src/infer/nll_relate/mod.rs +++ b/compiler/rustc_infer/src/infer/nll_relate/mod.rs @@ -407,7 +407,7 @@ trait VidValuePair<'tcx>: Debug { /// Extract the scopes that apply to whichever side of the tuple /// the vid was found on. See the comment where this is called /// for more details on why we want them. - fn vid_scopes>( + fn vid_scopes<'r, D: TypeRelatingDelegate<'tcx>>( &self, relate: &'r mut TypeRelating<'_, 'tcx, D>, ) -> &'r mut Vec>; @@ -424,7 +424,7 @@ trait VidValuePair<'tcx>: Debug { D: TypeRelatingDelegate<'tcx>; } -impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) { +impl<'tcx> VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) { fn vid(&self) -> ty::TyVid { self.0 } @@ -433,7 +433,7 @@ impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) { self.1 } - fn vid_scopes( + fn vid_scopes<'r, D>( &self, relate: &'r mut TypeRelating<'_, 'tcx, D>, ) -> &'r mut Vec> @@ -456,7 +456,7 @@ impl VidValuePair<'tcx> for (ty::TyVid, Ty<'tcx>) { } // In this case, the "vid" is the "b" type. -impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) { +impl<'tcx> VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) { fn vid(&self) -> ty::TyVid { self.1 } @@ -465,7 +465,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) { self.0 } - fn vid_scopes( + fn vid_scopes<'r, D>( &self, relate: &'r mut TypeRelating<'_, 'tcx, D>, ) -> &'r mut Vec> @@ -487,7 +487,7 @@ impl VidValuePair<'tcx> for (Ty<'tcx>, ty::TyVid) { } } -impl TypeRelation<'tcx> for TypeRelating<'me, 'tcx, D> +impl<'tcx, D> TypeRelation<'tcx> for TypeRelating<'_, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { @@ -841,7 +841,7 @@ where universe: ty::UniverseIndex, } -impl TypeRelation<'tcx> for TypeGeneralizer<'me, 'tcx, D> +impl<'tcx, D> TypeRelation<'tcx> for TypeGeneralizer<'_, 'tcx, D> where D: TypeRelatingDelegate<'tcx>, { diff --git a/compiler/rustc_infer/src/infer/outlives/components.rs b/compiler/rustc_infer/src/infer/outlives/components.rs index 98f926e9d76d5..22e18deac25e4 100644 --- a/compiler/rustc_infer/src/infer/outlives/components.rs +++ b/compiler/rustc_infer/src/infer/outlives/components.rs @@ -49,7 +49,7 @@ pub enum Component<'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( +pub fn push_outlives_components<'tcx>( tcx: TyCtxt<'tcx>, ty0: Ty<'tcx>, out: &mut SmallVec<[Component<'tcx>; 4]>, @@ -59,7 +59,7 @@ pub fn push_outlives_components( debug!("components({:?}) = {:?}", ty0, out); } -fn compute_components( +fn compute_components<'tcx>( tcx: TyCtxt<'tcx>, ty: Ty<'tcx>, out: &mut SmallVec<[Component<'tcx>; 4]>, @@ -190,7 +190,7 @@ fn compute_components( } } -fn compute_components_recursive( +fn compute_components_recursive<'tcx>( tcx: TyCtxt<'tcx>, parent: GenericArg<'tcx>, out: &mut SmallVec<[Component<'tcx>; 4]>, diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index df4fdb3a982ec..29775a9668531 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -65,7 +65,7 @@ pub struct RegionConstraintCollector<'a, 'tcx> { undo_log: &'a mut InferCtxtUndoLogs<'tcx>, } -impl std::ops::Deref for RegionConstraintCollector<'_, 'tcx> { +impl<'tcx> std::ops::Deref for RegionConstraintCollector<'_, 'tcx> { type Target = RegionConstraintStorage<'tcx>; #[inline] fn deref(&self) -> &RegionConstraintStorage<'tcx> { @@ -73,7 +73,7 @@ impl std::ops::Deref for RegionConstraintCollector<'_, 'tcx> { } } -impl std::ops::DerefMut for RegionConstraintCollector<'_, 'tcx> { +impl<'tcx> std::ops::DerefMut for RegionConstraintCollector<'_, 'tcx> { #[inline] fn deref_mut(&mut self) -> &mut RegionConstraintStorage<'tcx> { self.storage diff --git a/compiler/rustc_infer/src/infer/sub.rs b/compiler/rustc_infer/src/infer/sub.rs index 8ef0d132cf09f..ccac0efd6c9ee 100644 --- a/compiler/rustc_infer/src/infer/sub.rs +++ b/compiler/rustc_infer/src/infer/sub.rs @@ -31,7 +31,7 @@ impl<'combine, 'infcx, 'tcx> Sub<'combine, 'infcx, 'tcx> { } } -impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> { +impl<'tcx> TypeRelation<'tcx> for Sub<'_, '_, 'tcx> { fn tag(&self) -> &'static str { "Sub" } diff --git a/compiler/rustc_infer/src/lib.rs b/compiler/rustc_infer/src/lib.rs index e4b407e7c112d..eec062ca04194 100644 --- a/compiler/rustc_infer/src/lib.rs +++ b/compiler/rustc_infer/src/lib.rs @@ -20,7 +20,6 @@ #![feature(iter_zip)] #![feature(let_else)] #![feature(never_type)] -#![feature(in_band_lifetimes)] #![feature(control_flow_enum)] #![feature(min_specialization)] #![feature(label_break_value)] diff --git a/compiler/rustc_infer/src/traits/engine.rs b/compiler/rustc_infer/src/traits/engine.rs index 822f2365e023f..736278ba0d346 100644 --- a/compiler/rustc_infer/src/traits/engine.rs +++ b/compiler/rustc_infer/src/traits/engine.rs @@ -63,7 +63,7 @@ pub trait TraitEngineExt<'tcx> { ); } -impl> TraitEngineExt<'tcx> for T { +impl<'tcx, T: ?Sized + TraitEngine<'tcx>> TraitEngineExt<'tcx> for T { fn register_predicate_obligations( &mut self, infcx: &InferCtxt<'_, 'tcx>, diff --git a/compiler/rustc_infer/src/traits/error_reporting/mod.rs b/compiler/rustc_infer/src/traits/error_reporting/mod.rs index c1f302e665d4b..1a5ffd93701c6 100644 --- a/compiler/rustc_infer/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/traits/error_reporting/mod.rs @@ -35,7 +35,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { } } -pub fn report_object_safety_error( +pub fn report_object_safety_error<'tcx>( tcx: TyCtxt<'tcx>, span: Span, trait_def_id: DefId, diff --git a/compiler/rustc_infer/src/traits/mod.rs b/compiler/rustc_infer/src/traits/mod.rs index 7e30f859dae4e..b4fb10370d41e 100644 --- a/compiler/rustc_infer/src/traits/mod.rs +++ b/compiler/rustc_infer/src/traits/mod.rs @@ -55,7 +55,7 @@ pub struct Obligation<'tcx, T> { pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>; pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>; -impl PredicateObligation<'tcx> { +impl<'tcx> PredicateObligation<'tcx> { /// Flips the polarity of the inner predicate. /// /// Given `T: Trait` predicate it returns `T: !Trait` and given `T: !Trait` returns `T: Trait`. @@ -69,7 +69,7 @@ impl PredicateObligation<'tcx> { } } -impl TraitObligation<'tcx> { +impl TraitObligation<'_> { /// Returns `true` if the trait predicate is considered `const` in its ParamEnv. pub fn is_const(&self) -> bool { match (self.predicate.skip_binder().constness, self.param_env.constness()) { diff --git a/compiler/rustc_infer/src/traits/project.rs b/compiler/rustc_infer/src/traits/project.rs index e2c13d20a9a5b..d58368a238ab6 100644 --- a/compiler/rustc_infer/src/traits/project.rs +++ b/compiler/rustc_infer/src/traits/project.rs @@ -80,7 +80,7 @@ pub struct ProjectionCacheKey<'tcx> { ty: ty::ProjectionTy<'tcx>, } -impl ProjectionCacheKey<'tcx> { +impl<'tcx> ProjectionCacheKey<'tcx> { pub fn new(ty: ty::ProjectionTy<'tcx>) -> Self { Self { ty } } diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index 61588147364a9..8f5d6c85097cb 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -20,7 +20,7 @@ pub struct PredicateSet<'tcx> { set: FxHashSet>, } -impl PredicateSet<'tcx> { +impl<'tcx> PredicateSet<'tcx> { pub fn new(tcx: TyCtxt<'tcx>) -> Self { Self { tcx, set: Default::default() } } @@ -40,7 +40,7 @@ impl PredicateSet<'tcx> { } } -impl Extend> for PredicateSet<'tcx> { +impl<'tcx> Extend> for PredicateSet<'tcx> { fn extend>>(&mut self, iter: I) { for pred in iter { self.insert(pred); @@ -131,7 +131,7 @@ fn predicate_obligation<'tcx>( Obligation { cause, param_env, recursion_depth: 0, predicate } } -impl Elaborator<'tcx> { +impl<'tcx> Elaborator<'tcx> { pub fn filter_to_traits(self) -> FilterToTraits { FilterToTraits::new(self) } @@ -267,7 +267,7 @@ impl Elaborator<'tcx> { } } -impl Iterator for Elaborator<'tcx> { +impl<'tcx> Iterator for Elaborator<'tcx> { type Item = PredicateObligation<'tcx>; fn size_hint(&self) -> (usize, Option) {