1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // aux-build:privacy-tuple-struct.rs
14 extern crate "privacy-tuple-struct" as other;
19 pub struct C(pub isize, isize);
20 pub struct D(pub isize);
30 match a { A(()) => {} }
31 match a { A(_) => {} }
35 match b { B(_) => {} }
36 match b { B(_b) => {} }
37 match b { B(1) => {} B(_) => {} }
43 match c { C(_, _) => {} }
44 match c { C(_a, _) => {} }
45 match c { C(_, _b) => {} }
46 match c { C(_a, _b) => {} }
50 match d { D(_) => {} }
51 match d { D(_d) => {} }
52 match d { D(1) => {} D(_) => {} }
62 let a = a::A(()); //~ ERROR: cannot invoke tuple struct constructor
63 let b = a::B(2); //~ ERROR: cannot invoke tuple struct constructor
64 let c = a::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
67 let a::A(()) = a; //~ ERROR: field #1 of struct `a::A` is private
69 match a { a::A(()) => {} } //~ ERROR: field #1 of struct `a::A` is private
70 match a { a::A(_) => {} }
73 let a::B(_b) = b; //~ ERROR: field #1 of struct `a::B` is private
74 match b { a::B(_) => {} }
75 match b { a::B(_b) => {} } //~ ERROR: field #1 of struct `a::B` is private
76 match b { a::B(1) => {} a::B(_) => {} } //~ ERROR: field #1 of struct `a::B` is private
80 let a::C(_, _b) = c; //~ ERROR: field #2 of struct `a::C` is private
81 let a::C(_a, _b) = c; //~ ERROR: field #2 of struct `a::C` is private
82 match c { a::C(_, _) => {} }
83 match c { a::C(_a, _) => {} }
84 match c { a::C(_, _b) => {} } //~ ERROR: field #2 of struct `a::C` is private
85 match c { a::C(_a, _b) => {} } //~ ERROR: field #2 of struct `a::C` is private
89 match d { a::D(_) => {} }
90 match d { a::D(_d) => {} }
91 match d { a::D(1) => {} a::D(_) => {} }
93 let a2 = a::A; //~ ERROR: cannot invoke tuple struct constructor
94 let b2 = a::B; //~ ERROR: cannot invoke tuple struct constructor
95 let c2 = a::C; //~ ERROR: cannot invoke tuple struct constructor
100 let a = other::A(()); //~ ERROR: cannot invoke tuple struct constructor
101 let b = other::B(2); //~ ERROR: cannot invoke tuple struct constructor
102 let c = other::C(2, 3); //~ ERROR: cannot invoke tuple struct constructor
105 let other::A(()) = a; //~ ERROR: field #1 of struct `privacy-tuple-struct::A` is private
107 match a { other::A(()) => {} }
108 //~^ ERROR: field #1 of struct `privacy-tuple-struct::A` is private
109 match a { other::A(_) => {} }
112 let other::B(_b) = b; //~ ERROR: field #1 of struct `privacy-tuple-struct::B` is private
113 match b { other::B(_) => {} }
114 match b { other::B(_b) => {} }
115 //~^ ERROR: field #1 of struct `privacy-tuple-struct::B` is private
116 match b { other::B(1) => {} other::B(_) => {} }
117 //~^ ERROR: field #1 of struct `privacy-tuple-struct::B` is private
119 let other::C(_, _) = c;
120 let other::C(_a, _) = c;
121 let other::C(_, _b) = c; //~ ERROR: field #2 of struct `privacy-tuple-struct::C` is private
122 let other::C(_a, _b) = c; //~ ERROR: field #2 of struct `privacy-tuple-struct::C` is private
123 match c { other::C(_, _) => {} }
124 match c { other::C(_a, _) => {} }
125 match c { other::C(_, _b) => {} }
126 //~^ ERROR: field #2 of struct `privacy-tuple-struct::C` is private
127 match c { other::C(_a, _b) => {} }
128 //~^ ERROR: field #2 of struct `privacy-tuple-struct::C` is private
131 let other::D(_d) = d;
132 match d { other::D(_) => {} }
133 match d { other::D(_d) => {} }
134 match d { other::D(1) => {} other::D(_) => {} }
136 let a2 = other::A; //~ ERROR: cannot invoke tuple struct constructor
137 let b2 = other::B; //~ ERROR: cannot invoke tuple struct constructor
138 let c2 = other::C; //~ ERROR: cannot invoke tuple struct constructor