2015-03-19 17:39:03 -05:00
|
|
|
// aux-build:struct_field_privacy.rs
|
2014-01-24 13:00:08 -06:00
|
|
|
|
2015-03-19 17:39:03 -05:00
|
|
|
extern crate struct_field_privacy as xc;
|
2014-01-24 13:00:08 -06:00
|
|
|
|
|
|
|
struct A {
|
2015-01-08 04:54:35 -06:00
|
|
|
a: isize,
|
2014-01-24 13:00:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
mod inner {
|
2016-02-22 16:33:38 -06:00
|
|
|
pub struct A {
|
2015-01-08 04:54:35 -06:00
|
|
|
a: isize,
|
|
|
|
pub b: isize,
|
2014-01-24 13:00:08 -06:00
|
|
|
}
|
|
|
|
pub struct B {
|
2015-01-08 04:54:35 -06:00
|
|
|
pub a: isize,
|
|
|
|
b: isize,
|
2014-01-24 13:00:08 -06:00
|
|
|
}
|
2016-03-29 19:35:53 -05:00
|
|
|
pub struct Z(pub isize, isize);
|
2014-01-24 13:00:08 -06:00
|
|
|
}
|
|
|
|
|
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) {
|
2014-01-24 13:00:08 -06:00
|
|
|
a.a;
|
2014-04-05 12:28:01 -05:00
|
|
|
b.a; //~ ERROR: field `a` of struct `inner::A` is private
|
2014-01-24 13:00:08 -06:00
|
|
|
b.b;
|
|
|
|
c.a;
|
2014-04-05 12:28:01 -05:00
|
|
|
c.b; //~ ERROR: field `b` of struct `inner::B` is private
|
2014-01-24 13:00:08 -06:00
|
|
|
|
2015-08-01 12:41:01 -05:00
|
|
|
d.a; //~ ERROR: field `a` of struct `xc::A` is private
|
2014-01-24 13:00:08 -06:00
|
|
|
d.b;
|
|
|
|
|
|
|
|
e.a;
|
2015-08-01 12:41:01 -05:00
|
|
|
e.b; //~ ERROR: field `b` of struct `xc::B` is private
|
2016-03-29 19:35:53 -05:00
|
|
|
|
|
|
|
z.0;
|
2020-09-02 02:40:56 -05:00
|
|
|
z.1; //~ ERROR: field `1` of struct `Z` is private
|
2014-01-24 13:00:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|