Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling feature does not allow using unstable feature on nightly #58026

Closed
gnzlbg opened this issue Jan 31, 2019 · 2 comments
Closed

Enabling feature does not allow using unstable feature on nightly #58026

gnzlbg opened this issue Jan 31, 2019 · 2 comments
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc.

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Jan 31, 2019

See https://github.com/gnzlbg/test_detect (to reproduce run cargo test with nightly).

#![unstable(feature = "stdsimd", issue = "27731")]
#![feature(staged_api)]

#[stable(feature = "simd_x86", since = "1.27.0")]
#[macro_export]
macro_rules! is_x86_feature_detected {
    ("foo") => { $crate::check($crate::Feature::foo) };
    ("bar") => { $crate::check($crate::Feature::bar) };
}

#[allow(non_camel_case_types)]
#[repr(u8)]
#[doc(hidden)]
#[stable(feature = "simd_x86", since = "1.27.0")]
// #[unstable(feature = "stdsimd_internal", issue = "0")]
pub enum Feature {
    #[stable(feature = "simd_x86", since = "1.27.0")] foo,
    #[unstable(feature = "mmx_target_feature", issue = "44839")] bar,
}

#[stable(feature = "simd_x86", since = "1.27.0")]
pub fn check(_: Feature) -> bool { true }

/// Check that MMX fails without features
///
/// ```rust,compile_fail
/// #![feature(stdsimd)]
/// #[macro_use(is_x86_feature_detected)]
/// extern crate test_detect;
///
/// fn main() {
///    let _ = is_x86_feature_detected!("bar");
/// }
/// ```
#[unstable(feature = "mmx_target_feature", issue = "44839")]
#[allow(dead_code)]
fn mmx_fails() {}

/// Check that MMX passes when the feature is enabled
///
/// ```rust
/// #![feature(stdsimd, mmx_target_feature)]
/// #[macro_use(is_x86_feature_detected)]
/// extern crate test_detect;
///
/// fn main() {
///    let _ = is_x86_feature_detected!("bar");
/// }
/// ```
#[unstable(feature = "mmx_target_feature", issue = "44839")]
#[allow(dead_code)]
fn mmx_passes() {}


/// Check that MMX passes when variant without features is uses
///
/// ```rust
/// #![feature(stdsimd)]
/// #[macro_use(is_x86_feature_detected)]
/// extern crate test_detect;
///
/// fn main() {
///    let _ = is_x86_feature_detected!("foo");
/// }
/// ```
#[unstable(feature = "mmx_target_feature", issue = "44839")]
#[allow(dead_code)]
fn mmx_passes2() {}

The mmx_passes doc test has the feature(mmx_target_feature) enabled, yet it still fails with:

Use of unstable library feature 'mmx_target_feature' (see issue #44839)
@Centril Centril added the A-stability Area: `#[stable]`, `#[unstable]` etc. label Jan 31, 2019
@workingjubilee
Copy link
Member

workingjubilee commented Feb 9, 2021

No repro, these tests appear to pass without issue today.

~/projects/test_detect$ rustc --version --verbose
rustc 1.52.0-nightly (0fc6756b4 2021-02-08)
binary: rustc
commit-hash: 0fc6756b42e0556cc2e18079f5fc6b4d58f4e81a
commit-date: 2021-02-08
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 11.0.1

Possibly related to the MMX removal, or possibly #76842?

@Enselic
Copy link
Member

Enselic commented Dec 17, 2023

Triage: Closing as obsolete as per comment above.

@Enselic Enselic closed this as not planned Won't fix, can't repro, duplicate, stale Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stability Area: `#[stable]`, `#[unstable]` etc.
Projects
None yet
Development

No branches or pull requests

4 participants