Integration tests and use


Following . My library is called dvbv5-sys, so in my tests/ file I have a:

use dvbv5_sys

However this is reported as an error by cargo:

|> cargo test
   Compiling libc v0.2.46                                                                                                                                                                                                                                                                      
   Compiling dvbv5-sys v1.0.0-snapshot (/home/users/russel/Repositories/Git/Masters/Public/Rust_Libdvbv5_Sys)                                                                                                                                                                                  
warning: #[derive] can't be used on a #[repr(packed)] struct that does not derive Copy (error E0133)                                                                                                                                                                                           
    --> src/                                                                                                                                                                                                                                                                     
6797 | #[derive(Debug)]                                                                                                                                                                                                                                                                        
     |          ^^^^^                                                                                                                                                                                                                                                                          
     = note: #[warn(safe_packed_borrows)] on by default                                                                                                                                                                                                                                        
     = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!                                                                                                                                                         
     = note: for more information, see issue #46043 <>                                                                                                                                                                                           
error[E0432]: unresolved import `dvbv5_sys`                                                                                                                                                                                                                                                    
  --> tests/                                                                                                                                                                                                                                                               
20 | use dvbv5_sys;                                                                                                                                                                                                                                                                            
   |     ^^^^^^^^^ no `dvbv5_sys` in the root                                                                                                                                                                                                                                                  

As you can possibly imagine, I am a bit confused.



It must be put in extern crate, not in use, just as when importing it into user code.

1 Like


So the use adder; on is actually wrong and it should be extern crate adder;?

I change from using use to using extern crate in my project and it works fine. Thank you @Cerberuser for putting me on the right track, much appreciated. And stress lowering. :slight_smile: