mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 06:35:27 +00:00
Update affected tests
This commit is contained in:
parent
0e920fde4f
commit
b857a1a39f
@ -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
|
||||
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -34,4 +34,8 @@ mod y {
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
fn main() {}
|
||||
|
||||
// test multichar names
|
||||
mod xyz {}
|
||||
pub (xyz) fn xyz() {}
|
||||
|
@ -1,41 +1,46 @@
|
||||
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
|
||||
@ -43,5 +48,5 @@ error: visibilities can only be restricted to ancestor modules
|
||||
33 | pub (in x) non_parent_invalid: usize,
|
||||
| ^
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
error: aborting due to 5 previous errors
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user