Skip to content

Possibly add a way to disable sysroot on rustc #31

Open
rust-lang/cargo
#7421
@ehuss

Description

@ehuss

The current implementation uses --extern flags to tell rustc where the standard library dependencies are located. This runs into a few problems when a user attempts to use extern crate for a crate that was not included. For example, a no_std crate that has extern std, or an extern crate test when libtest is not built. These will attempt to load from the default sysroot which causes a huge number of inscrutable errors.

It may be nice to tell rustc to not look in the pre-built sysroot to avoid this problem (and will result in a nicer "crate not found" error). This can be done with --sysroot=nonexistent or an empty directory. Alternatively, we can add a new flag to rustc to disable the sysroot search.

This may have complications, since the sysroot is used for more than rlib dependencies. For example, it is also used for bundled things (like linkers? bundled crt objects?).

Beware this may affect things like clippy-driver, rustdoc, etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-needs-designStatus: needs design workimplementationImplementation exploration and tracking issuesstabilization blockerThis needs a resolution before stabilization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions