Skip to content

Commit

Permalink
Rollup merge of rust-lang#89233 - FabianWolff:issue-89159, r=estebank
Browse files Browse the repository at this point in the history
Hide `<...> defined here` note if the source is not available

Fixes rust-lang#89159. Similar to rust-lang#87088.

r? ``@estebank``
  • Loading branch information
GuillaumeGomez authored Sep 28, 2021
2 parents 91da29f + 911ced0 commit 3c60e04
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 3c60e04

Please sign in to comment.