1
Fork 0

Remove error message in specific case

In the case that a trait is not implemented for an ADT with type errors, cancel the error.
This commit is contained in:
kadmin 2020-08-26 00:30:02 +00:00
parent 85fbf49ce0
commit 8894b366fd
3 changed files with 20 additions and 0 deletions

View file

@ -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);