This repository was archived by the owner on Aug 15, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Expand file tree Collapse file tree 3 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ impl DeriveEnum {
124
124
}
125
125
}
126
126
}
127
- body. push_parsed ( "Ok(())" ) ?;
127
+ body. push_parsed ( "core::result::Result:: Ok(())" ) ?;
128
128
Ok ( ( ) )
129
129
} ) ?;
130
130
match_body. punct ( ',' ) ;
@@ -274,7 +274,7 @@ impl DeriveEnum {
274
274
variant_case. push ( variant_index. remove ( 0 ) ) ;
275
275
}
276
276
variant_case. puncts ( "=>" ) ;
277
- variant_case. ident_str ( " Ok") ;
277
+ variant_case. push_parsed ( "core::result::Result:: Ok") ? ;
278
278
variant_case. group ( Delimiter :: Parenthesis , |variant_case_body| {
279
279
// Self::Variant { }
280
280
// Self::Variant { 0: ..., 1: ... 2: ... },
@@ -384,7 +384,7 @@ impl DeriveEnum {
384
384
variant_case. push ( variant_index. remove ( 0 ) ) ;
385
385
}
386
386
variant_case. puncts ( "=>" ) ;
387
- variant_case. ident_str ( " Ok") ;
387
+ variant_case. push_parsed ( "core::result::Result:: Ok") ? ;
388
388
variant_case. group ( Delimiter :: Parenthesis , |variant_case_body| {
389
389
// Self::Variant { }
390
390
// Self::Variant { 0: ..., 1: ... 2: ... },
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ impl DeriveStruct {
56
56
}
57
57
}
58
58
}
59
- fn_body. push_parsed ( "Ok(())" ) ?;
59
+ fn_body. push_parsed ( "core::result::Result:: Ok(())" ) ?;
60
60
Ok ( ( ) )
61
61
} ) ?;
62
62
Ok ( ( ) )
@@ -95,7 +95,7 @@ impl DeriveStruct {
95
95
. with_return_type ( format ! ( "core::result::Result<Self, {}::error::DecodeError>" , crate_name) )
96
96
. body ( |fn_body| {
97
97
// Ok(Self {
98
- fn_body. ident_str ( " Ok") ;
98
+ fn_body. push_parsed ( "core::result::Result:: Ok") ? ;
99
99
fn_body. group ( Delimiter :: Parenthesis , |ok_group| {
100
100
ok_group. ident_str ( "Self" ) ;
101
101
ok_group. group ( Delimiter :: Brace , |struct_body| {
@@ -174,7 +174,7 @@ impl DeriveStruct {
174
174
. with_return_type ( format ! ( "core::result::Result<Self, {}::error::DecodeError>" , crate_name) )
175
175
. body ( |fn_body| {
176
176
// Ok(Self {
177
- fn_body. ident_str ( " Ok") ;
177
+ fn_body. push_parsed ( "core::result::Result:: Ok") ? ;
178
178
fn_body. group ( Delimiter :: Parenthesis , |ok_group| {
179
179
ok_group. ident_str ( "Self" ) ;
180
180
ok_group. group ( Delimiter :: Brace , |struct_body| {
Original file line number Diff line number Diff line change @@ -403,6 +403,23 @@ fn test_enum_with_generics_roundtrip() {
403
403
assert_eq ! ( start, decoded) ;
404
404
}
405
405
406
+ mod derive_with_polluted_scope {
407
+ #[ allow( dead_code) ]
408
+ #[ allow( non_snake_case) ]
409
+ fn Ok ( ) { }
410
+
411
+ #[ derive( bincode:: Encode , bincode:: Decode ) ]
412
+ struct A {
413
+ a : u32 ,
414
+ }
415
+
416
+ #[ derive( bincode:: Encode , bincode:: Decode ) ]
417
+ enum B {
418
+ A ,
419
+ B ,
420
+ }
421
+ }
422
+
406
423
#[ cfg( feature = "alloc" ) ]
407
424
mod zoxide {
408
425
extern crate alloc;
You can’t perform that action at this time.
0 commit comments