@@ -120,7 +120,7 @@ impl ColorConfig {
120
120
121
121
pub struct EmitterWriter {
122
122
dst : Destination ,
123
- cm : Option < Lrc < SourceMapperDyn > > ,
123
+ sm : Option < Lrc < SourceMapperDyn > > ,
124
124
short_message : bool ,
125
125
teach : bool ,
126
126
ui_testing : bool ,
@@ -134,28 +134,28 @@ struct FileWithAnnotatedLines {
134
134
135
135
impl EmitterWriter {
136
136
pub fn stderr ( color_config : ColorConfig ,
137
- code_map : Option < Lrc < SourceMapperDyn > > ,
137
+ source_map : Option < Lrc < SourceMapperDyn > > ,
138
138
short_message : bool ,
139
139
teach : bool )
140
140
-> EmitterWriter {
141
141
let dst = Destination :: from_stderr ( color_config) ;
142
142
EmitterWriter {
143
143
dst,
144
- cm : code_map ,
144
+ sm : source_map ,
145
145
short_message,
146
146
teach,
147
147
ui_testing : false ,
148
148
}
149
149
}
150
150
151
151
pub fn new ( dst : Box < dyn Write + Send > ,
152
- code_map : Option < Lrc < SourceMapperDyn > > ,
152
+ source_map : Option < Lrc < SourceMapperDyn > > ,
153
153
short_message : bool ,
154
154
teach : bool )
155
155
-> EmitterWriter {
156
156
EmitterWriter {
157
157
dst : Raw ( dst) ,
158
- cm : code_map ,
158
+ sm : source_map ,
159
159
short_message,
160
160
teach,
161
161
ui_testing : false ,
@@ -214,14 +214,14 @@ impl EmitterWriter {
214
214
let mut output = vec ! [ ] ;
215
215
let mut multiline_annotations = vec ! [ ] ;
216
216
217
- if let Some ( ref cm ) = self . cm {
217
+ if let Some ( ref sm ) = self . sm {
218
218
for span_label in msp. span_labels ( ) {
219
219
if span_label. span . is_dummy ( ) {
220
220
continue ;
221
221
}
222
222
223
- let lo = cm . lookup_char_pos ( span_label. span . lo ( ) ) ;
224
- let mut hi = cm . lookup_char_pos ( span_label. span . hi ( ) ) ;
223
+ let lo = sm . lookup_char_pos ( span_label. span . lo ( ) ) ;
224
+ let mut hi = sm . lookup_char_pos ( span_label. span . hi ( ) ) ;
225
225
226
226
// Watch out for "empty spans". If we get a span like 6..6, we
227
227
// want to just display a `^` at 6, so convert that to
@@ -724,10 +724,10 @@ impl EmitterWriter {
724
724
725
725
fn get_multispan_max_line_num ( & mut self , msp : & MultiSpan ) -> usize {
726
726
let mut max = 0 ;
727
- if let Some ( ref cm ) = self . cm {
727
+ if let Some ( ref sm ) = self . sm {
728
728
for primary_span in msp. primary_spans ( ) {
729
729
if !primary_span. is_dummy ( ) {
730
- let hi = cm . lookup_char_pos ( primary_span. hi ( ) ) ;
730
+ let hi = sm . lookup_char_pos ( primary_span. hi ( ) ) ;
731
731
if hi. line > max {
732
732
max = hi. line ;
733
733
}
@@ -736,7 +736,7 @@ impl EmitterWriter {
736
736
if !self . short_message {
737
737
for span_label in msp. span_labels ( ) {
738
738
if !span_label. span . is_dummy ( ) {
739
- let hi = cm . lookup_char_pos ( span_label. span . hi ( ) ) ;
739
+ let hi = sm . lookup_char_pos ( span_label. span . hi ( ) ) ;
740
740
if hi. line > max {
741
741
max = hi. line ;
742
742
}
@@ -768,7 +768,7 @@ impl EmitterWriter {
768
768
always_backtrace : bool ) -> bool {
769
769
let mut spans_updated = false ;
770
770
771
- if let Some ( ref cm ) = self . cm {
771
+ if let Some ( ref sm ) = self . sm {
772
772
let mut before_after: Vec < ( Span , Span ) > = vec ! [ ] ;
773
773
let mut new_labels: Vec < ( Span , String ) > = vec ! [ ] ;
774
774
@@ -777,7 +777,7 @@ impl EmitterWriter {
777
777
if sp. is_dummy ( ) {
778
778
continue ;
779
779
}
780
- let call_sp = cm . call_span_if_macro ( * sp) ;
780
+ let call_sp = sm . call_span_if_macro ( * sp) ;
781
781
if call_sp != * sp && !always_backtrace {
782
782
before_after. push ( ( * sp, call_sp) ) ;
783
783
}
@@ -802,7 +802,7 @@ impl EmitterWriter {
802
802
} ) ) ) ;
803
803
}
804
804
// Check to make sure we're not in any <*macros>
805
- if !cm . span_to_filename ( def_site) . is_macros ( ) &&
805
+ if !sm . span_to_filename ( def_site) . is_macros ( ) &&
806
806
!trace. macro_decl_name . starts_with ( "desugaring of " ) &&
807
807
!trace. macro_decl_name . starts_with ( "#[" ) ||
808
808
always_backtrace {
@@ -829,7 +829,7 @@ impl EmitterWriter {
829
829
if sp_label. span . is_dummy ( ) {
830
830
continue ;
831
831
}
832
- if cm . span_to_filename ( sp_label. span . clone ( ) ) . is_macros ( ) &&
832
+ if sm . span_to_filename ( sp_label. span . clone ( ) ) . is_macros ( ) &&
833
833
!always_backtrace
834
834
{
835
835
let v = sp_label. span . macro_backtrace ( ) ;
@@ -1000,10 +1000,10 @@ impl EmitterWriter {
1000
1000
let mut annotated_files = self . preprocess_annotations ( msp) ;
1001
1001
1002
1002
// Make sure our primary file comes first
1003
- let ( primary_lo, cm ) = if let ( Some ( cm ) , Some ( ref primary_span) ) =
1004
- ( self . cm . as_ref ( ) , msp. primary_span ( ) . as_ref ( ) ) {
1003
+ let ( primary_lo, sm ) = if let ( Some ( sm ) , Some ( ref primary_span) ) =
1004
+ ( self . sm . as_ref ( ) , msp. primary_span ( ) . as_ref ( ) ) {
1005
1005
if !primary_span. is_dummy ( ) {
1006
- ( cm . lookup_char_pos ( primary_span. lo ( ) ) , cm )
1006
+ ( sm . lookup_char_pos ( primary_span. lo ( ) ) , sm )
1007
1007
} else {
1008
1008
emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
1009
1009
return Ok ( ( ) ) ;
@@ -1021,7 +1021,7 @@ impl EmitterWriter {
1021
1021
// Print out the annotate source lines that correspond with the error
1022
1022
for annotated_file in annotated_files {
1023
1023
// we can't annotate anything if the source is unavailable.
1024
- if !cm . ensure_source_file_source_present ( annotated_file. file . clone ( ) ) {
1024
+ if !sm . ensure_source_file_source_present ( annotated_file. file . clone ( ) ) {
1025
1025
continue ;
1026
1026
}
1027
1027
@@ -1038,7 +1038,7 @@ impl EmitterWriter {
1038
1038
buffer. append ( buffer_msg_line_offset,
1039
1039
& format ! ( "{}:{}:{}" ,
1040
1040
loc. file. name,
1041
- cm . doctest_offset_line( loc. line) ,
1041
+ sm . doctest_offset_line( loc. line) ,
1042
1042
loc. col. 0 + 1 ) ,
1043
1043
Style :: LineAndColumn ) ;
1044
1044
for _ in 0 ..max_line_num_len {
@@ -1048,7 +1048,7 @@ impl EmitterWriter {
1048
1048
buffer. prepend ( 0 ,
1049
1049
& format ! ( "{}:{}:{}: " ,
1050
1050
loc. file. name,
1051
- cm . doctest_offset_line( loc. line) ,
1051
+ sm . doctest_offset_line( loc. line) ,
1052
1052
loc. col. 0 + 1 ) ,
1053
1053
Style :: LineAndColumn ) ;
1054
1054
}
@@ -1069,7 +1069,7 @@ impl EmitterWriter {
1069
1069
} ;
1070
1070
format ! ( "{}:{}{}" ,
1071
1071
annotated_file. file. name,
1072
- cm . doctest_offset_line( first_line. line_index) ,
1072
+ sm . doctest_offset_line( first_line. line_index) ,
1073
1073
col)
1074
1074
} else {
1075
1075
annotated_file. file . name . to_string ( )
@@ -1194,7 +1194,7 @@ impl EmitterWriter {
1194
1194
level : & Level ,
1195
1195
max_line_num_len : usize )
1196
1196
-> io:: Result < ( ) > {
1197
- if let Some ( ref cm ) = self . cm {
1197
+ if let Some ( ref sm ) = self . sm {
1198
1198
let mut buffer = StyledBuffer :: new ( ) ;
1199
1199
1200
1200
// Render the suggestion message
@@ -1210,7 +1210,7 @@ impl EmitterWriter {
1210
1210
Some ( Style :: HeaderMsg ) ) ;
1211
1211
1212
1212
// Render the replacements for each suggestion
1213
- let suggestions = suggestion. splice_lines ( & * * cm ) ;
1213
+ let suggestions = suggestion. splice_lines ( & * * sm ) ;
1214
1214
1215
1215
let mut row_num = 2 ;
1216
1216
for & ( ref complete, ref parts) in suggestions. iter ( ) . take ( MAX_SUGGESTIONS ) {
@@ -1221,11 +1221,11 @@ impl EmitterWriter {
1221
1221
&& parts[ 0 ] . snippet . trim ( ) == complete. trim ( ) )
1222
1222
&& complete. lines ( ) . count ( ) == 1 ;
1223
1223
1224
- let lines = cm . span_to_lines ( parts[ 0 ] . span ) . unwrap ( ) ;
1224
+ let lines = sm . span_to_lines ( parts[ 0 ] . span ) . unwrap ( ) ;
1225
1225
1226
1226
assert ! ( !lines. lines. is_empty( ) ) ;
1227
1227
1228
- let line_start = cm . lookup_char_pos ( parts[ 0 ] . span . lo ( ) ) . line ;
1228
+ let line_start = sm . lookup_char_pos ( parts[ 0 ] . span . lo ( ) ) . line ;
1229
1229
draw_col_separator_no_space ( & mut buffer, 1 , max_line_num_len + 1 ) ;
1230
1230
let mut line_pos = 0 ;
1231
1231
let mut lines = complete. lines ( ) ;
@@ -1250,8 +1250,8 @@ impl EmitterWriter {
1250
1250
if show_underline {
1251
1251
draw_col_separator ( & mut buffer, row_num, max_line_num_len + 1 ) ;
1252
1252
for part in parts {
1253
- let span_start_pos = cm . lookup_char_pos ( part. span . lo ( ) ) . col_display ;
1254
- let span_end_pos = cm . lookup_char_pos ( part. span . hi ( ) ) . col_display ;
1253
+ let span_start_pos = sm . lookup_char_pos ( part. span . lo ( ) ) . col_display ;
1254
+ let span_end_pos = sm . lookup_char_pos ( part. span . hi ( ) ) . col_display ;
1255
1255
1256
1256
// Do not underline the leading...
1257
1257
let start = part. snippet . len ( )
0 commit comments