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