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