-
Notifications
You must be signed in to change notification settings - Fork 377
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
Better error diagnostics on targets without std. #899
Conversation
An example of the new error diagnostics is as follows. We can't remove the If we have an unknown target, we get: $ cross build --target x86_64-unknown-dragonfly1
[cross] note: Falling back to `cargo` on the host.
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names --target x86_64-unknown-dragonfly1 --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit status: 1)
--- stderr
error: Error loading target specification: Could not find specification for target "x86_64-unknown-dragonfly1". Run `rustc --print target-list` for a list of built-in targets And if the component is installed but does not support the standard library, we get: $ cross build --target thumbv6m-none-eabi
Compiling hello v0.1.0 (/project)
error[E0463]: can't find crate for `std`
|
= note: the `thumbv6m-none-eabi` target may not support the standard library
= note: `std` is required by `hello` because it does not declare `#![no_std]`
error: cannot find macro `println` in this scope
--> src/main.rs:2:5
|
2 | println!("Hello, world!");
| ^^^^^^^
error: `#[panic_handler]` function required, but not found
For more information about this error, try `rustc --explain E0463`.
error: could not compile `hello` due to 3 previous errors |
13eaa91
to
f596040
Compare
I'm not sure this is the correct approach, specifically the wording. If I don't require libstd this message would still always be shown on err. |
We could specific to use |
In addition, what about making component_is_installed returning an enum (or |
aa6d15d
to
f65965c
Compare
6a04ae5
to
b2848a3
Compare
b2848a3
to
8787f0a
Compare
Provides a warning if a docker command fails and `rust-std` is not available for the target. For example, for `x86_64-unknown-dragonfly`, the added output would be: ```bash [cross] warning: rust-std is not available for x86_64-unknown-dragonfly [cross] note: you may need to build components for the target via `-Z build-std=<components>` or in your cross configuration specify `target.x86_64-unknown-dragonfly.build-std` the available components are core, std, alloc, and proc_macro ``` This is done solely if the command fails and if the target is a built-in, so we don't get misleading warnings for custom targets, and there is no overhead if the build succeeds.
8787f0a
to
10b0eb1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
Build succeeded: |
Provides a warning if a docker command fails and
rust-std
is not available for the target. For example, forx86_64-unknown-dragonfly
, the added output would be:This is done solely if the command fails and if the target is a built-in, so we don't get misleading warnings for custom targets, and there is no overhead if the build succeeds.
Closes #94.
Closes #167.