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