Filter impl and where-clause candidates that reference errors
This commit is contained in:
parent
4e30ad8d60
commit
83fbc71d02
10 changed files with 54 additions and 64 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