Skip to content

Are you open to de-duplicating the build.rs build probe code? #359

Open
@RalfJung

Description

Doing build probes in build.rs is hard to get right. It's easy to make the common case work, but it's just as easy to forget about properly handling --target (#249) or RUSTC_WRAPPER (also #249), new relevant flags get added every now and then (#358) and then when the crate becomes a dependency of rustc itself things may still break (#320). Meanwhile, both anyhow, thiserror and proc-macro2 have copies of basically the same build probe logic, so every time there is an issue it needs to be fixed in all of these crates. I'm kind of tired of having to go around and debug build probe issues, so it'd be really great if there was one shared crate for build probes where fixes have to be done only once, and which we can easily test in CI of tools that tend to run into issues like this (such as Miri).

autocfg could be such a crate, it has pretty well-tested build probe logic and is checked on Miri CI. If cuviper/autocfg#24 were resolved, it could be used by anyhow, thiserror and proc-macro2. autocfg does not have any dependencies and works on every stable Rust version since 1.0.

@dtolnay would you be open to taking autocfg as a dependency for build probe logic, should cuviper/autocfg#24 get resolved?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions