Skip to content

docs/test: add UI test and long-form error docs for E0461 #106028

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 1 commit into from
Dec 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_error_codes/src/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
E0461: include_str!("./error_codes/E0461.md"),
E0462: include_str!("./error_codes/E0462.md"),
E0463: include_str!("./error_codes/E0463.md"),
E0464: include_str!("./error_codes/E0464.md"),
Expand Down Expand Up @@ -595,7 +596,6 @@ E0791: include_str!("./error_codes/E0791.md"),
// E0421, // merged into 531
// E0427, // merged into 530
// E0456, // plugin `..` is not available for triple `..`
E0461, // couldn't find crate `..` with expected target triple ..
E0465, // multiple .. candidates for `..` found
// E0467, // removed
// E0470, // removed
Expand Down
30 changes: 30 additions & 0 deletions compiler/rustc_error_codes/src/error_codes/E0461.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Couldn't find crate `..` with expected target triple `..`.

Example of erroneous code:

`a.rs`
```ignore (cannot-link-with-other-tests)
#![crate_type = "lib"]

fn foo() {}
```

`main.rs`
```ignore (cannot-link-with-other-tests)
extern crate a;

fn main() {
a::foo();
}
```

`a.rs` is then compiled with `--target powerpc-unknown-linux-gnu` and `b.rs`
with `--target x86_64-unknown-linux-gnu`. `a.rs` is compiled into a binary
format incompatible with `b.rs`; PowerPC and x86 are totally different
architectures. This issue also extends to any difference in target triples, as
`std` is operating-system specific.

This error can be fixed by:
* Using [Cargo](../cargo/index.html), the Rust package manager, automatically
fixing this issue.
* Recompiling either crate so that they target a consistent target triple.