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