@@ -1022,14 +1022,9 @@ fn test_dragonflybsd(target: &str) {
1022
1022
s. replace ( "e_nsec" , ".tv_nsec" )
1023
1023
}
1024
1024
"u64" if struct_ == "epoll_event" => "data.u64" . to_string ( ) ,
1025
- "type_"
1026
- if struct_ == "input_event"
1027
- || struct_ == "input_mask"
1028
- || struct_ == "ff_effect"
1029
- || struct_ == "rtprio" =>
1030
- {
1031
- "type" . to_string ( )
1032
- }
1025
+ // Field is named `type` in C but that is a Rust keyword,
1026
+ // so these fields are translated to `type_` in the bindings.
1027
+ "type_" if struct_ == "rtprio" => "type" . to_string ( ) ,
1033
1028
s => s. to_string ( ) ,
1034
1029
}
1035
1030
} ) ;
@@ -1555,7 +1550,10 @@ fn test_freebsd(target: &str) {
1555
1550
s if s. ends_with ( "_nsec" ) && struct_. starts_with ( "stat" ) => {
1556
1551
s. replace ( "e_nsec" , ".tv_nsec" )
1557
1552
}
1558
- s => s. to_string ( ) ,
1553
+ // Field is named `type` in C but that is a Rust keyword,
1554
+ // so these fields are translated to `type_` in the bindings.
1555
+ "type_" if struct_ == "rtprio" => "type" . to_string ( ) ,
1556
+ s => s. to_string ( ) ,
1559
1557
}
1560
1558
} ) ;
1561
1559
@@ -2313,12 +2311,13 @@ fn test_linux(target: &str) {
2313
2311
}
2314
2312
// FIXME: is this necessary?
2315
2313
"u64" if struct_ == "epoll_event" => "data.u64" . to_string ( ) ,
2316
- // FIXME: is this necessary?
2314
+ // The following structs have a field called `type` in C,
2315
+ // but `type` is a Rust keyword, so these fields are translated
2316
+ // to `type_` in Rust.
2317
2317
"type_"
2318
2318
if struct_ == "input_event"
2319
2319
|| struct_ == "input_mask"
2320
- || struct_ == "ff_effect"
2321
- || struct_ == "rtprio" =>
2320
+ || struct_ == "ff_effect" =>
2322
2321
{
2323
2322
"type" . to_string ( )
2324
2323
}
0 commit comments