diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/issues/issue-26472.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-26472.rs b/src/test/ui/issues/issue-26472.rs new file mode 100644 index 000000000..b100c59ad --- /dev/null +++ b/src/test/ui/issues/issue-26472.rs @@ -0,0 +1,13 @@ +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 +} |