]>
Commit | Line | Data |
---|---|---|
ed00b5ec FG |
1 | #### Note: this error code is no longer emitted by the compiler` |
2 | ||
9c376795 FG |
3 | Plugin `..` only found in rlib format, but must be available in dylib format. |
4 | ||
49aad941 | 5 | Erroneous code example: |
9c376795 FG |
6 | |
7 | `rlib-plugin.rs` | |
8 | ```ignore (needs-linkage-with-other-tests) | |
9 | #![crate_type = "rlib"] | |
10 | #![feature(rustc_private)] | |
11 | ||
12 | extern crate rustc_middle; | |
13 | extern crate rustc_driver; | |
14 | ||
15 | use rustc_driver::plugin::Registry; | |
16 | ||
17 | #[no_mangle] | |
18 | fn __rustc_plugin_registrar(_: &mut Registry) {} | |
19 | ``` | |
20 | ||
21 | `main.rs` | |
22 | ```ignore (needs-linkage-with-other-tests) | |
23 | #![feature(plugin)] | |
24 | #![plugin(rlib_plugin)] // error: plugin `rlib_plugin` only found in rlib | |
25 | // format, but must be available in dylib | |
26 | ||
27 | fn main() {} | |
28 | ``` | |
29 | ||
30 | The compiler exposes a plugin interface to allow altering the compile process | |
31 | (adding lints, etc). Plugins must be defined in their own crates (similar to | |
32 | [proc-macro](../reference/procedural-macros.html) isolation) and then compiled | |
33 | and linked to another crate. Plugin crates *must* be compiled to the | |
34 | dynamically-linked dylib format, and not the statically-linked rlib format. | |
35 | Learn more about different output types in | |
36 | [this section](../reference/linkage.html) of the Rust reference. | |
37 | ||
38 | This error is easily fixed by recompiling the plugin crate in the dylib format. |