about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-24 00:31:40 +0100
committerGitHub <noreply@github.com>2022-12-24 00:31:40 +0100
commite08dd9d998a697a8da791ee183db468e4de7aa72 (patch)
tree0cac13d412d159151d28a223f1e435b4d2630919 /compiler
parentaf3e06f1bf4ca49407562b1b84744e27905bea98 (diff)
parent66ed1812cfaf3c7dd47643140f8e1380204f7234 (diff)
downloadrust-e08dd9d998a697a8da791ee183db468e4de7aa72.tar.gz
rust-e08dd9d998a697a8da791ee183db468e4de7aa72.zip
Rollup merge of #105970 - Ezrashaw:add-docs+test-e0462, r=GuillaumeGomez
docs/test: add UI test and long-form error docs for E0462

Another UI test/ docs combo.

r? ``@GuillaumeGomez``
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_error_codes/src/error_codes.rs2
-rw-r--r--compiler/rustc_error_codes/src/error_codes/E0462.md32
2 files changed, 33 insertions, 1 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs
index 276f83f1f23..d05559e9244 100644
--- a/compiler/rustc_error_codes/src/error_codes.rs
+++ b/compiler/rustc_error_codes/src/error_codes.rs
@@ -244,6 +244,7 @@ E0457: include_str!("./error_codes/E0457.md"),
 E0458: include_str!("./error_codes/E0458.md"),
 E0459: include_str!("./error_codes/E0459.md"),
 E0460: include_str!("./error_codes/E0460.md"),
+E0462: include_str!("./error_codes/E0462.md"),
 E0463: include_str!("./error_codes/E0463.md"),
 E0464: include_str!("./error_codes/E0464.md"),
 E0466: include_str!("./error_codes/E0466.md"),
@@ -595,7 +596,6 @@ E0791: include_str!("./error_codes/E0791.md"),
 //  E0427, // merged into 530
 //  E0456, // plugin `..` is not available for triple `..`
     E0461, // couldn't find crate `..` with expected target triple ..
-    E0462, // found staticlib `..` instead of rlib or dylib
     E0465, // multiple .. candidates for `..` found
 //  E0467, // removed
 //  E0470, // removed
diff --git a/compiler/rustc_error_codes/src/error_codes/E0462.md b/compiler/rustc_error_codes/src/error_codes/E0462.md
new file mode 100644
index 00000000000..4509cc6fad2
--- /dev/null
+++ b/compiler/rustc_error_codes/src/error_codes/E0462.md
@@ -0,0 +1,32 @@
+Found `staticlib` `..` instead of `rlib` or `dylib`.
+
+Consider the following two files:
+
+`a.rs`
+```ignore (cannot-link-with-other-tests)
+#![crate_type = "staticlib"]
+
+fn foo() {}
+```
+
+`main.rs`
+```ignore (cannot-link-with-other-tests)
+extern crate a;
+
+fn main() {
+    a::foo();
+}
+```
+
+Crate `a` is compiled as a `staticlib`. A `staticlib` is a system-dependant
+library only intended for linking with non-Rust applications (C programs). Note
+that `staticlib`s include all upstream dependencies (`core`, `std`, other user
+dependencies, etc) which makes them significantly larger than `dylib`s:
+prefer `staticlib` for linking with C programs. Learn more about different
+`crate_type`s in [this section of the Reference](../reference/linkage.html).
+
+This error can be fixed by:
+ * Using [Cargo](../cargo/index.html), the Rust package manager, automatically
+   fixing this issue.
+ * Recompiling the crate as a `rlib` or `dylib`; formats suitable for Rust
+   linking.