diff options
Diffstat (limited to 'tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed')
| -rw-r--r-- | tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed new file mode 100644 index 00000000000..7d648543a20 --- /dev/null +++ b/tests/ui/privacy/inaccessible-fields-pattern-matching-76077.fixed @@ -0,0 +1,19 @@ +// https://github.com/rust-lang/rust/issues/76077 +//@ run-rustfix +#![allow(dead_code, unused_variables)] + +pub mod foo { + #[derive(Default)] + pub struct Foo { invisible: bool, } + + #[derive(Default)] + pub struct Bar { pub visible: bool, invisible: bool, } +} + +fn main() { + let foo::Foo { .. } = foo::Foo::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields + + let foo::Bar { visible, .. } = foo::Bar::default(); + //~^ ERROR pattern requires `..` due to inaccessible fields +} |
