diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2022-11-17 11:44:24 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2022-11-23 09:36:00 -0300 |
| commit | 5b3a06a3c2584d303cb40637a50a4bc3f0d8cedf (patch) | |
| tree | f3808fa6a54a5959ca0778fb52a2f14459a1e5e7 | |
| parent | ad094cdcebde8336d4f63d5323db5843e27def40 (diff) | |
| download | rust-5b3a06a3c2584d303cb40637a50a4bc3f0d8cedf.tar.gz rust-5b3a06a3c2584d303cb40637a50a4bc3f0d8cedf.zip | |
Call fully_solve_obligations instead of repeating code
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/mod.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 8a42bf4113a..548ca1c1d7f 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -402,9 +402,7 @@ pub fn fully_solve_obligation<'tcx>( infcx: &InferCtxt<'tcx>, obligation: PredicateObligation<'tcx>, ) -> Vec<FulfillmentError<'tcx>> { - let ocx = ObligationCtxt::new(infcx); - ocx.register_obligation(obligation); - ocx.select_all_or_error() + fully_solve_obligations(infcx, [obligation]) } /// Process a set of obligations (and any nested obligations that come from them) @@ -428,9 +426,16 @@ pub fn fully_solve_bound<'tcx>( ty: Ty<'tcx>, bound: DefId, ) -> Vec<FulfillmentError<'tcx>> { - let ocx = ObligationCtxt::new(infcx); - ocx.register_bound(cause, param_env, ty, bound); - ocx.select_all_or_error() + let tcx = infcx.tcx; + let trait_ref = ty::TraitRef { def_id: bound, substs: tcx.mk_substs_trait(ty, []) }; + let obligation = Obligation { + cause, + recursion_depth: 0, + param_env, + predicate: ty::Binder::dummy(trait_ref).without_const().to_predicate(tcx), + }; + + fully_solve_obligation(infcx, obligation) } /// Normalizes the predicates and checks whether they hold in an empty environment. If this |
