2015-03-19 17:39:03 -05:00
|
|
|
// aux-build:struct_field_privacy.rs
|
2015-02-18 19:53:56 -06:00
|
|
|
|
2015-03-19 17:39:03 -05:00
|
|
|
extern crate struct_field_privacy as xc;
|
2015-02-18 19:53:56 -06:00
|
|
|
|
|
|
|
use xc::B;
|
|
|
|
|
2015-02-18 19:58:15 -06:00
|
|
|
struct A {
|
|
|
|
pub a: u32,
|
|
|
|
b: u32,
|
|
|
|
}
|
|
|
|
|
2015-02-18 19:53:56 -06:00
|
|
|
fn main () {
|
2015-02-18 19:58:15 -06:00
|
|
|
// external crate struct
|
2015-02-18 19:53:56 -06:00
|
|
|
let k = B {
|
2016-09-04 14:14:41 -05:00
|
|
|
aa: 20,
|
2020-09-02 02:40:56 -05:00
|
|
|
//~^ ERROR struct `B` has no field named `aa`
|
2016-09-04 14:14:41 -05:00
|
|
|
bb: 20,
|
2020-09-02 02:40:56 -05:00
|
|
|
//~^ ERROR struct `B` has no field named `bb`
|
2015-02-18 19:53:56 -06:00
|
|
|
};
|
2015-02-18 19:58:15 -06:00
|
|
|
// local crate struct
|
|
|
|
let l = A {
|
2016-09-04 14:14:41 -05:00
|
|
|
aa: 20,
|
|
|
|
//~^ ERROR struct `A` has no field named `aa`
|
|
|
|
bb: 20,
|
|
|
|
//~^ ERROR struct `A` has no field named `bb`
|
2015-02-18 19:58:15 -06:00
|
|
|
};
|
2015-02-18 19:53:56 -06:00
|
|
|
}
|