@@ -120,7 +120,7 @@ impl ColorConfig {
120120
121121pub struct EmitterWriter {
122122 dst : Destination ,
123- cm : Option < Lrc < SourceMapperDyn > > ,
123+ sm : Option < Lrc < SourceMapperDyn > > ,
124124 short_message : bool ,
125125 teach : bool ,
126126 ui_testing : bool ,
@@ -134,28 +134,28 @@ struct FileWithAnnotatedLines {
134134
135135impl EmitterWriter {
136136 pub fn stderr ( color_config : ColorConfig ,
137- code_map : Option < Lrc < SourceMapperDyn > > ,
137+ source_map : Option < Lrc < SourceMapperDyn > > ,
138138 short_message : bool ,
139139 teach : bool )
140140 -> EmitterWriter {
141141 let dst = Destination :: from_stderr ( color_config) ;
142142 EmitterWriter {
143143 dst,
144- cm : code_map ,
144+ sm : source_map ,
145145 short_message,
146146 teach,
147147 ui_testing : false ,
148148 }
149149 }
150150
151151 pub fn new ( dst : Box < dyn Write + Send > ,
152- code_map : Option < Lrc < SourceMapperDyn > > ,
152+ source_map : Option < Lrc < SourceMapperDyn > > ,
153153 short_message : bool ,
154154 teach : bool )
155155 -> EmitterWriter {
156156 EmitterWriter {
157157 dst : Raw ( dst) ,
158- cm : code_map ,
158+ sm : source_map ,
159159 short_message,
160160 teach,
161161 ui_testing : false ,
@@ -214,14 +214,14 @@ impl EmitterWriter {
214214 let mut output = vec ! [ ] ;
215215 let mut multiline_annotations = vec ! [ ] ;
216216
217- if let Some ( ref cm ) = self . cm {
217+ if let Some ( ref sm ) = self . sm {
218218 for span_label in msp. span_labels ( ) {
219219 if span_label. span . is_dummy ( ) {
220220 continue ;
221221 }
222222
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 ( ) ) ;
225225
226226 // Watch out for "empty spans". If we get a span like 6..6, we
227227 // want to just display a `^` at 6, so convert that to
@@ -724,10 +724,10 @@ impl EmitterWriter {
724724
725725 fn get_multispan_max_line_num ( & mut self , msp : & MultiSpan ) -> usize {
726726 let mut max = 0 ;
727- if let Some ( ref cm ) = self . cm {
727+ if let Some ( ref sm ) = self . sm {
728728 for primary_span in msp. primary_spans ( ) {
729729 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 ( ) ) ;
731731 if hi. line > max {
732732 max = hi. line ;
733733 }
@@ -736,7 +736,7 @@ impl EmitterWriter {
736736 if !self . short_message {
737737 for span_label in msp. span_labels ( ) {
738738 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 ( ) ) ;
740740 if hi. line > max {
741741 max = hi. line ;
742742 }
@@ -768,7 +768,7 @@ impl EmitterWriter {
768768 always_backtrace : bool ) -> bool {
769769 let mut spans_updated = false ;
770770
771- if let Some ( ref cm ) = self . cm {
771+ if let Some ( ref sm ) = self . sm {
772772 let mut before_after: Vec < ( Span , Span ) > = vec ! [ ] ;
773773 let mut new_labels: Vec < ( Span , String ) > = vec ! [ ] ;
774774
@@ -777,7 +777,7 @@ impl EmitterWriter {
777777 if sp. is_dummy ( ) {
778778 continue ;
779779 }
780- let call_sp = cm . call_span_if_macro ( * sp) ;
780+ let call_sp = sm . call_span_if_macro ( * sp) ;
781781 if call_sp != * sp && !always_backtrace {
782782 before_after. push ( ( * sp, call_sp) ) ;
783783 }
@@ -802,7 +802,7 @@ impl EmitterWriter {
802802 } ) ) ) ;
803803 }
804804 // 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 ( ) &&
806806 !trace. macro_decl_name . starts_with ( "desugaring of " ) &&
807807 !trace. macro_decl_name . starts_with ( "#[" ) ||
808808 always_backtrace {
@@ -829,7 +829,7 @@ impl EmitterWriter {
829829 if sp_label. span . is_dummy ( ) {
830830 continue ;
831831 }
832- if cm . span_to_filename ( sp_label. span . clone ( ) ) . is_macros ( ) &&
832+ if sm . span_to_filename ( sp_label. span . clone ( ) ) . is_macros ( ) &&
833833 !always_backtrace
834834 {
835835 let v = sp_label. span . macro_backtrace ( ) ;
@@ -1000,10 +1000,10 @@ impl EmitterWriter {
10001000 let mut annotated_files = self . preprocess_annotations ( msp) ;
10011001
10021002 // 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 ( ) ) {
10051005 if !primary_span. is_dummy ( ) {
1006- ( cm . lookup_char_pos ( primary_span. lo ( ) ) , cm )
1006+ ( sm . lookup_char_pos ( primary_span. lo ( ) ) , sm )
10071007 } else {
10081008 emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
10091009 return Ok ( ( ) ) ;
@@ -1021,7 +1021,7 @@ impl EmitterWriter {
10211021 // Print out the annotate source lines that correspond with the error
10221022 for annotated_file in annotated_files {
10231023 // 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 ( ) ) {
10251025 continue ;
10261026 }
10271027
@@ -1038,7 +1038,7 @@ impl EmitterWriter {
10381038 buffer. append ( buffer_msg_line_offset,
10391039 & format ! ( "{}:{}:{}" ,
10401040 loc. file. name,
1041- cm . doctest_offset_line( loc. line) ,
1041+ sm . doctest_offset_line( loc. line) ,
10421042 loc. col. 0 + 1 ) ,
10431043 Style :: LineAndColumn ) ;
10441044 for _ in 0 ..max_line_num_len {
@@ -1048,7 +1048,7 @@ impl EmitterWriter {
10481048 buffer. prepend ( 0 ,
10491049 & format ! ( "{}:{}:{}: " ,
10501050 loc. file. name,
1051- cm . doctest_offset_line( loc. line) ,
1051+ sm . doctest_offset_line( loc. line) ,
10521052 loc. col. 0 + 1 ) ,
10531053 Style :: LineAndColumn ) ;
10541054 }
@@ -1069,7 +1069,7 @@ impl EmitterWriter {
10691069 } ;
10701070 format ! ( "{}:{}{}" ,
10711071 annotated_file. file. name,
1072- cm . doctest_offset_line( first_line. line_index) ,
1072+ sm . doctest_offset_line( first_line. line_index) ,
10731073 col)
10741074 } else {
10751075 annotated_file. file . name . to_string ( )
@@ -1194,7 +1194,7 @@ impl EmitterWriter {
11941194 level : & Level ,
11951195 max_line_num_len : usize )
11961196 -> io:: Result < ( ) > {
1197- if let Some ( ref cm ) = self . cm {
1197+ if let Some ( ref sm ) = self . sm {
11981198 let mut buffer = StyledBuffer :: new ( ) ;
11991199
12001200 // Render the suggestion message
@@ -1210,7 +1210,7 @@ impl EmitterWriter {
12101210 Some ( Style :: HeaderMsg ) ) ;
12111211
12121212 // Render the replacements for each suggestion
1213- let suggestions = suggestion. splice_lines ( & * * cm ) ;
1213+ let suggestions = suggestion. splice_lines ( & * * sm ) ;
12141214
12151215 let mut row_num = 2 ;
12161216 for & ( ref complete, ref parts) in suggestions. iter ( ) . take ( MAX_SUGGESTIONS ) {
@@ -1221,11 +1221,11 @@ impl EmitterWriter {
12211221 && parts[ 0 ] . snippet . trim ( ) == complete. trim ( ) )
12221222 && complete. lines ( ) . count ( ) == 1 ;
12231223
1224- let lines = cm . span_to_lines ( parts[ 0 ] . span ) . unwrap ( ) ;
1224+ let lines = sm . span_to_lines ( parts[ 0 ] . span ) . unwrap ( ) ;
12251225
12261226 assert ! ( !lines. lines. is_empty( ) ) ;
12271227
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 ;
12291229 draw_col_separator_no_space ( & mut buffer, 1 , max_line_num_len + 1 ) ;
12301230 let mut line_pos = 0 ;
12311231 let mut lines = complete. lines ( ) ;
@@ -1250,8 +1250,8 @@ impl EmitterWriter {
12501250 if show_underline {
12511251 draw_col_separator ( & mut buffer, row_num, max_line_num_len + 1 ) ;
12521252 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 ;
12551255
12561256 // Do not underline the leading...
12571257 let start = part. snippet . len ( )
0 commit comments