Skip to main content

NO_LINK_ATTRIBUTES

Static NO_LINK_ATTRIBUTES 

Source
pub static NO_LINK_ATTRIBUTES: &Lint
Expand description

The no_link_attributes lint detects that you used #[no_link] on an extern crate item.

§Example

ⓘ
 #[no_link]
 extern crate std;

{{produces}}

§Explanation

This is a pre-1.0 attribute that accidentally got stabilized. It was only meant for compiler plugins which we no longer support, not for regular crates. It is rather fragile and can easily lead to linker errors depending on where rustc decides to codegen functions and statics, which varies between rustc versions. It might also be unsound if a crate for example expects a global constructor it defined to run. Using it doesn’t have an effect on the size of the produced binaries except when it defines a #[used] static given that we remove all unused functions and statics at link time already.