mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-18 03:25:55 +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
|
|
}
|