File tree 2 files changed +16
-1
lines changed
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 {
842
842
}
843
843
}
844
844
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
+
845
852
/// An identifier (`ident`).
846
853
#[ derive( Clone ) ]
847
854
#[ stable( feature = "proc_macro_lib2" , since = "1.29.0" ) ]
Original file line number Diff line number Diff line change 1
1
#![ feature( proc_macro_span) ]
2
2
3
- use proc_macro:: LineColumn ;
3
+ use proc_macro:: { LineColumn , Punct } ;
4
4
5
5
#[ test]
6
6
fn test_line_column_ord ( ) {
@@ -10,3 +10,11 @@ fn test_line_column_ord() {
10
10
assert ! ( line0_column0 < line0_column1) ;
11
11
assert ! ( line0_column1 < line1_column0) ;
12
12
}
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