diff options
| author | Ralf Jung <post@ralfj.de> | 2020-07-05 18:12:21 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-07-05 18:12:21 +0200 |
| commit | 9cb1ffdd4fc372b18258b1bb12c55fd3c53d33f4 (patch) | |
| tree | f5f3c9525f89d9beb4cecee80a9bc4a757afff1d | |
| parent | 0cd7ff7ddfb75a38dca81ad3e76b1e984129e939 (diff) | |
| download | rust-9cb1ffdd4fc372b18258b1bb12c55fd3c53d33f4.tar.gz rust-9cb1ffdd4fc372b18258b1bb12c55fd3c53d33f4.zip | |
variant_count: avoid incorrect dummy implementation
| -rw-r--r-- | src/libcore/intrinsics.rs | 6 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 2 | ||||
| -rw-r--r-- | src/libcore/mem/mod.rs | 1 |
3 files changed, 2 insertions, 7 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index aff4e4a8d98..b3e43cd7994 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -2004,12 +2004,6 @@ extern "rust-intrinsic" { pub fn ptr_guaranteed_ne<T>(ptr: *const T, other: *const T) -> bool; } -#[rustc_const_unstable(feature = "variant_count", issue = "73662")] -#[cfg(bootstrap)] -pub const fn variant_count<T>() -> usize { - 0 -} - // Some functions are defined here because they accidentally got made // available in this module on stable. See <https://github.com/rust-lang/rust/issues/15702>. // (`transmute` also falls into this category, but it cannot be wrapped due to the diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 50c56434fa9..692d91bd61d 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -125,7 +125,7 @@ #![feature(unsized_locals)] #![feature(untagged_unions)] #![feature(unwind_attributes)] -#![feature(variant_count)] +#![cfg_attr(not(bootstrap), feature(variant_count))] #![feature(doc_alias)] #![feature(mmx_target_feature)] #![feature(tbm_target_feature)] diff --git a/src/libcore/mem/mod.rs b/src/libcore/mem/mod.rs index 272088815ec..0a976a4ca00 100644 --- a/src/libcore/mem/mod.rs +++ b/src/libcore/mem/mod.rs @@ -1037,6 +1037,7 @@ pub const fn discriminant<T>(v: &T) -> Discriminant<T> { /// assert_eq!(mem::variant_count::<Result<!, !>>(), 2); /// ``` #[inline(always)] +#[cfg(not(bootstrap))] #[unstable(feature = "variant_count", issue = "73662")] #[rustc_const_unstable(feature = "variant_count", issue = "73662")] pub const fn variant_count<T>() -> usize { |
