Skip to content

Enabling one tied target feature with -Ctarget-features silently enables them all #105111

Closed
@calebzulawski

Description

@calebzulawski

I tried this code: https://rust.godbolt.org/z/bKdTe4rGb

#[cfg(target_feature = "pacg")]
compile_error!{ "pacg enabled" }

I expected to see this happen: with -Ctarget-feature=+paca I expect either an error requiring pacg to be enabled with paca, or some other diagnostic

Instead, this happened: pacg is silently enabled and the compile error is triggered. See also rust-lang/stdarch#1352 (comment)

Meta

rustc --version --verbose:

rustc 1.65.0 (897e37553 2022-11-02)
binary: rustc
commit-hash: 897e37553bba8b42751c67658967889d11ecd120
commit-date: 2022-11-02
host: x86_64-apple-darwin
release: 1.65.0
LLVM version: 15.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions