From 1839748772a535cd694851092aa4ccab9374492c Mon Sep 17 00:00:00 2001 From: Alexander Ronald Altman Date: Fri, 1 Jan 2021 11:40:00 -0800 Subject: [PATCH] `impl PartialEq for char`; symmetry for #78636 Also fixes the "since" version of the original. --- library/proc_macro/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/library/proc_macro/src/lib.rs b/library/proc_macro/src/lib.rs index a89e7b53e43c4..5f1f7d8cac418 100644 --- a/library/proc_macro/src/lib.rs +++ b/library/proc_macro/src/lib.rs @@ -842,13 +842,20 @@ impl fmt::Debug for Punct { } } -#[stable(feature = "proc_macro_punct_eq", since = "1.49.0")] +#[stable(feature = "proc_macro_punct_eq", since = "1.50.0")] impl PartialEq for Punct { fn eq(&self, rhs: &char) -> bool { self.as_char() == *rhs } } +#[stable(feature = "proc_macro_punct_eq_flipped", since = "1.52.0")] +impl PartialEq for char { + fn eq(&self, rhs: &Punct) -> bool { + *self == rhs.as_char() + } +} + /// An identifier (`ident`). #[derive(Clone)] #[stable(feature = "proc_macro_lib2", since = "1.29.0")]