diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-15 10:05:25 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-16 14:23:47 -0400 |
| commit | 11ec3eca740d128eee15c40f930c4d13d72be7dd (patch) | |
| tree | 5a504a05011ac96618088805bc6ddf97abb6bc48 /compiler/rustc_trait_selection/src/solve | |
| parent | 97bf25c8cf6c7c97c851c6e8bc94fd0824885e6f (diff) | |
| download | rust-11ec3eca740d128eee15c40f930c4d13d72be7dd.tar.gz rust-11ec3eca740d128eee15c40f930c4d13d72be7dd.zip | |
Rename ToPredicate for Upcast
Diffstat (limited to 'compiler/rustc_trait_selection/src/solve')
4 files changed, 17 insertions, 19 deletions
diff --git a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs index 97bea28f06a..e09ddc7fb5e 100644 --- a/compiler/rustc_trait_selection/src/solve/assembly/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/assembly/mod.rs @@ -13,7 +13,7 @@ use rustc_middle::traits::BuiltinImplSource; use rustc_middle::ty::fast_reject::{SimplifiedType, TreatParams}; use rustc_middle::ty::{self, Ty, TyCtxt}; use rustc_middle::ty::{fast_reject, TypeFoldable}; -use rustc_middle::ty::{ToPredicate, TypeVisitableExt}; +use rustc_middle::ty::{TypeVisitableExt, Upcast}; use rustc_span::{ErrorGuaranteed, DUMMY_SP}; use std::fmt::Debug; @@ -744,7 +744,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { ecx, CandidateSource::BuiltinImpl(BuiltinImplSource::Object { vtable_base }), goal, - assumption.to_predicate(tcx), + assumption.upcast(tcx), )); }); } diff --git a/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs b/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs index 9e844d78702..cf826596392 100644 --- a/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs +++ b/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs @@ -7,9 +7,7 @@ use rustc_infer::traits::query::NoSolution; use rustc_macros::{TypeFoldable, TypeVisitable}; use rustc_middle::bug; use rustc_middle::traits::solve::Goal; -use rustc_middle::ty::{ - self, ToPredicate, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, -}; +use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable, Upcast}; use rustc_span::sym; use crate::solve::EvalCtxt; @@ -429,7 +427,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc tcx.require_lang_item(LangItem::AsyncFnKindHelper, None), [kind_ty, Ty::from_closure_kind(tcx, goal_kind)], ) - .to_predicate(tcx), + .upcast(tcx), ); coroutine_closure_to_ambiguous_coroutine( @@ -456,7 +454,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc let nested = vec![ bound_sig .rebind(ty::TraitRef::new(tcx, future_trait_def_id, [sig.output()])) - .to_predicate(tcx), + .upcast(tcx), ]; let future_output_def_id = tcx .associated_items(future_trait_def_id) @@ -484,7 +482,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc let mut nested = vec![ bound_sig .rebind(ty::TraitRef::new(tcx, future_trait_def_id, [sig.output()])) - .to_predicate(tcx), + .upcast(tcx), ]; // Additionally, we need to check that the closure kind @@ -510,7 +508,7 @@ pub(in crate::solve) fn extract_tupled_inputs_and_output_from_async_callable<'tc async_fn_kind_trait_def_id, [kind_ty, Ty::from_closure_kind(tcx, goal_kind)], ) - .to_predicate(tcx), + .upcast(tcx), ); } diff --git a/compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs b/compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs index 6ec0ad9d29a..7ab27374e7a 100644 --- a/compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs +++ b/compiler/rustc_trait_selection/src/solve/normalizes_to/mod.rs @@ -16,7 +16,7 @@ use rustc_middle::traits::BuiltinImplSource; use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams}; use rustc_middle::ty::NormalizesTo; use rustc_middle::ty::{self, Ty, TyCtxt}; -use rustc_middle::ty::{ToPredicate, TypeVisitableExt}; +use rustc_middle::ty::{TypeVisitableExt, Upcast}; use rustc_middle::{bug, span_bug}; use rustc_span::{sym, ErrorGuaranteed, DUMMY_SP}; @@ -370,7 +370,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> { ), term: output.into(), }) - .to_predicate(tcx); + .upcast(tcx); // A built-in `Fn` impl only holds if the output is sized. // (FIXME: technically we only need to check this if the type is a fn ptr...) @@ -452,7 +452,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> { ty::ProjectionPredicate { projection_term, term } }, ) - .to_predicate(tcx); + .upcast(tcx); // A built-in `AsyncFn` impl only holds if the output is sized. // (FIXME: technically we only need to check this if the type is a fn ptr...) @@ -629,7 +629,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> { projection_term: ty::AliasTerm::new(ecx.tcx(), goal.predicate.def_id(), [self_ty]), term, } - .to_predicate(tcx), + .upcast(tcx), // Technically, we need to check that the future type is Sized, // but that's already proven by the coroutine being WF. [], @@ -661,7 +661,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> { projection_term: ty::AliasTerm::new(ecx.tcx(), goal.predicate.def_id(), [self_ty]), term, } - .to_predicate(tcx), + .upcast(tcx), // Technically, we need to check that the iterator type is Sized, // but that's already proven by the generator being WF. [], @@ -749,7 +749,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for NormalizesTo<'tcx> { ), term, } - .to_predicate(tcx), + .upcast(tcx), // Technically, we need to check that the coroutine type is Sized, // but that's already proven by the coroutine being WF. [], diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index 1cafa970b68..b46edb32f72 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -15,7 +15,7 @@ use rustc_middle::traits::solve::inspect::ProbeKind; use rustc_middle::traits::solve::{CandidateSource, Certainty, Goal, QueryResult}; use rustc_middle::traits::{BuiltinImplSource, Reveal}; use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams}; -use rustc_middle::ty::{self, ToPredicate, Ty, TyCtxt}; +use rustc_middle::ty::{self, Ty, TyCtxt, Upcast}; use rustc_middle::ty::{TraitPredicate, TypeVisitableExt}; use rustc_span::ErrorGuaranteed; @@ -315,7 +315,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { .map_bound(|(inputs, _)| { ty::TraitRef::new(tcx, goal.predicate.def_id(), [goal.predicate.self_ty(), inputs]) }) - .to_predicate(tcx); + .upcast(tcx); // A built-in `Fn` impl only holds if the output is sized. // (FIXME: technically we only need to check this if the type is a fn ptr...) Self::probe_and_consider_implied_clause( @@ -363,7 +363,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { [goal.predicate.self_ty(), tupled_inputs_ty], ) }) - .to_predicate(tcx); + .upcast(tcx); // A built-in `AsyncFn` impl only holds if the output is sized. // (FIXME: technically we only need to check this if the type is a fn ptr...) Self::probe_and_consider_implied_clause( @@ -560,7 +560,7 @@ impl<'tcx> assembly::GoalKind<'tcx> for TraitPredicate<'tcx> { CandidateSource::BuiltinImpl(BuiltinImplSource::Misc), goal, ty::TraitRef::new(tcx, goal.predicate.def_id(), [self_ty, coroutine.resume_ty()]) - .to_predicate(tcx), + .upcast(tcx), // Technically, we need to check that the coroutine types are Sized, // but that's already proven by the coroutine being WF. [], |
