1
- // Crates that are resolved normally have their path canonicalized and all
2
- // symlinks resolved. This did not happen for paths specified
3
- // using the --extern option to rustc, which could lead to rustc thinking
4
- // that it encountered two different versions of a crate, when it's
5
- // actually the same version found through different paths.
6
- // See https://github.com/rust-lang/rust/pull/16505
7
-
8
- // This test checks that --extern and symlinks together
9
- // can result in successful compilation.
1
+ // Crates that are resolved normally have their path canonicalized and all symlinks resolved. This
2
+ // did not happen for paths specified using the `--extern` option to rustc, which could lead to
3
+ // rustc thinking that it encountered two different versions of a crate, when it's actually the same
4
+ // version found through different paths.
5
+ //
6
+ // This test checks that `--extern` and symlinks together can result in successful compilation.
7
+ //
8
+ // See <https://github.com/rust-lang/rust/pull/16505>.
10
9
11
10
//@ ignore-cross-compile
12
11
//@ needs-symlink
@@ -16,7 +15,26 @@ use run_make_support::{cwd, rfs, rustc};
16
15
fn main ( ) {
17
16
rustc ( ) . input ( "foo.rs" ) . run ( ) ;
18
17
rfs:: create_dir_all ( "other" ) ;
19
- rfs:: create_symlink ( "libfoo.rlib" , "other" ) ;
18
+ #[ cfg( unix) ]
19
+ {
20
+ rfs:: unix:: symlink ( cwd ( ) . join ( "libfoo.rlib" ) , cwd ( ) . join ( "other" ) . join ( "libfoo.rlib" ) ) ;
21
+ }
22
+ #[ cfg( windows) ]
23
+ {
24
+ rfs:: windows:: symlink_file (
25
+ cwd ( ) . join ( "libfoo.rlib" ) ,
26
+ cwd ( ) . join ( "other" ) . join ( "libfoo.rlib" ) ,
27
+ ) ;
28
+ }
29
+ #[ cfg( not( any( unix, windows) ) ) ]
30
+ {
31
+ // FIXME(jieyouxu): this is not supported, but we really should implement a only-* directive
32
+ // that accepts multiple targets, like e.g. `//@ only-target-families: unix, windows`. That
33
+ // way, it properly shows up as an ignored test instead of silently passing.
34
+ return ;
35
+ }
36
+
20
37
rustc ( ) . input ( "bar.rs" ) . library_search_path ( cwd ( ) ) . run ( ) ;
21
- rustc ( ) . input ( "baz.rs" ) . extern_ ( "foo" , "other" ) . library_search_path ( cwd ( ) ) . run ( ) ;
38
+
39
+ rustc ( ) . input ( "baz.rs" ) . extern_ ( "foo" , "other/libfoo.rlib" ) . library_search_path ( cwd ( ) ) . run ( ) ;
22
40
}
0 commit comments