summaryrefslogtreecommitdiffstats
path: root/tests/ui/privacy/issue-79593.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/privacy/issue-79593.rs')
-rw-r--r--tests/ui/privacy/issue-79593.rs29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/privacy/issue-79593.rs b/tests/ui/privacy/issue-79593.rs
new file mode 100644
index 000000000..39c222f7c
--- /dev/null
+++ b/tests/ui/privacy/issue-79593.rs
@@ -0,0 +1,29 @@
+mod foo {
+ pub struct Pub { private: () }
+
+ pub enum Enum {
+ Variant { x: (), y: () },
+ Other
+ }
+
+ fn correct() {
+ Pub {};
+ //~^ ERROR missing field `private` in initializer of `Pub`
+ Enum::Variant { x: () };
+ //~^ ERROR missing field `y` in initializer of `Enum`
+ }
+}
+
+fn correct() {
+ foo::Pub {};
+ //~^ ERROR cannot construct `Pub` with struct literal syntax due to private fields
+}
+
+fn wrong() {
+ foo::Enum::Variant { x: () };
+ //~^ ERROR missing field `y` in initializer of `Enum`
+ foo::Enum::Variant { };
+ //~^ ERROR missing fields `x` and `y` in initializer of `Enum`
+}
+
+fn main() {}