Bindgen update to 0.31


#1

Hello,

I try to update my -sys crate to bindgen 0.31 but I have many error like:

error[E0119]: conflicting implementations of trait `std::convert::Into<u8>` for type `u32`:                 
  --> src/lib.rs:68:1                                       
   |                                    
68 | / impl ::std::convert::Into<u8> for rp_pinState_t {                                     
69 | |     fn into(self) -> u8 {                            
70 | |         match self {                            
71 | |             rp_pinState_t::RP_LOW => 0,                                               
...  |                                                      
74 | |     }                                                                                                                     
75 | | }                                                                                                                         
   | |_^                                                                                                    
   |                                                                                        
   = note: conflicting implementation in crate `core`:                                                      
           - impl<T, U> std::convert::Into<U> for T          
             where U: std::convert::From<T>;                    
   = note: upstream crates may add new impl of trait `std::convert::From<u32>` for type `u8` in future versions

I defined implementation here because it’s not possible in the top level crate, but it’s probably not a good idea.

What is the best practice to do that?


#2

I suppose the problem is that bindgen before 0.31 generate rust enum from C enum and at now it just generates set of constants, and typedef like type C_Enum = u32.

Try to use rustified_enum


#3

That’s it, thank you :grinning: