Skip to content

Commit 540c3f4

Browse files
committed
docs: add long-form error-code docs for E0457
1 parent 7e66d45 commit 540c3f4

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ E0452: include_str!("./error_codes/E0452.md"),
239239
E0453: include_str!("./error_codes/E0453.md"),
240240
E0454: include_str!("./error_codes/E0454.md"),
241241
E0455: include_str!("./error_codes/E0455.md"),
242+
E0457: include_str!("./error_codes/E0457.md"),
242243
E0458: include_str!("./error_codes/E0458.md"),
243244
E0459: include_str!("./error_codes/E0459.md"),
244245
E0460: include_str!("./error_codes/E0460.md"),
@@ -593,7 +594,6 @@ E0791: include_str!("./error_codes/E0791.md"),
593594
// E0421, // merged into 531
594595
// E0427, // merged into 530
595596
// E0456, // plugin `..` is not available for triple `..`
596-
E0457, // plugin `..` only found in rlib format, but must be available...
597597
E0461, // couldn't find crate `..` with expected target triple ..
598598
E0462, // found staticlib `..` instead of rlib or dylib
599599
E0465, // multiple .. candidates for `..` found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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.

src/test/ui-fulldeps/macro-crate-rlib.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ LL | #![plugin(rlib_crate_test)]
66

77
error: aborting due to previous error
88

9+
For more information about this error, try `rustc --explain E0457`.

0 commit comments

Comments
 (0)