2014-01-24 13:00:08 -06:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
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 {
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test(a: A, b: inner::A, c: inner::B, d: xc::A, e: xc::B) {
|
2016-01-17 13:57:54 -06:00
|
|
|
//~^ ERROR: struct `A` is private
|
2014-01-24 13:00:08 -06:00
|
|
|
//~^^ ERROR: struct `A` is private
|
|
|
|
|
|
|
|
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
|
2014-01-24 13:00:08 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|