1
Fork 0

Add traits::fully_solve_obligation that acts like traits::fully_normalize

It spawns up a trait engine, registers the single obligation, then fully
solves it
This commit is contained in:
Michael Goulet 2022-08-02 06:02:04 +00:00
parent 3e48434cc7
commit fe894756f8
10 changed files with 78 additions and 97 deletions

View file

@ -5,12 +5,11 @@
use rustc_errors::ErrorGuaranteed;
use rustc_hir::LangItem;
use rustc_infer::infer::TyCtxtInferExt;
use rustc_infer::traits::TraitEngine;
use rustc_middle::mir::*;
use rustc_middle::ty::{self, subst::SubstsRef, AdtDef, Ty};
use rustc_span::DUMMY_SP;
use rustc_trait_selection::traits::{
self, ImplSource, Obligation, ObligationCause, SelectionContext, TraitEngineExt,
self, ImplSource, Obligation, ObligationCause, SelectionContext,
};
use super::ConstCx;
@ -189,15 +188,8 @@ impl Qualif for NeedsNonConstDrop {
return false;
}
// If we successfully found one, then select all of the predicates
// implied by our const drop impl.
let mut fcx = <dyn TraitEngine<'tcx>>::new(cx.tcx);
for nested in impl_src.nested_obligations() {
fcx.register_predicate_obligation(&infcx, nested);
}
// If we had any errors, then it's bad
!fcx.select_all_or_error(&infcx).is_empty()
!traits::fully_solve_obligations(&infcx, impl_src.nested_obligations()).is_empty()
})
}