File tree Expand file tree Collapse file tree 2 files changed +29
-7
lines changed
Expand file tree Collapse file tree 2 files changed +29
-7
lines changed Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ pub fn derive_non_exhaustive(input: TokenStream) -> TokenStream {
2222 quote ! {
2323 match :: partialdebug:: AsDebug :: as_debug( & self . #name) {
2424 None => {
25- exhaustive = false ;
25+ __exhaustive = false ;
2626 }
2727 Some ( field) => {
28- s . field( stringify!( #name) , field) ;
28+ __s . field( stringify!( #name) , field) ;
2929 }
3030 }
3131 }
@@ -34,15 +34,15 @@ pub fn derive_non_exhaustive(input: TokenStream) -> TokenStream {
3434 let expanded = quote ! {
3535 impl #impl_generics :: core:: fmt:: Debug for #name #ty_generics #where_clause{
3636 fn fmt( & self , f: & mut :: core:: fmt:: Formatter <' _>) -> :: core:: fmt:: Result {
37- let mut s = f. debug_struct( stringify!( #name) ) ;
38- let mut exhaustive = false ;
37+ let mut __s = f. debug_struct( stringify!( #name) ) ;
38+ let mut __exhaustive = false ;
3939
4040 #( #as_debug_all_fields) *
4141
4242 if exhaustive {
43- s . finish( )
43+ __s . finish( )
4444 } else {
45- s . finish_non_exhaustive( )
45+ __s . finish_non_exhaustive( )
4646 }
4747 }
4848 }
@@ -84,7 +84,7 @@ pub fn derive_placeholder(input: TokenStream) -> TokenStream {
8484 stringify!( #name) ,
8585 match :: partialdebug:: AsDebug :: as_debug( & self . #name) {
8686 None => & :: partialdebug:: Placeholder ( #placeholder_string) ,
87- Some ( field ) => field ,
87+ Some ( __field ) => __field ,
8888 } ,
8989 )
9090 }
Original file line number Diff line number Diff line change 1+ #![ no_implicit_prelude]
2+ #![ feature( debug_non_exhaustive) ]
3+ use :: partialdebug;
4+
5+ // These are required for now
6+ use :: core:: option:: Option :: * ;
7+
8+ #[ derive( partialdebug:: non_exhaustive:: PartialDebug ) ]
9+ struct NonExhaustive {
10+ field : usize ,
11+ }
12+
13+ #[ derive( partialdebug:: placeholder:: PartialDebug ) ]
14+ struct DefaultPlaceholder {
15+ field : usize ,
16+ }
17+
18+ #[ derive( partialdebug:: placeholder:: PartialDebug ) ]
19+ #[ debug_placeholder = "Unknown" ]
20+ struct CustomPlaceholder {
21+ field : usize ,
22+ }
You can’t perform that action at this time.
0 commit comments