Skip to content

Commit b857a1a

Browse files
committed
Update affected tests
1 parent 0e920fd commit b857a1a

File tree

6 files changed

+29
-25
lines changed

6 files changed

+29
-25
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5122,7 +5122,6 @@ impl<'a> Parser<'a> {
51225122
}
51235123

51245124
if self.check(&token::OpenDelim(token::Paren)) {
5125-
let start_span = self.span;
51265125
// We don't `self.bump()` the `(` yet because this might be a struct definition where
51275126
// `()` or a tuple might be allowed. For example, `struct Struct(pub (), pub (usize));`.
51285127
// Because of this, we only `bump` the `(` if we're assured it is appropriate to do so
@@ -5165,8 +5164,7 @@ impl<'a> Parser<'a> {
51655164
the path:",
51665165
path);
51675166
self.expect(&token::CloseDelim(token::Paren))?; // `)`
5168-
let sp = start_span.to(self.prev_span);
5169-
let mut err = self.span_fatal_help(sp, &msg, &suggestion);
5167+
let mut err = self.span_fatal_help(path_span, &msg, &suggestion);
51705168
err.span_suggestion(path_span, &help_msg, format!("in {}", path));
51715169
err.emit(); // emit diagnostic, but continue with public visibility
51725170
}

src/test/compile-fail/issue-27842.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ fn main() {
1313
// the case where we show a suggestion
1414
let _ = tup[0];
1515
//~^ ERROR cannot index a value of type
16-
//~| HELP to access tuple elements, use tuple indexing syntax as shown
16+
//~| HELP to access tuple elements, use
1717
//~| SUGGESTION let _ = tup.0
1818

1919
// the case where we show just a general hint

src/test/ui/pub/pub-restricted.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,8 @@ mod y {
3434
}
3535
}
3636

37-
fn main() {}
37+
fn main() {}
38+
39+
// test multichar names
40+
mod xyz {}
41+
pub (xyz) fn xyz() {}

src/test/ui/pub/pub-restricted.stderr

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,52 @@
11
error: incorrect visibility restriction
2-
--> $DIR/pub-restricted.rs:15:5
2+
--> $DIR/pub-restricted.rs:15:6
33
|
44
15 | pub (a) fn afn() {}
5-
| ^^^
5+
| ^ to make this visible only to module `a`, add `in` before the path: `in a`
66
|
77
= help: some possible visibility restrictions are:
88
`pub(crate)`: visible only on the current crate
99
`pub(super)`: visible only in the current module's parent
1010
`pub(in path::to::module)`: visible only on the specified path
11-
help: to make this visible only to module `a`, add `in` before the path:
12-
| pub (in a) fn afn() {}
1311

1412
error: incorrect visibility restriction
15-
--> $DIR/pub-restricted.rs:16:5
13+
--> $DIR/pub-restricted.rs:16:6
1614
|
1715
16 | pub (b) fn bfn() {}
18-
| ^^^
16+
| ^ to make this visible only to module `b`, add `in` before the path: `in b`
1917
|
2018
= help: some possible visibility restrictions are:
2119
`pub(crate)`: visible only on the current crate
2220
`pub(super)`: visible only in the current module's parent
2321
`pub(in path::to::module)`: visible only on the specified path
24-
help: to make this visible only to module `b`, add `in` before the path:
25-
| pub (in b) fn bfn() {}
2622

2723
error: incorrect visibility restriction
28-
--> $DIR/pub-restricted.rs:32:13
24+
--> $DIR/pub-restricted.rs:32:14
2925
|
3026
32 | pub (a) invalid: usize,
31-
| ^^^
27+
| ^ to make this visible only to module `a`, add `in` before the path: `in a`
28+
|
29+
= help: some possible visibility restrictions are:
30+
`pub(crate)`: visible only on the current crate
31+
`pub(super)`: visible only in the current module's parent
32+
`pub(in path::to::module)`: visible only on the specified path
33+
34+
error: incorrect visibility restriction
35+
--> $DIR/pub-restricted.rs:41:6
36+
|
37+
41 | pub (xyz) fn xyz() {}
38+
| ^^^ to make this visible only to module `xyz`, add `in` before the path: `in xyz`
3239
|
3340
= help: some possible visibility restrictions are:
3441
`pub(crate)`: visible only on the current crate
3542
`pub(super)`: visible only in the current module's parent
3643
`pub(in path::to::module)`: visible only on the specified path
37-
help: to make this visible only to module `a`, add `in` before the path:
38-
| pub (in a) invalid: usize,
3944

4045
error: visibilities can only be restricted to ancestor modules
4146
--> $DIR/pub-restricted.rs:33:17
4247
|
4348
33 | pub (in x) non_parent_invalid: usize,
4449
| ^
4550

46-
error: aborting due to 4 previous errors
51+
error: aborting due to 5 previous errors
4752

src/test/ui/span/issue-39018.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ error[E0369]: binary operation `+` cannot be applied to type `&'static str`
22
--> $DIR/issue-39018.rs:12:13
33
|
44
12 | let x = "Hello " + "World!";
5-
| ^^^^^^^^
5+
| ^^^^^^^^-----------
6+
| |
7+
| to_owned() can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left. `"Hello ".to_owned() + "World!"`
68
|
79
= note: `+` can't be used to concatenate two `&str` strings
8-
help: to_owned() can be used to create an owned `String` from a string reference. String concatenation appends the string on the right to the string on the left and may require reallocation. This requires ownership of the string on the left.
9-
| let x = "Hello ".to_owned() + "World!";
1010

1111
error[E0369]: binary operation `+` cannot be applied to type `World`
1212
--> $DIR/issue-39018.rs:17:13

src/test/ui/span/suggestion-non-ascii.stderr

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ error: cannot index a value of type `({integer},)`
22
--> $DIR/suggestion-non-ascii.rs:14:21
33
|
44
14 | println!("☃{}", tup[0]);
5-
| ^^^^^^
6-
|
7-
help: to access tuple elements, use tuple indexing syntax as shown
8-
| println!("☃{}", tup.0);
5+
| ^^^^^^ to access tuple elements, use `tup.0`
96

107
error: aborting due to previous error
118

0 commit comments

Comments
 (0)