Address review feedbacks
Also addressed merge conflicts upon rebasing.
This commit is contained in:
parent
61c3e4d56e
commit
730d299354
3 changed files with 18 additions and 23 deletions
|
@ -571,6 +571,7 @@ impl<'a> Parser<'a> {
|
||||||
// integer literal (e.g. `1:42`), it's likely a range
|
// integer literal (e.g. `1:42`), it's likely a range
|
||||||
// expression for Pythonistas and we can suggest so.
|
// expression for Pythonistas and we can suggest so.
|
||||||
if self.prev_token.is_integer_lit()
|
if self.prev_token.is_integer_lit()
|
||||||
|
&& self.may_recover()
|
||||||
&& self.look_ahead(1, |token| token.is_integer_lit())
|
&& self.look_ahead(1, |token| token.is_integer_lit())
|
||||||
{
|
{
|
||||||
// FIXME(hkmatsumoto): Might be better to trigger
|
// FIXME(hkmatsumoto): Might be better to trigger
|
||||||
|
@ -581,22 +582,22 @@ impl<'a> Parser<'a> {
|
||||||
"..",
|
"..",
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
|
// if next token is following a colon, it's likely a path
|
||||||
// if next token is following a colon, it's likely a path
|
// and we can suggest a path separator
|
||||||
// and we can suggest a path separator
|
self.bump();
|
||||||
self.bump();
|
if self.token.span.lo() == self.prev_token.span.hi() {
|
||||||
if self.token.span.lo() == self.prev_token.span.hi() {
|
err.span_suggestion_verbose(
|
||||||
err.span_suggestion_verbose(
|
self.prev_token.span,
|
||||||
self.prev_token.span,
|
"maybe write a path separator here",
|
||||||
"maybe write a path separator here",
|
"::",
|
||||||
"::",
|
Applicability::MaybeIncorrect,
|
||||||
Applicability::MaybeIncorrect,
|
);
|
||||||
);
|
}
|
||||||
}
|
if self.sess.unstable_features.is_nightly_build() {
|
||||||
if self.sess.unstable_features.is_nightly_build() {
|
// FIXME(Nilstrieb): Remove this again after a few months.
|
||||||
// FIXME(Nilstrieb): Remove this again after a few months.
|
err.note("type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>");
|
||||||
err.note("type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>");
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,5 +4,4 @@ fn main() {
|
||||||
&[1, 2, 3][1:2];
|
&[1, 2, 3][1:2];
|
||||||
//~^ ERROR: expected one of
|
//~^ ERROR: expected one of
|
||||||
//~| HELP: you might have meant to make a slice with range index
|
//~| HELP: you might have meant to make a slice with range index
|
||||||
//~| HELP: maybe write a path separator here
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,15 +4,10 @@ error: expected one of `.`, `?`, `]`, or an operator, found `:`
|
||||||
LL | &[1, 2, 3][1:2];
|
LL | &[1, 2, 3][1:2];
|
||||||
| ^ expected one of `.`, `?`, `]`, or an operator
|
| ^ expected one of `.`, `?`, `]`, or an operator
|
||||||
|
|
|
|
||||||
= note: type ascription syntax has been removed, see issue #101728 <https://github.com/rust-lang/rust/issues/101728>
|
|
||||||
help: you might have meant to make a slice with range index
|
help: you might have meant to make a slice with range index
|
||||||
|
|
|
|
||||||
LL | &[1, 2, 3][1..2];
|
LL | &[1, 2, 3][1..2];
|
||||||
| ~~
|
| ~~
|
||||||
help: maybe write a path separator here
|
|
||||||
|
|
|
||||||
LL | &[1, 2, 3][1::2];
|
|
||||||
| ~~
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to 1 previous error
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue