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