about summary refs log tree commit diff
path: root/tests/ui/link-native-libs/issue-70093/link-directives.rs
blob: 1dc44c996fcd9abbf77e0e18fdcaa17b2650b2df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// 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" {}

fn main() {}