Skip to content

Commit 7e35070

Browse files
committed
add ui test for #135903
fix error message
1 parent 757a009 commit 7e35070

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

compiler/rustc_privacy/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ privacy_in_public_interface = {$vis_descr} {$kind} `{$descr}` in public interfac
2525
2626
privacy_item_is_private = {$kind} `{$descr}` is private
2727
.label = private {$kind}
28-
.suggestion = consider using `..` to ignore fields with private types
28+
.suggestion = consider using `..` to ignore the field with private type
2929
3030
privacy_private_interface_or_bounds_lint = {$ty_kind} `{$ty_descr}` is more private than the item `{$item_descr}`
3131
.item_label = {$item_kind} `{$item_descr}` is reachable at visibility `{$item_vis_descr}`
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
mod foo {
2+
struct Bar;
3+
pub enum Foo {
4+
#[allow(private_interfaces)]
5+
A(Bar),
6+
}
7+
}
8+
fn foo_bar(v: foo::Foo) {
9+
match v {
10+
foo::Foo::A(_) => {} //~ ERROR type `Bar` is private
11+
}
12+
}
13+
14+
fn main() {}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error: type `Bar` is private
2+
--> $DIR/private-pat-field-types.rs:10:21
3+
|
4+
LL | foo::Foo::A(_) => {}
5+
| ^ private type
6+
|
7+
help: consider using `..` to ignore the field with private type
8+
|
9+
LL - foo::Foo::A(_) => {}
10+
LL + foo::Foo::A(..) => {}
11+
|
12+
13+
error: aborting due to 1 previous error
14+

0 commit comments

Comments
 (0)