@@ -36,9 +36,7 @@ struct UnusedExternNotification {
3636struct DiagnosticSpan {
3737 file_name : String ,
3838 line_start : usize ,
39- line_end : usize ,
4039 column_start : usize ,
41- column_end : usize ,
4240 is_primary : bool ,
4341 label : Option < String > ,
4442 suggested_replacement : Option < String > ,
@@ -148,6 +146,7 @@ pub fn parse_output(file_name: &str, output: &str) -> Vec<Error> {
148146 Ok ( diagnostic) => push_actual_errors ( & mut errors, & diagnostic, & [ ] , file_name) ,
149147 Err ( _) => errors. push ( Error {
150148 line_num : None ,
149+ column_num : None ,
151150 kind : ErrorKind :: Raw ,
152151 msg : line. to_string ( ) ,
153152 require_annotation : false ,
@@ -193,25 +192,9 @@ fn push_actual_errors(
193192 // also ensure that `//~ ERROR E123` *always* works. The
194193 // assumption is that these multi-line error messages are on their
195194 // way out anyhow.
196- let with_code = |span : Option < & DiagnosticSpan > , text : & str | {
197- // FIXME(#33000) -- it'd be better to use a dedicated
198- // UI harness than to include the line/col number like
199- // this, but some current tests rely on it.
200- //
201- // Note: Do NOT include the filename. These can easily
202- // cause false matches where the expected message
203- // appears in the filename, and hence the message
204- // changes but the test still passes.
205- let span_str = match span {
206- Some ( DiagnosticSpan { line_start, column_start, line_end, column_end, .. } ) => {
207- format ! ( "{line_start}:{column_start}: {line_end}:{column_end}" )
208- }
209- None => format ! ( "?:?: ?:?" ) ,
210- } ;
211- match & diagnostic. code {
212- Some ( code) => format ! ( "{span_str}: {text} [{}]" , code. code) ,
213- None => format ! ( "{span_str}: {text}" ) ,
214- }
195+ let with_code = |text| match & diagnostic. code {
196+ Some ( code) => format ! ( "{text} [{}]" , code. code) ,
197+ None => format ! ( "{text}" ) ,
215198 } ;
216199
217200 // Convert multi-line messages into multiple errors.
@@ -225,17 +208,19 @@ fn push_actual_errors(
225208 || Regex :: new ( r"aborting due to \d+ previous errors?|\d+ warnings? emitted" ) . unwrap ( ) ;
226209 errors. push ( Error {
227210 line_num : None ,
211+ column_num : None ,
228212 kind,
229- msg : with_code ( None , first_line) ,
213+ msg : with_code ( first_line) ,
230214 require_annotation : diagnostic. level != "failure-note"
231215 && !RE . get_or_init ( re_init) . is_match ( first_line) ,
232216 } ) ;
233217 } else {
234218 for span in primary_spans {
235219 errors. push ( Error {
236220 line_num : Some ( span. line_start ) ,
221+ column_num : Some ( span. column_start ) ,
237222 kind,
238- msg : with_code ( Some ( span ) , first_line) ,
223+ msg : with_code ( first_line) ,
239224 require_annotation : true ,
240225 } ) ;
241226 }
@@ -244,16 +229,18 @@ fn push_actual_errors(
244229 if primary_spans. is_empty ( ) {
245230 errors. push ( Error {
246231 line_num : None ,
232+ column_num : None ,
247233 kind,
248- msg : with_code ( None , next_line) ,
234+ msg : with_code ( next_line) ,
249235 require_annotation : false ,
250236 } ) ;
251237 } else {
252238 for span in primary_spans {
253239 errors. push ( Error {
254240 line_num : Some ( span. line_start ) ,
241+ column_num : Some ( span. column_start ) ,
255242 kind,
256- msg : with_code ( Some ( span ) , next_line) ,
243+ msg : with_code ( next_line) ,
257244 require_annotation : false ,
258245 } ) ;
259246 }
@@ -266,6 +253,7 @@ fn push_actual_errors(
266253 for ( index, line) in suggested_replacement. lines ( ) . enumerate ( ) {
267254 errors. push ( Error {
268255 line_num : Some ( span. line_start + index) ,
256+ column_num : Some ( span. column_start ) ,
269257 kind : ErrorKind :: Suggestion ,
270258 msg : line. to_string ( ) ,
271259 // Empty suggestions (suggestions to remove something) are common
@@ -288,6 +276,7 @@ fn push_actual_errors(
288276 if let Some ( label) = & span. label {
289277 errors. push ( Error {
290278 line_num : Some ( span. line_start ) ,
279+ column_num : Some ( span. column_start ) ,
291280 kind : ErrorKind :: Note ,
292281 msg : label. clone ( ) ,
293282 // Empty labels (only underlining spans) are common and do not need annotations.
@@ -310,6 +299,7 @@ fn push_backtrace(
310299 if Path :: new ( & expansion. span . file_name ) == Path :: new ( & file_name) {
311300 errors. push ( Error {
312301 line_num : Some ( expansion. span . line_start ) ,
302+ column_num : Some ( expansion. span . column_start ) ,
313303 kind : ErrorKind :: Note ,
314304 msg : format ! ( "in this expansion of {}" , expansion. macro_decl_name) ,
315305 require_annotation : true ,
0 commit comments