File tree Expand file tree Collapse file tree 2 files changed +35
-27
lines changed Expand file tree Collapse file tree 2 files changed +35
-27
lines changed Original file line number Diff line number Diff line change @@ -2919,26 +2919,34 @@ fn max_line_number(groups: &[Group<'_>]) -> usize {
2919
2919
| Element :: Origin ( _)
2920
2920
| Element :: Padding ( _) => 0 ,
2921
2921
Element :: Cause ( cause) => {
2922
- let end = cause
2923
- . markers
2924
- . iter ( )
2925
- . map ( |a| a. span . end )
2926
- . max ( )
2927
- . unwrap_or ( cause. source . len ( ) )
2928
- . min ( cause. source . len ( ) ) ;
2929
-
2930
- cause. line_start + newline_count ( & cause. source [ ..end] )
2922
+ if cause. fold {
2923
+ let end = cause
2924
+ . markers
2925
+ . iter ( )
2926
+ . map ( |a| a. span . end )
2927
+ . max ( )
2928
+ . unwrap_or ( cause. source . len ( ) )
2929
+ . min ( cause. source . len ( ) ) ;
2930
+
2931
+ cause. line_start + newline_count ( & cause. source [ ..end] )
2932
+ } else {
2933
+ cause. line_start + newline_count ( & cause. source )
2934
+ }
2931
2935
}
2932
2936
Element :: Suggestion ( suggestion) => {
2933
- let end = suggestion
2934
- . markers
2935
- . iter ( )
2936
- . map ( |a| a. span . end )
2937
- . max ( )
2938
- . unwrap_or ( suggestion. source . len ( ) )
2939
- . min ( suggestion. source . len ( ) ) ;
2940
-
2941
- suggestion. line_start + newline_count ( & suggestion. source [ ..end] )
2937
+ if suggestion. fold {
2938
+ let end = suggestion
2939
+ . markers
2940
+ . iter ( )
2941
+ . map ( |a| a. span . end )
2942
+ . max ( )
2943
+ . unwrap_or ( suggestion. source . len ( ) )
2944
+ . min ( suggestion. source . len ( ) ) ;
2945
+
2946
+ suggestion. line_start + newline_count ( & suggestion. source [ ..end] )
2947
+ } else {
2948
+ suggestion. line_start + newline_count ( & suggestion. source )
2949
+ }
2942
2950
}
2943
2951
} )
2944
2952
. max ( )
Original file line number Diff line number Diff line change @@ -2599,15 +2599,15 @@ zappy
2599
2599
) ] ;
2600
2600
let expected = str![ [ r#"
2601
2601
error[E0277]: the size for values of type `T` cannot be known at compilation time
2602
- |
2603
- 8 | cargo
2604
- 9 | fuzzy
2605
- | ^^^^^
2606
- 10| pizza
2607
- 11| jumps
2608
- 12| crazy
2609
- 13| quack
2610
- 14| zappy
2602
+ |
2603
+ 8 | cargo
2604
+ 9 | fuzzy
2605
+ | ^^^^^
2606
+ 10 | pizza
2607
+ 11 | jumps
2608
+ 12 | crazy
2609
+ 13 | quack
2610
+ 14 | zappy
2611
2611
"# ] ] ;
2612
2612
let renderer = Renderer :: plain ( ) ;
2613
2613
assert_data_eq ! ( renderer. render( input_new) , expected) ;
You can’t perform that action at this time.
0 commit comments