File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -842,6 +842,13 @@ impl fmt::Debug for Punct {
842842 }
843843}
844844
845+ #[ stable( feature = "proc_macro_punct_eq" , since = "1.49.0" ) ]
846+ impl PartialEq < char > for Punct {
847+ fn eq ( & self , rhs : & char ) -> bool {
848+ self . as_char ( ) == * rhs
849+ }
850+ }
851+
845852/// An identifier (`ident`).
846853#[ derive( Clone ) ]
847854#[ stable( feature = "proc_macro_lib2" , since = "1.29.0" ) ]
Original file line number Diff line number Diff line change 11#![ feature( proc_macro_span) ]
22
3- use proc_macro:: LineColumn ;
3+ use proc_macro:: { LineColumn , Punct } ;
44
55#[ test]
66fn test_line_column_ord ( ) {
@@ -10,3 +10,11 @@ fn test_line_column_ord() {
1010 assert ! ( line0_column0 < line0_column1) ;
1111 assert ! ( line0_column1 < line1_column0) ;
1212}
13+
14+ #[ test]
15+ fn test_punct_eq ( ) {
16+ // Good enough if it typechecks, since proc_macro::Punct can't exist in a test.
17+ fn _check ( punct : Punct ) {
18+ let _ = punct == ':' ;
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments