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``
This commit is contained in:
32
compiler/rustc_error_codes/src/error_codes/E0462.md
Normal file
32
compiler/rustc_error_codes/src/error_codes/E0462.md
Normal file
@@ -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.
|
||||
Reference in New Issue
Block a user