diff options
Diffstat (limited to 'compiler/rustc_infer/src/infer/outlives')
4 files changed, 24 insertions, 24 deletions
diff --git a/compiler/rustc_infer/src/infer/outlives/components.rs b/compiler/rustc_infer/src/infer/outlives/components.rs index cb63d2f18..2ac9568f6 100644 --- a/compiler/rustc_infer/src/infer/outlives/components.rs +++ b/compiler/rustc_infer/src/infer/outlives/components.rs @@ -3,8 +3,8 @@ // RFC for reference. use rustc_data_structures::sso::SsoHashSet; -use rustc_middle::ty::subst::{GenericArg, GenericArgKind}; use rustc_middle::ty::{self, Ty, TyCtxt, TypeVisitableExt}; +use rustc_middle::ty::{GenericArg, GenericArgKind}; use smallvec::{smallvec, SmallVec}; #[derive(Debug)] @@ -71,15 +71,15 @@ fn compute_components<'tcx>( // in the `subtys` iterator (e.g., when encountering a // projection). match *ty.kind() { - ty::FnDef(_, substs) => { - // HACK(eddyb) ignore lifetimes found shallowly in `substs`. - // This is inconsistent with `ty::Adt` (including all substs) - // and with `ty::Closure` (ignoring all substs other than + ty::FnDef(_, args) => { + // HACK(eddyb) ignore lifetimes found shallowly in `args`. + // This is inconsistent with `ty::Adt` (including all args) + // and with `ty::Closure` (ignoring all args other than // upvars, of which a `ty::FnDef` doesn't have any), but // consistent with previous (accidental) behavior. // See https://github.com/rust-lang/rust/issues/70917 // for further background and discussion. - for child in substs { + for child in args { match child.unpack() { GenericArgKind::Type(ty) => { compute_components(tcx, ty, out, visited); @@ -97,14 +97,14 @@ fn compute_components<'tcx>( compute_components(tcx, element, out, visited); } - ty::Closure(_, ref substs) => { - let tupled_ty = substs.as_closure().tupled_upvars_ty(); + ty::Closure(_, ref args) => { + let tupled_ty = args.as_closure().tupled_upvars_ty(); compute_components(tcx, tupled_ty, out, visited); } - ty::Generator(_, ref substs, _) => { + ty::Generator(_, ref args, _) => { // Same as the closure case - let tupled_ty = substs.as_generator().tupled_upvars_ty(); + let tupled_ty = args.as_generator().tupled_upvars_ty(); compute_components(tcx, tupled_ty, out, visited); // We ignore regions in the generator interior as we don't @@ -189,7 +189,7 @@ fn compute_components<'tcx>( } } -/// Collect [Component]s for *all* the substs of `parent`. +/// Collect [Component]s for *all* the args of `parent`. /// /// This should not be used to get the components of `parent` itself. /// Use [push_outlives_components] instead. @@ -201,7 +201,7 @@ pub(super) fn compute_alias_components_recursive<'tcx>( ) { let ty::Alias(kind, alias_ty) = alias_ty.kind() else { bug!() }; let opt_variances = if *kind == ty::Opaque { tcx.variances_of(alias_ty.def_id) } else { &[] }; - for (index, child) in alias_ty.substs.iter().enumerate() { + for (index, child) in alias_ty.args.iter().enumerate() { if opt_variances.get(index) == Some(&ty::Bivariant) { continue; } @@ -225,7 +225,7 @@ pub(super) fn compute_alias_components_recursive<'tcx>( } } -/// Collect [Component]s for *all* the substs of `parent`. +/// Collect [Component]s for *all* the args of `parent`. /// /// This should not be used to get the components of `parent` itself. /// Use [push_outlives_components] instead. diff --git a/compiler/rustc_infer/src/infer/outlives/obligations.rs b/compiler/rustc_infer/src/infer/outlives/obligations.rs index 73df6d03f..f36802e12 100644 --- a/compiler/rustc_infer/src/infer/outlives/obligations.rs +++ b/compiler/rustc_infer/src/infer/outlives/obligations.rs @@ -68,8 +68,8 @@ use crate::infer::{ use crate::traits::{ObligationCause, ObligationCauseCode}; use rustc_data_structures::undo_log::UndoLogs; use rustc_middle::mir::ConstraintCategory; -use rustc_middle::ty::subst::GenericArgKind; -use rustc_middle::ty::{self, Region, SubstsRef, Ty, TyCtxt, TypeVisitableExt}; +use rustc_middle::ty::GenericArgKind; +use rustc_middle::ty::{self, GenericArgsRef, Region, Ty, TyCtxt, TypeVisitableExt}; use smallvec::smallvec; use super::env::OutlivesEnvironment; @@ -253,7 +253,7 @@ where // this point it never will be self.tcx.sess.delay_span_bug( origin.span(), - format!("unresolved inference variable in outlives: {:?}", v), + format!("unresolved inference variable in outlives: {v:?}"), ); } } @@ -279,7 +279,7 @@ where alias_ty: ty::AliasTy<'tcx>, ) { // An optimization for a common case with opaque types. - if alias_ty.substs.is_empty() { + if alias_ty.args.is_empty() { return; } @@ -348,7 +348,7 @@ where { debug!("no declared bounds"); let opt_variances = is_opaque.then(|| self.tcx.variances_of(alias_ty.def_id)); - self.substs_must_outlive(alias_ty.substs, origin, region, opt_variances); + self.args_must_outlive(alias_ty.args, origin, region, opt_variances); return; } @@ -395,15 +395,15 @@ where } #[instrument(level = "debug", skip(self))] - fn substs_must_outlive( + fn args_must_outlive( &mut self, - substs: SubstsRef<'tcx>, + args: GenericArgsRef<'tcx>, origin: infer::SubregionOrigin<'tcx>, region: ty::Region<'tcx>, opt_variances: Option<&[ty::Variance]>, ) { let constraint = origin.to_constraint_category(); - for (index, k) in substs.iter().enumerate() { + for (index, k) in args.iter().enumerate() { match k.unpack() { GenericArgKind::Lifetime(lt) => { let variance = if let Some(variances) = opt_variances { diff --git a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs index cd2462d3c..fefa89595 100644 --- a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs +++ b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs @@ -157,7 +157,7 @@ impl<'tcx> TypeRelation<'tcx> for Match<'tcx> { a: T, b: T, ) -> RelateResult<'tcx, T> { - // Opaque types substs have lifetime parameters. + // Opaque types args have lifetime parameters. // We must not check them to be equal, as we never insert anything to make them so. if variance != ty::Bivariant { self.relate(a, b) } else { Ok(a) } } diff --git a/compiler/rustc_infer/src/infer/outlives/verify.rs b/compiler/rustc_infer/src/infer/outlives/verify.rs index 1a5e2b520..4279d0ab7 100644 --- a/compiler/rustc_infer/src/infer/outlives/verify.rs +++ b/compiler/rustc_infer/src/infer/outlives/verify.rs @@ -179,7 +179,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> { // this point it never will be self.tcx.sess.delay_span_bug( rustc_span::DUMMY_SP, - format!("unresolved inference variable in outlives: {:?}", v), + format!("unresolved inference variable in outlives: {v:?}"), ); // add a bound that never holds VerifyBound::AnyBound(vec![]) @@ -295,7 +295,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> { let bounds = tcx.item_bounds(alias_ty.def_id); trace!("{:#?}", bounds.skip_binder()); bounds - .subst_iter(tcx, alias_ty.substs) + .iter_instantiated(tcx, alias_ty.args) .filter_map(|p| p.as_type_outlives_clause()) .filter_map(|p| p.no_bound_vars()) .map(|OutlivesPredicate(_, r)| r) |