Skip to content

Commit

Permalink
Rollup merge of rust-lang#74064 - RalfJung:variant-count-bootstrap, r…
Browse files Browse the repository at this point in the history
…=kennytm

variant_count: avoid incorrect dummy implementation

This also avoids a stage 0 doctest failure.
  • Loading branch information
Manishearth authored Jul 5, 2020
2 parents b4710bd + 9cb1ffd commit e624363
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
6 changes: 0 additions & 6 deletions src/libcore/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
1 change: 1 addition & 0 deletions src/libcore/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e624363

Please sign in to comment.