rust/tests/ui/issues/issue-26472.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
324 B
Rust
Raw Normal View History

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
}