diff options
| author | Hirochika Matsumoto <hirochika.k.matsumoto@gmail.com> | 2023-11-27 22:18:03 +0900 |
|---|---|---|
| committer | Hirochika Matsumoto <hirochika.k.matsumoto@gmail.com> | 2023-11-27 22:18:03 +0900 |
| commit | acec70de9b0b76cb5b077b030360fa217ccdcdec (patch) | |
| tree | 5cb1c4c0d63bdf0393d18e578d8c6743f774c3ed | |
| parent | 730d299354f7ef09d8e30609110fc499e0e22d71 (diff) | |
| download | rust-acec70de9b0b76cb5b077b030360fa217ccdcdec.tar.gz rust-acec70de9b0b76cb5b077b030360fa217ccdcdec.zip | |
Change help message to make some sense in broader context
| -rw-r--r-- | compiler/rustc_parse/src/parser/stmt.rs | 2 | ||||
| -rw-r--r-- | tests/ui/suggestions/range-index-instead-of-colon.rs | 2 | ||||
| -rw-r--r-- | tests/ui/suggestions/range-index-instead-of-colon.stderr | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 391a4777bd9..620ba4a3cb3 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -578,7 +578,7 @@ impl<'a> Parser<'a> { // this only when parsing an index expression. err.span_suggestion_verbose( self.token.span, - "you might have meant to make a slice with range index", + "you might have meant a range expression", "..", Applicability::MaybeIncorrect, ); diff --git a/tests/ui/suggestions/range-index-instead-of-colon.rs b/tests/ui/suggestions/range-index-instead-of-colon.rs index 0805102de78..3267527ecf2 100644 --- a/tests/ui/suggestions/range-index-instead-of-colon.rs +++ b/tests/ui/suggestions/range-index-instead-of-colon.rs @@ -3,5 +3,5 @@ fn main() { &[1, 2, 3][1:2]; //~^ ERROR: expected one of - //~| HELP: you might have meant to make a slice with range index + //~| HELP: you might have meant a range expression } diff --git a/tests/ui/suggestions/range-index-instead-of-colon.stderr b/tests/ui/suggestions/range-index-instead-of-colon.stderr index c7a12e9e4fb..df29356cc16 100644 --- a/tests/ui/suggestions/range-index-instead-of-colon.stderr +++ b/tests/ui/suggestions/range-index-instead-of-colon.stderr @@ -4,7 +4,7 @@ error: expected one of `.`, `?`, `]`, or an operator, found `:` LL | &[1, 2, 3][1:2]; | ^ expected one of `.`, `?`, `]`, or an operator | -help: you might have meant to make a slice with range index +help: you might have meant a range expression | LL | &[1, 2, 3][1..2]; | ~~ |
