mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
14 lines
324 B
Rust
14 lines
324 B
Rust
mod sub {
|
|
pub struct S { len: usize }
|
|
impl S {
|
|
pub fn new() -> S { S { len: 0 } }
|
|
pub fn len(&self) -> usize { self.len }
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let s = sub::S::new();
|
|
let v = s.len; //~ ERROR field `len` of struct `S` is private
|
|
s.len = v; //~ ERROR field `len` of struct `S` is private
|
|
}
|