diff options
| author | Michael Goulet <michael@errs.io> | 2023-01-01 23:48:10 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-01-11 20:03:29 +0000 |
| commit | 83fbc71d021d2aa741ad18890e7a51a28830d45e (patch) | |
| tree | a9f6607dd964c3fe568258f7c733a46af65a2c45 /compiler/rustc_trait_selection/src | |
| parent | 4e30ad8d60e920f486fd1462939dbdaf3bd4c544 (diff) | |
| download | rust-83fbc71d021d2aa741ad18890e7a51a28830d45e.tar.gz rust-83fbc71d021d2aa741ad18890e7a51a28830d45e.zip | |
Filter impl and where-clause candidates that reference errors
Diffstat (limited to 'compiler/rustc_trait_selection/src')
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/select/mod.rs | 3 |
2 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index c54d901e9b1..170c1673dbd 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -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 = diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 3f14491f803..2615e262282 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -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); |
