File tree 2 files changed +6
-3
lines changed
compiler/rustc_errors/src
2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -1513,7 +1513,7 @@ impl HumanEmitter {
1513
1513
for line_idx in 0 ..annotated_file. lines . len ( ) {
1514
1514
let file = annotated_file. file . clone ( ) ;
1515
1515
let line = & annotated_file. lines [ line_idx] ;
1516
- if let Some ( source_string) = file . get_line ( line. line_index - 1 ) {
1516
+ if let Some ( source_string) = line. line_index . checked_sub ( 1 ) . and_then ( |l| file . get_line ( l ) ) {
1517
1517
let leading_whitespace = source_string
1518
1518
. chars ( )
1519
1519
. take_while ( |c| c. is_whitespace ( ) )
Original file line number Diff line number Diff line change 1
1
error[E0308]: mismatched types
2
- --> $DIR/mismatched-types.rs:2:20
2
+ --> $DIR/file.txt:0:1
3
+ |
4
+ |
5
+ ::: $DIR/mismatched-types.rs:2:12
3
6
|
4
7
LL | let b: &[u8] = include_str!("file.txt");
5
- | ----- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `&[u8]`, found `&str`
8
+ | ----- ------------------------ in this macro invocation
6
9
| |
7
10
| expected due to this
8
11
|
You can’t perform that action at this time.
0 commit comments