-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add long error docs for E0460
and E0457
#105860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
Plugin `..` only found in rlib format, but must be available in dylib format. | ||
|
||
Erroronous code example: | ||
|
||
`rlib-plugin.rs` | ||
```ignore (needs-linkage-with-other-tests) | ||
#![crate_type = "rlib"] | ||
#![feature(rustc_private)] | ||
|
||
extern crate rustc_middle; | ||
extern crate rustc_driver; | ||
|
||
use rustc_driver::plugin::Registry; | ||
|
||
#[no_mangle] | ||
fn __rustc_plugin_registrar(_: &mut Registry) {} | ||
``` | ||
|
||
`main.rs` | ||
```ignore (needs-linkage-with-other-tests) | ||
#![feature(plugin)] | ||
#![plugin(rlib_plugin)] // error: plugin `rlib_plugin` only found in rlib | ||
// format, but must be available in dylib | ||
|
||
fn main() {} | ||
``` | ||
|
||
The compiler exposes a plugin interface to allow altering the compile process | ||
(adding lints, etc). Plugins must be defined in their own crates (similar to | ||
[proc-macro](../reference/procedural-macros.html) isolation) and then compiled | ||
and linked to another crate. Plugin crates *must* be compiled to the | ||
dynamically-linked dylib format, and not the statically-linked rlib format. | ||
Learn more about different output types in | ||
[this section](../reference/linkage.html) of the Rust reference. | ||
|
||
This error is easily fixed by recompiling the plugin crate in the dylib format. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
Found possibly newer version of crate `..` which `..` depends on. | ||
|
||
Consider these erroneous files: | ||
|
||
`a1.rs` | ||
```ignore (needs-linkage-with-other-tests) | ||
#![crate_name = "a"] | ||
|
||
pub fn foo<T>() {} | ||
``` | ||
|
||
`a2.rs` | ||
```ignore (needs-linkage-with-other-tests) | ||
#![crate_name = "a"] | ||
|
||
pub fn foo<T>() { | ||
println!("foo<T>()"); | ||
} | ||
``` | ||
|
||
`b.rs` | ||
```ignore (needs-linkage-with-other-tests) | ||
#![crate_name = "b"] | ||
|
||
extern crate a; // linked with `a1.rs` | ||
|
||
pub fn foo() { | ||
a::foo::<isize>(); | ||
} | ||
``` | ||
|
||
`main.rs` | ||
```ignore (needs-linkage-with-other-tests) | ||
extern crate a; // linked with `a2.rs` | ||
extern crate b; // error: found possibly newer version of crate `a` which `b` | ||
// depends on | ||
|
||
fn main() {} | ||
``` | ||
|
||
The dependency graph of this program can be represented as follows: | ||
```text | ||
crate `main` | ||
| | ||
+-------------+ | ||
| | | ||
| v | ||
depends: | crate `b` | ||
`a` v1 | | | ||
| | depends: | ||
| | `a` v2 | ||
v | | ||
crate `a` <------+ | ||
``` | ||
|
||
Crate `main` depends on crate `a` (version 1) and crate `b` which in turn | ||
depends on crate `a` (version 2); this discrepancy in versions cannot be | ||
reconciled. This difference in versions typically occurs when one crate is | ||
compiled and linked, then updated and linked to another crate. The crate | ||
"version" is a SVH (Strict Version Hash) of the crate in an | ||
implementation-specific way. Note that this error can *only* occur when | ||
directly compiling and linking with `rustc`; [Cargo] automatically resolves | ||
dependencies, without using the compiler's own dependency management that | ||
causes this issue. | ||
|
||
This error can be fixed by: | ||
* Using [Cargo], the Rust package manager, automatically fixing this issue. | ||
* Recompiling crate `a` so that both crate `b` and `main` have a uniform | ||
version to depend on. | ||
|
||
[Cargo]: ../cargo/index.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.