Skip to content

Commit e624363

Browse files
authored
Rollup merge of #74064 - RalfJung:variant-count-bootstrap, r=kennytm
variant_count: avoid incorrect dummy implementation This also avoids a stage 0 doctest failure.
2 parents b4710bd + 9cb1ffd commit e624363

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

src/libcore/intrinsics.rs

-6
Original file line numberDiff line numberDiff line change
@@ -2004,12 +2004,6 @@ extern "rust-intrinsic" {
20042004
pub fn ptr_guaranteed_ne<T>(ptr: *const T, other: *const T) -> bool;
20052005
}
20062006

2007-
#[rustc_const_unstable(feature = "variant_count", issue = "73662")]
2008-
#[cfg(bootstrap)]
2009-
pub const fn variant_count<T>() -> usize {
2010-
0
2011-
}
2012-
20132007
// Some functions are defined here because they accidentally got made
20142008
// available in this module on stable. See <https://github.com/rust-lang/rust/issues/15702>.
20152009
// (`transmute` also falls into this category, but it cannot be wrapped due to the

src/libcore/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
#![feature(unsized_locals)]
126126
#![feature(untagged_unions)]
127127
#![feature(unwind_attributes)]
128-
#![feature(variant_count)]
128+
#![cfg_attr(not(bootstrap), feature(variant_count))]
129129
#![feature(doc_alias)]
130130
#![feature(mmx_target_feature)]
131131
#![feature(tbm_target_feature)]

src/libcore/mem/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1037,6 +1037,7 @@ pub const fn discriminant<T>(v: &T) -> Discriminant<T> {
10371037
/// assert_eq!(mem::variant_count::<Result<!, !>>(), 2);
10381038
/// ```
10391039
#[inline(always)]
1040+
#[cfg(not(bootstrap))]
10401041
#[unstable(feature = "variant_count", issue = "73662")]
10411042
#[rustc_const_unstable(feature = "variant_count", issue = "73662")]
10421043
pub const fn variant_count<T>() -> usize {

0 commit comments

Comments
 (0)