Rollup merge of #106309 - compiler-errors:prefer-non-err-candidates, r=oli-obk
Prefer non-`[type error]` candidates during selection Fixes #102130 Fixes #106351 r? types note: Alternatively we could filter out error where-clauses during param-env construction? But we still need to filter out impls with errors during `match_impl`, I think.
This commit is contained in:
commit
9b538e8e62
12 changed files with 58 additions and 66 deletions
|
@ -174,7 +174,8 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
.param_env
|
||||
.caller_bounds()
|
||||
.iter()
|
||||
.filter_map(|o| o.to_opt_poly_trait_pred());
|
||||
.filter_map(|p| p.to_opt_poly_trait_pred())
|
||||
.filter(|p| !p.references_error());
|
||||
|
||||
// Micro-optimization: filter out predicates relating to different traits.
|
||||
let matching_bounds =
|
||||
|
|
|
@ -2377,6 +2377,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
let impl_substs = self.infcx.fresh_substs_for_item(obligation.cause.span, impl_def_id);
|
||||
|
||||
let impl_trait_ref = impl_trait_ref.subst(self.tcx(), impl_substs);
|
||||
if impl_trait_ref.references_error() {
|
||||
return Err(());
|
||||
}
|
||||
|
||||
debug!(?impl_trait_ref);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue