1
Fork 0

Simplify error reporting.

This commit is contained in:
Camille GILLOT 2022-01-08 14:49:38 +01:00
parent 8b2409cd7d
commit 554aceba49
3 changed files with 42 additions and 38 deletions

View file

@ -602,6 +602,25 @@ impl<'a> Resolver<'a> {
err
}
ResolutionError::TraitImplMismatch {
name,
kind,
code,
trait_item_span,
trait_path,
} => {
let mut err = self.session.struct_span_err_with_code(
span,
&format!(
"item `{}` is an associated {}, which doesn't match its trait `{}`",
name, kind, trait_path,
),
code,
);
err.span_label(span, "does not match trait");
err.span_label(trait_item_span, "item in trait");
err
}
}
}