1010use Destination :: * ;
1111
1212use syntax_pos:: { SourceFile , Span , MultiSpan } ;
13+ use syntax_pos:: source_map:: SourceMap ;
1314
1415use crate :: {
1516 Level , CodeSuggestion , Diagnostic , SubDiagnostic , pluralize,
16- SuggestionStyle , SourceMapper , SourceMapperDyn , DiagnosticId ,
17+ SuggestionStyle , DiagnosticId ,
1718} ;
1819use crate :: Level :: Error ;
1920use crate :: snippet:: { Annotation , AnnotationType , Line , MultilineAnnotation , StyledString , Style } ;
@@ -49,7 +50,7 @@ impl HumanReadableErrorType {
4950 pub fn new_emitter (
5051 self ,
5152 dst : Box < dyn Write + Send > ,
52- source_map : Option < Lrc < SourceMapperDyn > > ,
53+ source_map : Option < Lrc < SourceMap > > ,
5354 teach : bool ,
5455 terminal_width : Option < usize > ,
5556 external_macro_backtrace : bool ,
@@ -192,7 +193,7 @@ pub trait Emitter {
192193 true
193194 }
194195
195- fn source_map ( & self ) -> Option < & Lrc < SourceMapperDyn > > ;
196+ fn source_map ( & self ) -> Option < & Lrc < SourceMap > > ;
196197
197198 /// Formats the substitutions of the primary_span
198199 ///
@@ -271,7 +272,7 @@ pub trait Emitter {
271272 // point directly at <*macros>. Since these are often difficult to read, this
272273 // will change the span to point at the use site.
273274 fn fix_multispans_in_std_macros ( & self ,
274- source_map : & Option < Lrc < SourceMapperDyn > > ,
275+ source_map : & Option < Lrc < SourceMap > > ,
275276 span : & mut MultiSpan ,
276277 children : & mut Vec < SubDiagnostic > ,
277278 level : & Level ,
@@ -311,7 +312,7 @@ pub trait Emitter {
311312 // <*macros>. Since these locations are often difficult to read, we move these Spans from
312313 // <*macros> to their corresponding use site.
313314 fn fix_multispan_in_std_macros ( & self ,
314- source_map : & Option < Lrc < SourceMapperDyn > > ,
315+ source_map : & Option < Lrc < SourceMap > > ,
315316 span : & mut MultiSpan ,
316317 always_backtrace : bool ) -> bool {
317318 let sm = match source_map {
@@ -397,7 +398,7 @@ pub trait Emitter {
397398}
398399
399400impl Emitter for EmitterWriter {
400- fn source_map ( & self ) -> Option < & Lrc < SourceMapperDyn > > {
401+ fn source_map ( & self ) -> Option < & Lrc < SourceMap > > {
401402 self . sm . as_ref ( )
402403 }
403404
@@ -428,7 +429,7 @@ impl Emitter for EmitterWriter {
428429pub struct SilentEmitter ;
429430
430431impl Emitter for SilentEmitter {
431- fn source_map ( & self ) -> Option < & Lrc < SourceMapperDyn > > { None }
432+ fn source_map ( & self ) -> Option < & Lrc < SourceMap > > { None }
432433 fn emit_diagnostic ( & mut self , _: & Diagnostic ) { }
433434}
434435
@@ -476,7 +477,7 @@ impl ColorConfig {
476477/// Handles the writing of `HumanReadableErrorType::Default` and `HumanReadableErrorType::Short`
477478pub struct EmitterWriter {
478479 dst : Destination ,
479- sm : Option < Lrc < SourceMapperDyn > > ,
480+ sm : Option < Lrc < SourceMap > > ,
480481 short_message : bool ,
481482 teach : bool ,
482483 ui_testing : bool ,
@@ -495,7 +496,7 @@ pub struct FileWithAnnotatedLines {
495496impl EmitterWriter {
496497 pub fn stderr (
497498 color_config : ColorConfig ,
498- source_map : Option < Lrc < SourceMapperDyn > > ,
499+ source_map : Option < Lrc < SourceMap > > ,
499500 short_message : bool ,
500501 teach : bool ,
501502 terminal_width : Option < usize > ,
@@ -515,7 +516,7 @@ impl EmitterWriter {
515516
516517 pub fn new (
517518 dst : Box < dyn Write + Send > ,
518- source_map : Option < Lrc < SourceMapperDyn > > ,
519+ source_map : Option < Lrc < SourceMap > > ,
519520 short_message : bool ,
520521 teach : bool ,
521522 colored : bool ,
@@ -1685,7 +1686,7 @@ impl FileWithAnnotatedLines {
16851686 /// This helps us quickly iterate over the whole message (including secondary file spans)
16861687 pub fn collect_annotations (
16871688 msp : & MultiSpan ,
1688- source_map : & Option < Lrc < SourceMapperDyn > >
1689+ source_map : & Option < Lrc < SourceMap > >
16891690 ) -> Vec < FileWithAnnotatedLines > {
16901691 fn add_annotation_to_file ( file_vec : & mut Vec < FileWithAnnotatedLines > ,
16911692 file : Lrc < SourceFile > ,
@@ -2067,7 +2068,7 @@ impl<'a> Drop for WritableDst<'a> {
20672068}
20682069
20692070/// Whether the original and suggested code are visually similar enough to warrant extra wording.
2070- pub fn is_case_difference ( sm : & dyn SourceMapper , suggested : & str , sp : Span ) -> bool {
2071+ pub fn is_case_difference ( sm : & SourceMap , suggested : & str , sp : Span ) -> bool {
20712072 // FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.
20722073 let found = sm. span_to_snippet ( sp) . unwrap ( ) ;
20732074 let ascii_confusables = & [ 'c' , 'f' , 'i' , 'k' , 'o' , 's' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z' ] ;
0 commit comments