about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorTyler Mandry <tmandry@gmail.com>2019-10-14 17:52:41 -0700
committerGitHub <noreply@github.com>2019-10-14 17:52:41 -0700
commita14e35f382825549a506eb5c187fa5d58622bb1c (patch)
treebd7340907eaa546979c95a0025631519e8cb36a7 /src/libsyntax
parent8d1123d80880c213b27720d2e7d92a093e0e6fe9 (diff)
parent8bf6d353772aacc15c78919e3d2f2db0528484b1 (diff)
downloadrust-a14e35f382825549a506eb5c187fa5d58622bb1c.tar.gz
rust-a14e35f382825549a506eb5c187fa5d58622bb1c.zip
Rollup merge of #65398 - estebank:capitalization-only, r=varkor
Bring attention to suggestions when the only difference is capitalization

CC #65386.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/json.rs6
-rw-r--r--src/libsyntax/source_map.rs3
2 files changed, 8 insertions, 1 deletions
diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs
index 2423e1070fc..4cf987417b8 100644
--- a/src/libsyntax/json.rs
+++ b/src/libsyntax/json.rs
@@ -12,7 +12,7 @@
 use crate::source_map::{SourceMap, FilePathMapping};
 
 use errors::registry::Registry;
-use errors::{SubDiagnostic, CodeSuggestion, SourceMapper};
+use errors::{SubDiagnostic, CodeSuggestion, SourceMapper, SourceMapperDyn};
 use errors::{DiagnosticId, Applicability};
 use errors::emitter::{Emitter, HumanReadableErrorType};
 
@@ -113,6 +113,10 @@ impl Emitter for JsonEmitter {
         }
     }
 
+    fn source_map(&self) -> Option<&Lrc<SourceMapperDyn>> {
+        Some(&self.sm)
+    }
+
     fn should_show_explain(&self) -> bool {
         match self.json_rendered {
             HumanReadableErrorType::Short(_) => false,
diff --git a/src/libsyntax/source_map.rs b/src/libsyntax/source_map.rs
index 5e569f9dae3..1501adc5971 100644
--- a/src/libsyntax/source_map.rs
+++ b/src/libsyntax/source_map.rs
@@ -970,6 +970,9 @@ impl SourceMapper for SourceMap {
     fn span_to_string(&self, sp: Span) -> String {
         self.span_to_string(sp)
     }
+    fn span_to_snippet(&self, sp: Span) -> Result<String, SpanSnippetError> {
+        self.span_to_snippet(sp)
+    }
     fn span_to_filename(&self, sp: Span) -> FileName {
         self.span_to_filename(sp)
     }