rust/src/test/compile-fail/private-struct-field.rs

16 lines
255 B
Rust
Raw Normal View History

mod cat {
#[legacy_exports];
struct Cat {
priv meows: uint
}
fn new_cat() -> Cat {
Cat { meows: 52 }
}
}
fn main() {
let nyan = cat::new_cat();
assert nyan.meows == 52; //~ ERROR field `meows` is private
}