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