File tree Expand file tree Collapse file tree 4 files changed +32
-9
lines changed Expand file tree Collapse file tree 4 files changed +32
-9
lines changed Load Diff This file was deleted.
File renamed without changes.
Original file line number Diff line number Diff line change 1+ //@ only-msvc
2+
3+ // Tests that WS2_32.dll is not unnecessarily linked, see issue #85441
4+
5+ use run_make_support:: object:: { self , read:: Object } ;
6+ use run_make_support:: { rustc, tmp_dir} ;
7+ use std:: fs;
8+
9+ fn main ( ) {
10+ rustc ( ) . input ( "empty.rs" ) . run ( ) ;
11+ rustc ( ) . input ( "tcp.rs" ) . run ( ) ;
12+
13+ assert ! ( !links_ws2_32( "empty.exe" ) ) ;
14+ assert ! ( links_ws2_32( "tcp.exe" ) ) ;
15+ }
16+
17+ fn links_ws2_32 ( exe : & str ) -> bool {
18+ let path = tmp_dir ( ) . join ( exe) ;
19+ let binary_data = fs:: read ( path) . unwrap ( ) ;
20+ let file = object:: File :: parse ( & * binary_data) . unwrap ( ) ;
21+ for import in file. imports ( ) . unwrap ( ) {
22+ if import. library ( ) . eq_ignore_ascii_case ( b"WS2_32.dll" ) {
23+ return true ;
24+ }
25+ }
26+ false
27+ }
Original file line number Diff line number Diff line change 1+ use std:: net:: TcpListener ;
2+
3+ fn main ( ) {
4+ TcpListener :: bind ( "127.0.0.1:80" ) . unwrap ( ) ;
5+ }
You can’t perform that action at this time.
0 commit comments