]>
Commit | Line | Data |
---|---|---|
e1599b0c | 1 | syntax::register_diagnostics! { |
92a42be0 SL |
2 | E0454: r##" |
3 | A link name was given with an empty name. Erroneous code example: | |
4 | ||
94b46f34 | 5 | ```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) |
416331ca XL |
6 | #[link(name = "")] extern {} |
7 | // error: `#[link(name = "")]` given with empty name | |
92a42be0 SL |
8 | ``` |
9 | ||
10 | The rust compiler cannot link to an external library if you don't give it its | |
11 | name. Example: | |
12 | ||
041b39d2 | 13 | ```no_run |
92a42be0 SL |
14 | #[link(name = "some_lib")] extern {} // ok! |
15 | ``` | |
16 | "##, | |
17 | ||
a7813a04 | 18 | E0455: r##" |
cc61c64b | 19 | Linking with `kind=framework` is only supported when targeting macOS, |
a7813a04 XL |
20 | as frameworks are specific to that operating system. |
21 | ||
22 | Erroneous code example: | |
23 | ||
041b39d2 | 24 | ```ignore (should-compile_fail-but-cannot-doctest-conditionally-without-macos) |
9e0c209e | 25 | #[link(name = "FooCoreServices", kind = "framework")] extern {} |
a7813a04 XL |
26 | // OS used to compile is Linux for example |
27 | ``` | |
28 | ||
29 | To solve this error you can use conditional compilation: | |
30 | ||
31 | ``` | |
32 | #[cfg_attr(target="macos", link(name = "FooCoreServices", kind = "framework"))] | |
33 | extern {} | |
34 | ``` | |
35 | ||
041b39d2 | 36 | See more: |
9fa01778 | 37 | https://doc.rust-lang.org/reference/attributes.html#conditional-compilation |
a7813a04 XL |
38 | "##, |
39 | ||
92a42be0 SL |
40 | E0458: r##" |
41 | An unknown "kind" was specified for a link attribute. Erroneous code example: | |
42 | ||
94b46f34 | 43 | ```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) |
92a42be0 SL |
44 | #[link(kind = "wonderful_unicorn")] extern {} |
45 | // error: unknown kind: `wonderful_unicorn` | |
46 | ``` | |
47 | ||
48 | Please specify a valid "kind" value, from one of the following: | |
476ff2be | 49 | |
32a655c1 SL |
50 | * static |
51 | * dylib | |
52 | * framework | |
476ff2be | 53 | |
92a42be0 SL |
54 | "##, |
55 | ||
56 | E0459: r##" | |
57 | A link was used without a name parameter. Erroneous code example: | |
58 | ||
94b46f34 | 59 | ```ignore (cannot-test-this-because-rustdoc-stops-compile-fail-before-codegen) |
92a42be0 | 60 | #[link(kind = "dylib")] extern {} |
416331ca | 61 | // error: `#[link(...)]` specified without `name = "foo"` |
92a42be0 SL |
62 | ``` |
63 | ||
64 | Please add the name parameter to allow the rust compiler to find the library | |
65 | you want. Example: | |
66 | ||
041b39d2 | 67 | ```no_run |
92a42be0 SL |
68 | #[link(kind = "dylib", name = "some_lib")] extern {} // ok! |
69 | ``` | |
70 | "##, | |
71 | ||
9cc50fc6 SL |
72 | E0463: r##" |
73 | A plugin/crate was declared but cannot be found. Erroneous code example: | |
74 | ||
9e0c209e | 75 | ```compile_fail,E0463 |
9cc50fc6 SL |
76 | #![feature(plugin)] |
77 | #![plugin(cookie_monster)] // error: can't find crate for `cookie_monster` | |
78 | extern crate cake_is_a_lie; // error: can't find crate for `cake_is_a_lie` | |
79 | ``` | |
80 | ||
81 | You need to link your code to the relevant crate in order to be able to use it | |
82 | (through Cargo or the `-L` option of rustc example). Plugins are crates as | |
83 | well, and you link to them the same way. | |
84 | "##, | |
e1599b0c | 85 | ; |
92a42be0 SL |
86 | E0456, // plugin `..` is not available for triple `..` |
87 | E0457, // plugin `..` only found in rlib format, but must be available... | |
88 | E0514, // metadata version mismatch | |
89 | E0460, // found possibly newer version of crate `..` | |
90 | E0461, // couldn't find crate `..` with expected target triple .. | |
91 | E0462, // found staticlib `..` instead of rlib or dylib | |
92a42be0 SL |
92 | E0464, // multiple matching crates for `..` |
93 | E0465, // multiple .. candidates for `..` found | |
54a0048b | 94 | E0519, // local crate and dependency have same (crate-name, disambiguator) |
e1599b0c XL |
95 | // two dependencies have same (crate-name, disambiguator) but different SVH |
96 | E0523, | |
92a42be0 | 97 | } |