Skip to content

Move cfg!(target_feature) directly into is_*_feature_detected!() #1135

Closed
@bjorn3

Description

@bjorn3

pub mod __is_feature_detected {
$(
/// PLEASE: do not use this, it is an implementation detail
/// subject to change.
#[inline]
#[doc(hidden)]
#[$stability_attr]
pub fn $feature() -> bool {
cfg!(target_feature = $feature_lit) ||
$crate::detect::check_for($crate::detect::Feature::$feature)
}
)*
}

It is currently part of a function inside the __is_feature_detected module of std_detect, which means that it uses the value of the target feature when compiling libstd instead of the target crate, making -Ctarget-cpu/-Ctarget-feature in RUSTFLAGS ineffective at optimizing the runtime detection away.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions