Skip to content

Commit dc1f2be

Browse files
committed
Add comments to -Zlink-* tests
1 parent 7d5ff8b commit dc1f2be

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

Diff for: tests/ui/link-native-libs/issue-70093/link-directives.rs

+5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
// Ensure that `#[link]` attributes are entirely ignore when using `-Zlink-directives=no`.
2+
13
//@ run-pass
24
//@ compile-flags: -Zlink-directives=no
35
//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733)
46
//@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling
57

8+
// Usually these `#[link]` attribute would cause `libsome-random-non-existent-library`
9+
// to be passed to the linker, causing it to fail because the file doesn't exist.
10+
// However, with -Zlink-directives=no, the `#[link]` is ignored.
611
#[link(name = "some-random-non-existent-library", kind = "static")]
712
extern "C" {}
813

Diff for: tests/ui/link-native-libs/issue-70093/link-native-libraries.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// Ensure that rust does not pass native libraries to the linker when
2+
// `-Zlink-native-libraries=no` is used.
3+
14
//@ run-pass
25
//@ compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes
36
//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733)
@@ -14,6 +17,9 @@
1417
//@[msvc] compile-flags: -Clink-arg=msvcrt.lib
1518
//@[msvc] only-msvc
1619

20+
// Usually these `#[link]` attribute would cause `libsome-random-non-existent-library`
21+
// to be passed to the linker, causing it to fail because the file doesn't exist.
22+
// However, -Zlink-native-libraries=no disables that.
1723
#[link(name = "some-random-non-existent-library", kind = "static")]
1824
extern "C" {}
1925

0 commit comments

Comments
 (0)