rust/tests/ui/privacy/private-struct-field.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
255 B
Rust
Raw Normal View History

mod cat {
pub struct Cat {
meows: usize
}
pub fn new_cat() -> Cat {
Cat { meows: 52 }
}
}
fn main() {
let nyan = cat::new_cat();
assert_eq!(nyan.meows, 52); //~ ERROR field `meows` of struct `Cat` is private
}