Skip to content

Commit 4e5c120

Browse files
committed
Update ui tests involving invalid visibility qualifiers
1 parent 87b3ae3 commit 4e5c120

21 files changed

+162
-106
lines changed

tests/ui/error-codes/E0449.stderr

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,26 @@
1-
error[E0449]: unnecessary visibility qualifier
1+
error[E0449]: visibility qualifiers are not permitted here
22
--> $DIR/E0449.rs:7:1
33
|
44
LL | pub impl Bar {}
5-
| ^^^ `pub` not permitted here because it's implied
5+
| ^^^
66
|
77
= note: place qualifiers on individual impl items instead
88

9-
error[E0449]: unnecessary visibility qualifier
9+
error[E0449]: visibility qualifiers are not permitted here
1010
--> $DIR/E0449.rs:9:1
1111
|
1212
LL | pub impl Foo for Bar {
13-
| ^^^ `pub` not permitted here because it's implied
13+
| ^^^
14+
|
15+
= note: trait items always share the visibility of their trait
1416

15-
error[E0449]: unnecessary visibility qualifier
17+
error[E0449]: visibility qualifiers are not permitted here
1618
--> $DIR/E0449.rs:10:5
1719
|
1820
LL | pub fn foo() {}
19-
| ^^^ `pub` not permitted here because it's implied
21+
| ^^^
22+
|
23+
= note: trait items always share the visibility of their trait
2024

2125
error: aborting due to 3 previous errors
2226

tests/ui/issues/issue-28433.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
enum Bird {
22
pub Duck,
3-
//~^ ERROR unnecessary visibility qualifier
3+
//~^ ERROR visibility qualifiers are not permitted here
44
Goose,
55
pub(crate) Dove
6-
//~^ ERROR unnecessary visibility qualifier
6+
//~^ ERROR visibility qualifiers are not permitted here
77
}
88

99

tests/ui/issues/issue-28433.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1-
error[E0449]: unnecessary visibility qualifier
1+
error[E0449]: visibility qualifiers are not permitted here
22
--> $DIR/issue-28433.rs:2:5
33
|
44
LL | pub Duck,
5-
| ^^^ `pub` not permitted here because it's implied
5+
| ^^^
6+
|
7+
= note: enum variants and their fields always share the visibility of the enum they are in
68

7-
error[E0449]: unnecessary visibility qualifier
9+
error[E0449]: visibility qualifiers are not permitted here
810
--> $DIR/issue-28433.rs:5:5
911
|
1012
LL | pub(crate) Dove
1113
| ^^^^^^^^^^
14+
|
15+
= note: enum variants and their fields always share the visibility of the enum they are in
1216

1317
error: aborting due to 2 previous errors
1418

tests/ui/parser/assoc-static-semantic-fail.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ trait T {
3131
//~| ERROR a static item cannot be `default`
3232
pub(crate) default static TD: u8;
3333
//~^ ERROR associated `static` items are not allowed
34-
//~| ERROR unnecessary visibility qualifier
34+
//~| ERROR visibility qualifiers are not permitted here
3535
//~| ERROR a static item cannot be `default`
3636
}
3737

@@ -47,6 +47,6 @@ impl T for S {
4747
pub default static TD: u8;
4848
//~^ ERROR associated `static` items are not allowed
4949
//~| ERROR associated constant in `impl` without body
50-
//~| ERROR unnecessary visibility qualifier
50+
//~| ERROR visibility qualifiers are not permitted here
5151
//~| ERROR a static item cannot be `default`
5252
}

tests/ui/parser/assoc-static-semantic-fail.stderr

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,13 @@ LL | pub(crate) default static ID: u8;
134134
| |
135135
| help: provide a definition for the constant: `= <expr>;`
136136

137-
error[E0449]: unnecessary visibility qualifier
137+
error[E0449]: visibility qualifiers are not permitted here
138138
--> $DIR/assoc-static-semantic-fail.rs:32:5
139139
|
140140
LL | pub(crate) default static TD: u8;
141141
| ^^^^^^^^^^
142+
|
143+
= note: trait items always share the visibility of their trait
142144

143145
error: associated constant in `impl` without body
144146
--> $DIR/assoc-static-semantic-fail.rs:41:5
@@ -156,11 +158,13 @@ LL | pub default static TD: u8;
156158
| |
157159
| help: provide a definition for the constant: `= <expr>;`
158160

159-
error[E0449]: unnecessary visibility qualifier
161+
error[E0449]: visibility qualifiers are not permitted here
160162
--> $DIR/assoc-static-semantic-fail.rs:47:5
161163
|
162164
LL | pub default static TD: u8;
163-
| ^^^ `pub` not permitted here because it's implied
165+
| ^^^
166+
|
167+
= note: trait items always share the visibility of their trait
164168

165169
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
166170
--> $DIR/assoc-static-semantic-fail.rs:3:12

tests/ui/parser/default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl Foo for u8 {
1414
}
1515

1616
impl Foo for u16 {
17-
pub default fn foo<T: Default>() -> T { //~ ERROR unnecessary visibility qualifier
17+
pub default fn foo<T: Default>() -> T { //~ ERROR visibility qualifiers are not permitted here
1818
T::default()
1919
}
2020
}

tests/ui/parser/default.stderr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@ LL | default pub fn foo<T: Default>() -> T { T::default() }
1717
LL | }
1818
| - item list ends here
1919

20-
error[E0449]: unnecessary visibility qualifier
20+
error[E0449]: visibility qualifiers are not permitted here
2121
--> $DIR/default.rs:17:5
2222
|
2323
LL | pub default fn foo<T: Default>() -> T {
24-
| ^^^ `pub` not permitted here because it's implied
24+
| ^^^
25+
|
26+
= note: trait items always share the visibility of their trait
2527

2628
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2729
--> $DIR/default.rs:3:12
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
trait Foo {
22
pub const Foo: u32;
3-
//~^ ERROR unnecessary visibility qualifier
3+
//~^ ERROR visibility qualifiers are not permitted here
44
}
55

66
fn main() {}

tests/ui/parser/trait-pub-assoc-const.stderr

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
error[E0449]: unnecessary visibility qualifier
1+
error[E0449]: visibility qualifiers are not permitted here
22
--> $DIR/trait-pub-assoc-const.rs:2:5
33
|
44
LL | pub const Foo: u32;
5-
| ^^^ `pub` not permitted here because it's implied
5+
| ^^^
6+
|
7+
= note: trait items always share the visibility of their trait
68

79
error: aborting due to previous error
810

tests/ui/parser/trait-pub-assoc-ty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
trait Foo {
22
pub type Foo;
3-
//~^ ERROR unnecessary visibility qualifier
3+
//~^ ERROR visibility qualifiers are not permitted here
44
}
55

66
fn main() {}

0 commit comments

Comments
 (0)