File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -130,14 +130,11 @@ fn report_msg<'tcx, 'mir>(
130
130
}
131
131
// Add backtrace
132
132
let frames = ecx. generate_stacktrace ( None ) ;
133
- // We iterate with indices because we need to look at the next frame (the caller).
134
- for idx in 0 ..frames. len ( ) {
135
- let frame_info = & frames[ idx] ;
136
- let call_site_is_local = frames
137
- . get ( idx + 1 )
138
- . map_or ( false , |caller_info| caller_info. instance . def_id ( ) . is_local ( ) ) ;
139
- if call_site_is_local {
140
- err. span_note ( frame_info. call_site , & frame_info. to_string ( ) ) ;
133
+ for ( idx, frame_info) in frames. iter ( ) . enumerate ( ) {
134
+ let is_local = frame_info. instance . def_id ( ) . is_local ( ) ;
135
+ // No span for non-local frames and the first frame (which is the error site).
136
+ if is_local && idx > 0 {
137
+ err. span_note ( frame_info. span , & frame_info. to_string ( ) ) ;
141
138
} else {
142
139
err. note ( & frame_info. to_string ( ) ) ;
143
140
}
Original file line number Diff line number Diff line change 7
7
enum Void { }
8
8
9
9
fn f ( v : Void ) -> ! {
10
- match v { } //~ ERROR entering unreachable code
10
+ match v { } //~ ERROR entering unreachable code
11
11
}
12
12
13
13
fn main ( ) {
14
14
let v: Void = unsafe {
15
15
std:: mem:: transmute :: < ( ) , Void > ( ( ) )
16
16
} ;
17
- f ( v) ; //~ inside call to `f `
17
+ f ( v) ; //~ inside `main `
18
18
}
You can’t perform that action at this time.
0 commit comments