Fix perf issue for auto trait selection

This commit is contained in:
Guillaume Gomez 2022-03-26 14:58:19 +01:00
parent 3fe3b89cd5
commit ad88732254
3 changed files with 29 additions and 2 deletions

View file

@ -94,6 +94,24 @@ impl<'tcx> AutoTraitFinder<'tcx> {
trait_pred.to_poly_trait_predicate(),
));
match result {
Ok(Some(ImplSource::UserDefined(_))) => {
debug!(
"find_auto_trait_generics({:?}): \
manual impl found, bailing out",
trait_ref
);
return true;
}
_ => {}
}
let result = selcx.select(&Obligation::new(
ObligationCause::dummy(),
orig_env,
trait_pred.to_poly_trait_predicate_negative_polarity(),
));
match result {
Ok(Some(ImplSource::UserDefined(_))) => {
debug!(