From 4ca6342eb30dfbc3fe0992de0cfc780f3992f446 Mon Sep 17 00:00:00 2001 From: clubby789 Date: Sun, 14 Jan 2024 00:24:39 +0000 Subject: [PATCH] Add note on SpecOptionPartialEq to `newtype_index` --- compiler/rustc_index_macros/src/lib.rs | 3 +++ library/core/src/option.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/compiler/rustc_index_macros/src/lib.rs b/compiler/rustc_index_macros/src/lib.rs index ac374a41eb6..4f973c1f010 100644 --- a/compiler/rustc_index_macros/src/lib.rs +++ b/compiler/rustc_index_macros/src/lib.rs @@ -31,6 +31,9 @@ mod newtype; /// - `#[max = 0xFFFF_FFFD]`: specifies the max value, which allows niche /// optimizations. The default max value is 0xFFFF_FF00. /// - `#[gate_rustc_only]`: makes parts of the generated code nightly-only. +/// +/// `SpecOptionPartialEq` is specialized by this macro, so using it requires enabling +/// `#![feature(min_specialization)]` for the crate. #[proc_macro] #[cfg_attr( feature = "nightly", diff --git a/library/core/src/option.rs b/library/core/src/option.rs index ff435349249..781c7a91a5a 100644 --- a/library/core/src/option.rs +++ b/library/core/src/option.rs @@ -2147,6 +2147,7 @@ impl PartialEq for Option { /// /// Once that's fixed, `Option` should go back to deriving `PartialEq`, as /// it used to do before . +/// The comment regarding this trait on the `newtype_index` macro should be removed if this is done. #[unstable(feature = "spec_option_partial_eq", issue = "none", reason = "exposed only for rustc")] #[doc(hidden)] pub trait SpecOptionPartialEq: Sized {