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