Skip to content

Provide a better error message when the target sysroot is not installed #37131

Closed
@brson

Description

@brson

Today when you compile for a target that does not exist rustc gives the standard message for failing to find a crate, for std. We can and should be more explicit about what this means. Actually what is almost certainly happening is that you don't have that target installed:

$ rustc --target=asmjs-unknown-emscripten hello.rs
error[E0463]: can't find crate for `std`

error: aborting due to previous error 

It could instead say:

$ rustc --target=asmjs-unknown-emscripten hello.rs
error[E0463]: can't find crate for `std`
note: the `asmjs-unknown-emscripten` target is not installed

error: aborting due to previous error 

A reasonable heuristic for printing this might be if the crate is named std or core and the sysroot is not overridden.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions