Skip to content

Commit

Permalink
Add comments to -Zlink-* tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisDenton committed Dec 31, 2024
1 parent 7d5ff8b commit dc1f2be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/ui/link-native-libs/issue-70093/link-directives.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
// Ensure that `#[link]` attributes are entirely ignore when using `-Zlink-directives=no`.

//@ run-pass
//@ compile-flags: -Zlink-directives=no
//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733)
//@ ignore-cross-compile - default-linker-libraries=yes doesn't play well with cross compiling

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Ensure that rust does not pass native libraries to the linker when
// `-Zlink-native-libraries=no` is used.

//@ run-pass
//@ compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes
//@ ignore-fuchsia - missing __libc_start_main for some reason (#84733)
Expand All @@ -14,6 +17,9 @@
//@[msvc] compile-flags: -Clink-arg=msvcrt.lib
//@[msvc] only-msvc

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

Expand Down

0 comments on commit dc1f2be

Please sign in to comment.