Skip to content

Commit 8ce46b1

Browse files
---
yaml --- r: 234152 b: refs/heads/beta c: a056d58 h: refs/heads/master v: v3
1 parent c511cbd commit 8ce46b1

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 6090cea18479f3a3bf12fe63034966cbe6eed2f7
26+
refs/heads/beta: a056d5869e808b7f26cb536eca1aadda26a8188f
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_privacy/diagnostics.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,28 @@ To fix this error, please remove the visibility qualifier when it is not
125125
required.
126126
"##,
127127

128+
E0450: r##"
129+
A tuple constructor was invoked while some of its fields are private. Erroneous
130+
code example:
131+
132+
```
133+
mod Bar {
134+
pub struct Foo(isize);
135+
}
136+
137+
let f = Bar::Foo(0); // error: cannot invoke tuple struct constructor with
138+
// private fields
139+
```
140+
141+
To solve this issue, please ensure that all tuple's fields are public. Example:
142+
143+
```
144+
mod Bar {
145+
pub struct Foo(pub isize); // we set its field to public
146+
}
147+
148+
let f = Bar::Foo(0); // ok!
149+
```
150+
"##,
151+
128152
}

branches/beta/src/librustc_privacy/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,9 +931,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
931931
});
932932

933933
if any_priv {
934-
self.tcx.sess.span_err(expr.span,
935-
"cannot invoke tuple struct constructor \
936-
with private fields");
934+
span_err!(self.tcx.sess, expr.span, E0450,
935+
"cannot invoke tuple struct constructor with private \
936+
fields");
937937
}
938938
}
939939
}

0 commit comments

Comments
 (0)