@@ -32,7 +32,7 @@ macro_rules! pos {
32
32
not( target_os = "ios" ) ,
33
33
not( target_os = "android" ) ,
34
34
not( all( target_os = "linux" , target_arch = "arm" ) ) ) ,
35
- all( windows, target_env = "gnu" , not( target_arch = "x86" ) ) ) ) ]
35
+ all( windows, not( target_arch = "x86" ) ) ) ) ]
36
36
macro_rules! dump_and_die {
37
37
( $( $pos: expr) ,* ) => ( {
38
38
// FIXME(#18285): we cannot include the current position because
@@ -48,7 +48,7 @@ macro_rules! dump_and_die {
48
48
not( target_os = "ios" ) ,
49
49
not( target_os = "android" ) ,
50
50
not( all( target_os = "linux" , target_arch = "arm" ) ) ) ,
51
- all( windows, target_env = "gnu" , not( target_arch = "x86" ) ) ) ) ) ]
51
+ all( windows, not( target_arch = "x86" ) ) ) ) ) ]
52
52
macro_rules! dump_and_die {
53
53
( $( $pos: expr) ,* ) => ( { let _ = [ $( $pos) ,* ] ; } )
54
54
}
@@ -69,7 +69,10 @@ type Pos = (&'static str, u32);
69
69
// this goes to stdout and each line has to be occurred
70
70
// in the following backtrace to stderr with a correct order.
71
71
fn dump_filelines ( filelines : & [ Pos ] ) {
72
- for & ( file, line) in filelines. iter ( ) . rev ( ) {
72
+ // Skip top frame for MSVC, because it sees the macro rather than
73
+ // the containing function.
74
+ let skip = if cfg ! ( target_env = "msvc" ) { 1 } else { 0 } ;
75
+ for & ( file, line) in filelines. iter ( ) . rev ( ) . skip ( skip) {
73
76
// extract a basename
74
77
let basename = file. split ( & [ '/' , '\\' ] [ ..] ) . last ( ) . unwrap ( ) ;
75
78
println ! ( "{}:{}" , basename, line) ;
@@ -88,12 +91,18 @@ fn inner(counter: &mut i32, main_pos: Pos, outer_pos: Pos) {
88
91
} ) ;
89
92
}
90
93
91
- #[ inline( always) ]
94
+ // LLVM does not yet output the required debug info to support showing inlined
95
+ // function calls in backtraces when targetting MSVC, so disable inlining in
96
+ // this case.
97
+ #[ cfg_attr( not( target_env = "msvc" ) , inline( always) ) ]
98
+ #[ cfg_attr( target_env = "msvc" , inline( never) ) ]
92
99
fn inner_inlined ( counter : & mut i32 , main_pos : Pos , outer_pos : Pos ) {
93
100
check ! ( counter; main_pos, outer_pos) ;
94
101
check ! ( counter; main_pos, outer_pos) ;
95
102
96
- #[ inline( always) ]
103
+ // Again, disable inlining for MSVC.
104
+ #[ cfg_attr( not( target_env = "msvc" ) , inline( always) ) ]
105
+ #[ cfg_attr( target_env = "msvc" , inline( never) ) ]
97
106
fn inner_further_inlined ( counter : & mut i32 , main_pos : Pos , outer_pos : Pos , inner_pos : Pos ) {
98
107
check ! ( counter; main_pos, outer_pos, inner_pos) ;
99
108
}
0 commit comments