Skip to content

Commit

Permalink
impl PartialEq<Punct> for char; symmetry for rust-lang#78636
Browse files Browse the repository at this point in the history
Also fixes the "since" version of the original.
  • Loading branch information
pthariensflame committed Feb 20, 2021
1 parent 9b471a3 commit 1839748
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion library/proc_macro/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<char> 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<Punct> 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")]
Expand Down

0 comments on commit 1839748

Please sign in to comment.