rust - How do I avoid 'source trait is private' when using subtraits? -
i'm trying use quickcheck in rust. want define enum instance of arbitrary , can use in tests. #![feature(plugin)] #![plugin(quickcheck_macros)] #[cfg(test)] extern crate quickcheck; use quickcheck::{arbitrary,gen}; #[derive(clone)] enum animal { cat, dog, mouse } impl arbitrary animal { fn arbitrary<g: gen>(g: &mut g) -> animal { let = g.next_u32(); match % 3 { 0 => animal::cat, 1 => animal::dog, 2 => animal::mouse, } } } however, gives me compilation error: src/main.rs:18:17: 18:29 error: source trait private src/main.rs:18 let = g.next_u32(); ^~~~~~~~~~~~ what causes error? know there's this rust issue since gen imported think call .next_u32 . it looks gen has rand::rng parent trait, above works if add extern crate rand after adding rand = "*" cargo.toml. [i had remove #[cfg(test)] above quick...