Skip to content

Commit

Permalink
Update affected tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Apr 25, 2017
1 parent 0e920fd commit b857a1a
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 25 deletions.
4 changes: 1 addition & 3 deletions src/libsyntax/parse/parser.rs
Expand Up @@ -5122,7 +5122,6 @@ impl<'a> Parser<'a> {
}

if self.check(&token::OpenDelim(token::Paren)) {
let start_span = self.span;
// We don't `self.bump()` the `(` yet because this might be a struct definition where
// `()` or a tuple might be allowed. For example, `struct Struct(pub (), pub (usize));`.
// Because of this, we only `bump` the `(` if we're assured it is appropriate to do so
Expand Down Expand Up @@ -5165,8 +5164,7 @@ impl<'a> Parser<'a> {
the path:",
path);
self.expect(&token::CloseDelim(token::Paren))?; // `)`
let sp = start_span.to(self.prev_span);
let mut err = self.span_fatal_help(sp, &msg, &suggestion);
let mut err = self.span_fatal_help(path_span, &msg, &suggestion);
err.span_suggestion(path_span, &help_msg, format!("in {}", path));
err.emit(); // emit diagnostic, but continue with public visibility
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/issue-27842.rs
Expand Up @@ -13,7 +13,7 @@ fn main() {
// the case where we show a suggestion
let _ = tup[0];
//~^ ERROR cannot index a value of type
//~| HELP to access tuple elements, use tuple indexing syntax as shown
//~| HELP to access tuple elements, use
//~| SUGGESTION let _ = tup.0

// the case where we show just a general hint
Expand Down
6 changes: 5 additions & 1 deletion src/test/ui/pub/pub-restricted.rs
Expand Up @@ -34,4 +34,8 @@ mod y {
}
}

fn main() {}
fn main() {}

// test multichar names
mod xyz {}
pub (xyz) fn xyz() {}
31 changes: 18 additions & 13 deletions src/test/ui/pub/pub-restricted.stderr
@@ -1,47 +1,52 @@
error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:15:5
--> $DIR/pub-restricted.rs:15:6
|
15 | pub (a) fn afn() {}
| ^^^
| ^ to make this visible only to module `a`, add `in` before the path: `in a`
|
= help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path
help: to make this visible only to module `a`, add `in` before the path:
| pub (in a) fn afn() {}

error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:16:5
--> $DIR/pub-restricted.rs:16:6
|
16 | pub (b) fn bfn() {}
| ^^^
| ^ to make this visible only to module `b`, add `in` before the path: `in b`
|
= help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path
help: to make this visible only to module `b`, add `in` before the path:
| pub (in b) fn bfn() {}

error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:32:13
--> $DIR/pub-restricted.rs:32:14
|
32 | pub (a) invalid: usize,
| ^^^
| ^ to make this visible only to module `a`, add `in` before the path: `in a`
|
= help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path

error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:41:6
|
41 | pub (xyz) fn xyz() {}
| ^^^ to make this visible only to module `xyz`, add `in` before the path: `in xyz`
|
= help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path
help: to make this visible only to module `a`, add `in` before the path:
| pub (in a) invalid: usize,

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

error: aborting due to 4 previous errors
error: aborting due to 5 previous errors

6 changes: 3 additions & 3 deletions src/test/ui/span/issue-39018.stderr
Expand Up @@ -2,11 +2,11 @@ error[E0369]: binary operation `+` cannot be applied to type `&'static str`
--> $DIR/issue-39018.rs:12:13
|
12 | let x = "Hello " + "World!";
| ^^^^^^^^
| ^^^^^^^^-----------
| |
| 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!"`
|
= note: `+` can't be used to concatenate two `&str` strings
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.
| let x = "Hello ".to_owned() + "World!";

error[E0369]: binary operation `+` cannot be applied to type `World`
--> $DIR/issue-39018.rs:17:13
Expand Down
5 changes: 1 addition & 4 deletions src/test/ui/span/suggestion-non-ascii.stderr
Expand Up @@ -2,10 +2,7 @@ error: cannot index a value of type `({integer},)`
--> $DIR/suggestion-non-ascii.rs:14:21
|
14 | println!("☃{}", tup[0]);
| ^^^^^^
|
help: to access tuple elements, use tuple indexing syntax as shown
| println!("☃{}", tup.0);
| ^^^^^^ to access tuple elements, use `tup.0`

error: aborting due to previous error

0 comments on commit b857a1a

Please sign in to comment.