Hide <...> defined here note if the source is not available

This commit is contained in:
Fabian Wolff 2021-09-24 22:42:05 +02:00
parent a0648eab36
commit 911ced003a

View file

@ -731,7 +731,11 @@ impl<'a, 'tcx> WrongNumberOfGenericArgs<'a, 'tcx> {
/// Builds the `type defined here` message.
fn show_definition(&self, err: &mut DiagnosticBuilder<'_>) {
let mut spans: MultiSpan = if let Some(def_span) = self.tcx.def_ident_span(self.def_id) {
def_span.into()
if self.tcx.sess.source_map().span_to_snippet(def_span).is_ok() {
def_span.into()
} else {
return;
}
} else {
return;
};