about summary refs log tree commit diff
path: root/compiler/rustc_trait_selection/src
diff options
context:
space:
mode:
authorkadmin <julianknodt@gmail.com>2020-08-26 00:30:02 +0000
committerkadmin <julianknodt@gmail.com>2020-08-30 19:39:51 +0000
commit8894b366fdb976a703fe76010f6e56c591cada1f (patch)
tree3a4df5c9914a364aa388b9f4ccf16e65726acf4b /compiler/rustc_trait_selection/src
parent85fbf49ce0e2274d0acf798f6e703747674feec3 (diff)
downloadrust-8894b366fdb976a703fe76010f6e56c591cada1f.tar.gz
rust-8894b366fdb976a703fe76010f6e56c591cada1f.zip
Remove error message in specific case
In the case that a trait is not implemented for an ADT with type errors, cancel the error.
Diffstat (limited to 'compiler/rustc_trait_selection/src')
-rw-r--r--compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
index 138293c9533..f86fc425bd3 100644
--- a/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
+++ b/compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
@@ -1906,6 +1906,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
             ObligationCauseCode::BuiltinDerivedObligation(ref data) => {
                 let parent_trait_ref = self.resolve_vars_if_possible(&data.parent_trait_ref);
                 let ty = parent_trait_ref.skip_binder().self_ty();
+                if parent_trait_ref.references_error() {
+                    err.cancel();
+                    return;
+                }
+
                 err.note(&format!("required because it appears within the type `{}`", ty));
                 obligated_types.push(ty);