Update affected tests

This commit is contained in:
Oliver Schneider 2017-03-27 13:59:10 +02:00
parent 0e920fde4f
commit b857a1a39f
No known key found for this signature in database
GPG key ID: A69F8D225B3AD7D9
6 changed files with 29 additions and 25 deletions

View file

@ -5122,7 +5122,6 @@ impl<'a> Parser<'a> {
} }
if self.check(&token::OpenDelim(token::Paren)) { 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 // 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));`. // `()` 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 // 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> {
the path:", the path:",
path); path);
self.expect(&token::CloseDelim(token::Paren))?; // `)` self.expect(&token::CloseDelim(token::Paren))?; // `)`
let sp = start_span.to(self.prev_span); let mut err = self.span_fatal_help(path_span, &msg, &suggestion);
let mut err = self.span_fatal_help(sp, &msg, &suggestion);
err.span_suggestion(path_span, &help_msg, format!("in {}", path)); err.span_suggestion(path_span, &help_msg, format!("in {}", path));
err.emit(); // emit diagnostic, but continue with public visibility err.emit(); // emit diagnostic, but continue with public visibility
} }

View file

@ -13,7 +13,7 @@ fn main() {
// the case where we show a suggestion // the case where we show a suggestion
let _ = tup[0]; let _ = tup[0];
//~^ ERROR cannot index a value of type //~^ 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 //~| SUGGESTION let _ = tup.0
// the case where we show just a general hint // the case where we show just a general hint

View file

@ -34,4 +34,8 @@ mod y {
} }
} }
fn main() {} fn main() {}
// test multichar names
mod xyz {}
pub (xyz) fn xyz() {}

View file

@ -1,41 +1,46 @@
error: incorrect visibility restriction error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:15:5 --> $DIR/pub-restricted.rs:15:6
| |
15 | pub (a) fn afn() {} 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: = help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate `pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent `pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path `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 error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:16:5 --> $DIR/pub-restricted.rs:16:6
| |
16 | pub (b) fn bfn() {} 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: = help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate `pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent `pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path `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 error: incorrect visibility restriction
--> $DIR/pub-restricted.rs:32:13 --> $DIR/pub-restricted.rs:32:14
| |
32 | pub (a) invalid: usize, 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: = help: some possible visibility restrictions are:
`pub(crate)`: visible only on the current crate `pub(crate)`: visible only on the current crate
`pub(super)`: visible only in the current module's parent `pub(super)`: visible only in the current module's parent
`pub(in path::to::module)`: visible only on the specified path `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 error: visibilities can only be restricted to ancestor modules
--> $DIR/pub-restricted.rs:33:17 --> $DIR/pub-restricted.rs:33:17
@ -43,5 +48,5 @@ error: visibilities can only be restricted to ancestor modules
33 | pub (in x) non_parent_invalid: usize, 33 | pub (in x) non_parent_invalid: usize,
| ^ | ^
error: aborting due to 4 previous errors error: aborting due to 5 previous errors

View file

@ -2,11 +2,11 @@ error[E0369]: binary operation `+` cannot be applied to type `&'static str`
--> $DIR/issue-39018.rs:12:13 --> $DIR/issue-39018.rs:12:13
| |
12 | let x = "Hello " + "World!"; 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 = 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` error[E0369]: binary operation `+` cannot be applied to type `World`
--> $DIR/issue-39018.rs:17:13 --> $DIR/issue-39018.rs:17:13

View file

@ -2,10 +2,7 @@ error: cannot index a value of type `({integer},)`
--> $DIR/suggestion-non-ascii.rs:14:21 --> $DIR/suggestion-non-ascii.rs:14:21
| |
14 | println!("☃{}", tup[0]); 14 | println!("☃{}", tup[0]);
| ^^^^^^ | ^^^^^^ to access tuple elements, use `tup.0`
|
help: to access tuple elements, use tuple indexing syntax as shown
| println!("☃{}", tup.0);
error: aborting due to previous error error: aborting due to previous error