]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0457.md
Rollup merge of #107086 - clubby789:bootstrap-lock-pid-linux, r=albertlarsan68
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0457.md
1 Plugin `..` only found in rlib format, but must be available in dylib format.
2
3 Erroronous code example:
4
5 `rlib-plugin.rs`
6 ```ignore (needs-linkage-with-other-tests)
7 #![crate_type = "rlib"]
8 #![feature(rustc_private)]
9
10 extern crate rustc_middle;
11 extern crate rustc_driver;
12
13 use rustc_driver::plugin::Registry;
14
15 #[no_mangle]
16 fn __rustc_plugin_registrar(_: &mut Registry) {}
17 ```
18
19 `main.rs`
20 ```ignore (needs-linkage-with-other-tests)
21 #![feature(plugin)]
22 #![plugin(rlib_plugin)] // error: plugin `rlib_plugin` only found in rlib
23                         //        format, but must be available in dylib
24
25 fn main() {}
26 ```
27
28 The compiler exposes a plugin interface to allow altering the compile process
29 (adding lints, etc). Plugins must be defined in their own crates (similar to
30 [proc-macro](../reference/procedural-macros.html) isolation) and then compiled
31 and linked to another crate. Plugin crates *must* be compiled to the
32 dynamically-linked dylib format, and not the statically-linked rlib format.
33 Learn more about different output types in
34 [this section](../reference/linkage.html) of the Rust reference.
35
36 This error is easily fixed by recompiling the plugin crate in the dylib format.