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

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

39 lines
734 B
Rust
Raw Normal View History

// aux-build:struct_field_privacy.rs
extern crate struct_field_privacy as xc;
struct A {
a: isize,
}
mod inner {
2016-02-22 16:33:38 -06:00
pub struct A {
a: isize,
pub b: isize,
}
pub struct B {
pub a: isize,
b: isize,
}
2016-03-29 19:35:53 -05:00
pub struct Z(pub isize, isize);
}
2016-03-29 19:35:53 -05:00
fn test(a: A, b: inner::A, c: inner::B, d: xc::A, e: xc::B, z: inner::Z) {
a.a;
b.a; //~ ERROR: field `a` of struct `inner::A` is private
b.b;
c.a;
c.b; //~ ERROR: field `b` of struct `inner::B` is private
d.a; //~ ERROR: field `a` of struct `xc::A` is private
d.b;
e.a;
e.b; //~ ERROR: field `b` of struct `xc::B` is private
2016-03-29 19:35:53 -05:00
z.0;
z.1; //~ ERROR: field `1` of struct `Z` is private
}
fn main() {}