diff options
Diffstat (limited to '')
-rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0455.md | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0455.md b/compiler/rustc_error_codes/src/error_codes/E0455.md new file mode 100644 index 000000000..437dacaff --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0455.md @@ -0,0 +1,26 @@ +Some linking kinds are target-specific and not supported on all platforms. + +Linking with `kind=framework` is only supported when targeting macOS, +as frameworks are specific to that operating system. + +Similarly, `kind=raw-dylib` is only supported when targeting Windows-like +platforms. + +Erroneous code example: + +```ignore (should-compile_fail-but-cannot-doctest-conditionally-without-macos) +#[link(name = "FooCoreServices", kind = "framework")] extern "C" {} +// OS used to compile is Linux for example +``` + +To solve this error you can use conditional compilation: + +``` +#[cfg_attr(target="macos", link(name = "FooCoreServices", kind = "framework"))] +extern "C" {} +``` + +Learn more in the [Conditional Compilation][conditional-compilation] section +of the Reference. + +[conditional-compilation]: https://doc.rust-lang.org/reference/attributes.html#conditional-compilation |