10
10
use Destination :: * ;
11
11
12
12
use syntax_pos:: { SourceFile , Span , MultiSpan } ;
13
+ use syntax_pos:: source_map:: SourceMap ;
13
14
14
15
use crate :: {
15
16
Level , CodeSuggestion , Diagnostic , SubDiagnostic , pluralize,
16
- SuggestionStyle , SourceMapper , SourceMapperDyn , DiagnosticId ,
17
+ SuggestionStyle , DiagnosticId ,
17
18
} ;
18
19
use crate :: Level :: Error ;
19
20
use crate :: snippet:: { Annotation , AnnotationType , Line , MultilineAnnotation , StyledString , Style } ;
@@ -49,7 +50,7 @@ impl HumanReadableErrorType {
49
50
pub fn new_emitter (
50
51
self ,
51
52
dst : Box < dyn Write + Send > ,
52
- source_map : Option < Lrc < SourceMapperDyn > > ,
53
+ source_map : Option < Lrc < SourceMap > > ,
53
54
teach : bool ,
54
55
terminal_width : Option < usize > ,
55
56
external_macro_backtrace : bool ,
@@ -192,7 +193,7 @@ pub trait Emitter {
192
193
true
193
194
}
194
195
195
- fn source_map ( & self ) -> Option < & Lrc < SourceMapperDyn > > ;
196
+ fn source_map ( & self ) -> Option < & Lrc < SourceMap > > ;
196
197
197
198
/// Formats the substitutions of the primary_span
198
199
///
@@ -271,7 +272,7 @@ pub trait Emitter {
271
272
// point directly at <*macros>. Since these are often difficult to read, this
272
273
// will change the span to point at the use site.
273
274
fn fix_multispans_in_std_macros ( & self ,
274
- source_map : & Option < Lrc < SourceMapperDyn > > ,
275
+ source_map : & Option < Lrc < SourceMap > > ,
275
276
span : & mut MultiSpan ,
276
277
children : & mut Vec < SubDiagnostic > ,
277
278
level : & Level ,
@@ -311,7 +312,7 @@ pub trait Emitter {
311
312
// <*macros>. Since these locations are often difficult to read, we move these Spans from
312
313
// <*macros> to their corresponding use site.
313
314
fn fix_multispan_in_std_macros ( & self ,
314
- source_map : & Option < Lrc < SourceMapperDyn > > ,
315
+ source_map : & Option < Lrc < SourceMap > > ,
315
316
span : & mut MultiSpan ,
316
317
always_backtrace : bool ) -> bool {
317
318
let sm = match source_map {
@@ -397,7 +398,7 @@ pub trait Emitter {
397
398
}
398
399
399
400
impl Emitter for EmitterWriter {
400
- fn source_map ( & self ) -> Option < & Lrc < SourceMapperDyn > > {
401
+ fn source_map ( & self ) -> Option < & Lrc < SourceMap > > {
401
402
self . sm . as_ref ( )
402
403
}
403
404
@@ -428,7 +429,7 @@ impl Emitter for EmitterWriter {
428
429
pub struct SilentEmitter ;
429
430
430
431
impl Emitter for SilentEmitter {
431
- fn source_map ( & self ) -> Option < & Lrc < SourceMapperDyn > > { None }
432
+ fn source_map ( & self ) -> Option < & Lrc < SourceMap > > { None }
432
433
fn emit_diagnostic ( & mut self , _: & Diagnostic ) { }
433
434
}
434
435
@@ -476,7 +477,7 @@ impl ColorConfig {
476
477
/// Handles the writing of `HumanReadableErrorType::Default` and `HumanReadableErrorType::Short`
477
478
pub struct EmitterWriter {
478
479
dst : Destination ,
479
- sm : Option < Lrc < SourceMapperDyn > > ,
480
+ sm : Option < Lrc < SourceMap > > ,
480
481
short_message : bool ,
481
482
teach : bool ,
482
483
ui_testing : bool ,
@@ -495,7 +496,7 @@ pub struct FileWithAnnotatedLines {
495
496
impl EmitterWriter {
496
497
pub fn stderr (
497
498
color_config : ColorConfig ,
498
- source_map : Option < Lrc < SourceMapperDyn > > ,
499
+ source_map : Option < Lrc < SourceMap > > ,
499
500
short_message : bool ,
500
501
teach : bool ,
501
502
terminal_width : Option < usize > ,
@@ -515,7 +516,7 @@ impl EmitterWriter {
515
516
516
517
pub fn new (
517
518
dst : Box < dyn Write + Send > ,
518
- source_map : Option < Lrc < SourceMapperDyn > > ,
519
+ source_map : Option < Lrc < SourceMap > > ,
519
520
short_message : bool ,
520
521
teach : bool ,
521
522
colored : bool ,
@@ -1685,7 +1686,7 @@ impl FileWithAnnotatedLines {
1685
1686
/// This helps us quickly iterate over the whole message (including secondary file spans)
1686
1687
pub fn collect_annotations (
1687
1688
msp : & MultiSpan ,
1688
- source_map : & Option < Lrc < SourceMapperDyn > >
1689
+ source_map : & Option < Lrc < SourceMap > >
1689
1690
) -> Vec < FileWithAnnotatedLines > {
1690
1691
fn add_annotation_to_file ( file_vec : & mut Vec < FileWithAnnotatedLines > ,
1691
1692
file : Lrc < SourceFile > ,
@@ -2067,7 +2068,7 @@ impl<'a> Drop for WritableDst<'a> {
2067
2068
}
2068
2069
2069
2070
/// 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 {
2071
2072
// FIXME: this should probably be extended to also account for `FO0` → `FOO` and unicode.
2072
2073
let found = sm. span_to_snippet ( sp) . unwrap ( ) ;
2073
2074
let ascii_confusables = & [ 'c' , 'f' , 'i' , 'k' , 'o' , 's' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z' ] ;
0 commit comments