1
Fork 0

Rollup merge of #89233 - FabianWolff:issue-89159, r=estebank

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

Fixes #89159. Similar to #87088.

r? ``@estebank``
This commit is contained in:
Guillaume Gomez 2021-09-28 20:00:14 +02:00 committed by GitHub
commit 3c60e040b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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;
};