diff options
Diffstat (limited to 'tests/ui/privacy/private-class-field.rs')
-rw-r--r-- | tests/ui/privacy/private-class-field.rs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/ui/privacy/private-class-field.rs b/tests/ui/privacy/private-class-field.rs new file mode 100644 index 000000000..98e32ee07 --- /dev/null +++ b/tests/ui/privacy/private-class-field.rs @@ -0,0 +1,26 @@ +// run-pass +#![allow(dead_code)] +#![allow(non_camel_case_types)] + + +struct cat { + meows : usize, + + how_hungry : isize, +} + +impl cat { + pub fn meow_count(&mut self) -> usize { self.meows } +} + +fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } +} + +pub fn main() { + let mut nyan : cat = cat(52, 99); + assert_eq!(nyan.meow_count(), 52); +} |