Skip to content

Allowing unstable features on any nightly Rust version is a time bomb that will break crates #24

@kornelski

Description

@kornelski

version_check/src/lib.rs

Lines 349 to 351 in d77ef9f

// If there are no `RUSTFLAGS` or `CARGO_ENCODED_RUSTFLAGS` or they don't
// contain an `allow-features` flag, assume compiler allows all features.
Some(true)

By default Cargo does not pass any rustflags. These env vars are for users' extra flags, and don't include the usual flags used when compiling, so de-facto there's no filtering, and version_check naively allows any feature flag on any (edit: nightly) Rust version.

Rust renames, removes, or stabilizes nightly flags without warning. Crates checking for flags using version_check will sooner or later end up breaking the build by using flags that may no longer exist.

This check needs to be more robust. At least try compiling a file with #![feature(…)] in it to check if it still exists.

Metadata

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