File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
compiler/rustc_errors/src Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -2354,7 +2354,6 @@ impl HumanEmitter {
2354
2354
. sum ( ) ;
2355
2355
let underline_start = ( span_start_pos + start) as isize + offset;
2356
2356
let underline_end = ( span_start_pos + start + sub_len) as isize + offset;
2357
- assert ! ( underline_start >= 0 && underline_end >= 0 ) ;
2358
2357
let padding: usize = max_line_num_len + 3 ;
2359
2358
for p in underline_start..underline_end {
2360
2359
if let DisplaySuggestion :: Underline = show_code_change
Original file line number Diff line number Diff line change @@ -381,6 +381,12 @@ impl CodeSuggestion {
381
381
// Assumption: all spans are in the same file, and all spans
382
382
// are disjoint. Sort in ascending order.
383
383
substitution. parts . sort_by_key ( |part| part. span . lo ( ) ) ;
384
+ // Verify the assumption that all spans are disjoint
385
+ assert_eq ! (
386
+ substitution. parts. array_windows( ) . find( |[ a, b] | a. span. overlaps( b. span) ) ,
387
+ None ,
388
+ "all spans must be disjoint" ,
389
+ ) ;
384
390
385
391
// Find the bounding span.
386
392
let lo = substitution. parts . iter ( ) . map ( |part| part. span . lo ( ) ) . min ( ) ?;
You can’t perform that action at this time.
0 commit comments