rust/tests/ui/issues/issue-26472.rs
2023-01-11 09:32:08 +00:00

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
}