diff options
| author | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-09-24 22:42:05 +0200 |
|---|---|---|
| committer | Fabian Wolff <fabian.wolff@alumni.ethz.ch> | 2021-09-24 22:42:05 +0200 |
| commit | 911ced003a3600a2a9159921f2a11591485c47da (patch) | |
| tree | 4950063699d940f4bcd8e9ad42ca6339b41e514e | |
| parent | a0648eab3686f100c7ab9b0d38472c740079cce4 (diff) | |
| download | rust-911ced003a3600a2a9159921f2a11591485c47da.tar.gz rust-911ced003a3600a2a9159921f2a11591485c47da.zip | |
Hide `<...> defined here` note if the source is not available
| -rw-r--r-- | compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs b/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs index 2e3db4d6d65..c2038f4e047 100644 --- a/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs +++ b/compiler/rustc_typeck/src/structured_errors/wrong_number_of_generic_args.rs @@ -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; }; |
