mirror of
https://github.com/rust-lang/rust
synced 2024-11-05 20:45:15 +00:00
13 lines
324 B
Rust
13 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
|
|
}
|