@@ -36,8 +36,11 @@ fn main() {
36
36
let ok = tmpdir. join ( "ok" ) ;
37
37
let not_ok = tmpdir. join ( "not_ok" ) ;
38
38
if env:: var ( "YOU_ARE_A_LINKER" ) . is_ok ( ) {
39
- match env:: args ( ) . find ( |a| a. contains ( "@" ) ) {
40
- Some ( file) => { fs:: copy ( & file[ 1 ..] , & ok) . unwrap ( ) ; }
39
+ match env:: args_os ( ) . find ( |a| a. to_string_lossy ( ) . contains ( "@" ) ) {
40
+ Some ( file) => {
41
+ let file = file. to_str ( ) . unwrap ( ) ;
42
+ fs:: copy ( & file[ 1 ..] , & ok) . unwrap ( ) ;
43
+ }
41
44
None => { File :: create ( & not_ok) . unwrap ( ) ; }
42
45
}
43
46
return
@@ -84,11 +87,23 @@ fn main() {
84
87
continue
85
88
}
86
89
87
- let mut contents = String :: new ( ) ;
88
- File :: open ( & ok) . unwrap ( ) . read_to_string ( & mut contents) . unwrap ( ) ;
90
+ let mut contents = Vec :: new ( ) ;
91
+ File :: open ( & ok) . unwrap ( ) . read_to_end ( & mut contents) . unwrap ( ) ;
89
92
90
93
for j in 0 ..i {
91
- assert ! ( contents. contains( & format!( "{}{}" , lib_name, j) ) ) ;
94
+ let exp = format ! ( "{}{}" , lib_name, j) ;
95
+ let exp = if cfg ! ( target_env = "msvc" ) {
96
+ let mut out = Vec :: with_capacity ( exp. len ( ) * 2 ) ;
97
+ for c in exp. encode_utf16 ( ) {
98
+ // encode in little endian
99
+ out. push ( c as u8 ) ;
100
+ out. push ( ( c >> 8 ) as u8 ) ;
101
+ }
102
+ out
103
+ } else {
104
+ exp. into_bytes ( )
105
+ } ;
106
+ assert ! ( contents. windows( exp. len( ) ) . any( |w| w == & exp[ ..] ) ) ;
92
107
}
93
108
94
109
break
0 commit comments