Skip to content

Commit c09c73b

Browse files
committed
Reword suggestion message
1 parent 629a69f commit c09c73b

10 files changed

+23
-23
lines changed

Diff for: compiler/rustc_parse/src/parser/stmt.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ impl<'a> Parser<'a> {
581581
{
582582
// These are more likely to have been meant as a block body.
583583
e.multipart_suggestion(
584-
"try placing this code inside a block",
584+
"you might have meant to write this as part of a block",
585585
vec![
586586
(stmt_span.shrink_to_lo(), "{ ".to_string()),
587587
(stmt_span.shrink_to_hi(), " }".to_string()),
@@ -593,7 +593,7 @@ impl<'a> Parser<'a> {
593593
(token::OpenDelim(Delimiter::Brace), _) => {}
594594
(_, _) => {
595595
e.multipart_suggestion(
596-
"try placing this code inside a block",
596+
"you might have meant to write this as part of a block",
597597
vec![
598598
(stmt_span.shrink_to_lo(), "{ ".to_string()),
599599
(stmt_span.shrink_to_hi(), " }".to_string()),

Diff for: tests/ui/let-else/let-else-if.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: conditional `else if` is not supported for `let...else`
44
LL | let Some(_) = Some(()) else if true {
55
| ^^ expected `{`
66
|
7-
help: try placing this code inside a block
7+
help: you might have meant to write this as part of a block
88
|
99
LL ~ let Some(_) = Some(()) else { if true {
1010
LL |

Diff for: tests/ui/lint/issue-104392.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | { unsafe 92 }
66
| |
77
| while parsing this `unsafe` expression
88
|
9-
help: try placing this code inside a block
9+
help: you might have meant to write this as part of a block
1010
|
1111
LL | { unsafe { 92 } }
1212
| + +

Diff for: tests/ui/missing/missing-block-hint.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ note: the `if` expression is missing a block after this condition
2525
|
2626
LL | if (foo)
2727
| ^^^^^
28-
help: try placing this code inside a block
28+
help: you might have meant to write this as part of a block
2929
|
3030
LL | { bar; }
3131
| + +

Diff for: tests/ui/parser/bad-if-statements.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ note: the `if` expression is missing a block after this condition
2929
|
3030
LL | if true x
3131
| ^^^^
32-
help: try placing this code inside a block
32+
help: you might have meant to write this as part of a block
3333
|
3434
LL | if true { x }
3535
| + +
@@ -65,7 +65,7 @@ note: the `if` expression is missing a block after this condition
6565
|
6666
LL | if true x else {}
6767
| ^^^^
68-
help: try placing this code inside a block
68+
help: you might have meant to write this as part of a block
6969
|
7070
LL | if true { x } else {}
7171
| + +

Diff for: tests/ui/parser/block-no-opening-brace.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | loop
66
LL | let x = 0;
77
| ^^^ expected `{`
88
|
9-
help: try placing this code inside a block
9+
help: you might have meant to write this as part of a block
1010
|
1111
LL | { let x = 0; }
1212
| + +
@@ -21,7 +21,7 @@ LL | while true
2121
LL | let x = 0;
2222
| ^^^ expected `{`
2323
|
24-
help: try placing this code inside a block
24+
help: you might have meant to write this as part of a block
2525
|
2626
LL | { let x = 0; }
2727
| + +
@@ -32,7 +32,7 @@ error: expected `{`, found keyword `let`
3232
LL | let x = 0;
3333
| ^^^ expected `{`
3434
|
35-
help: try placing this code inside a block
35+
help: you might have meant to write this as part of a block
3636
|
3737
LL | { let x = 0; }
3838
| + +

Diff for: tests/ui/parser/closure-return-syntax.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error: expected `{`, found `22`
44
LL | let x = || -> i32 22;
55
| ^^ expected `{`
66
|
7-
help: try placing this code inside a block
7+
help: you might have meant to write this as part of a block
88
|
99
LL | let x = || -> i32 { 22 };
1010
| + +

Diff for: tests/ui/parser/else-no-if.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ error: expected `{`, found `falsy`
3030
LL | } else falsy();
3131
| ^^^^^ expected `{`
3232
|
33-
help: try placing this code inside a block
33+
help: you might have meant to write this as part of a block
3434
|
3535
LL | } else { falsy() };
3636
| + +
@@ -41,7 +41,7 @@ error: expected `{`, found keyword `loop`
4141
LL | } else loop{}
4242
| ^^^^ expected `{`
4343
|
44-
help: try placing this code inside a block
44+
help: you might have meant to write this as part of a block
4545
|
4646
LL | } else { loop{} }
4747
| + +
@@ -65,7 +65,7 @@ error: expected `{`, found `falsy`
6565
LL | } else falsy!();
6666
| ^^^^^ expected `{`
6767
|
68-
help: try placing this code inside a block
68+
help: you might have meant to write this as part of a block
6969
|
7070
LL | } else { falsy!() };
7171
| + +
@@ -89,7 +89,7 @@ error: expected `{`, found `falsy`
8989
LL | } else falsy! {};
9090
| ^^^^^ expected `{`
9191
|
92-
help: try placing this code inside a block
92+
help: you might have meant to write this as part of a block
9393
|
9494
LL | } else { falsy! {} };
9595
| + +

Diff for: tests/ui/parser/label-after-block-like.stderr

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ note: the `if` expression is missing a block after this condition
2323
|
2424
LL | if let () = () 'a {}
2525
| ^^^^^^^^^^^
26-
help: try placing this code inside a block
26+
help: you might have meant to write this as part of a block
2727
|
2828
LL | if let () = () { 'a {} }
2929
| + +
@@ -53,7 +53,7 @@ note: the `if` expression is missing a block after this condition
5353
|
5454
LL | if true 'a {}
5555
| ^^^^
56-
help: try placing this code inside a block
56+
help: you might have meant to write this as part of a block
5757
|
5858
LL | if true { 'a {} }
5959
| + +
@@ -80,7 +80,7 @@ LL | loop 'a {}
8080
| |
8181
| while parsing this `loop` expression
8282
|
83-
help: try placing this code inside a block
83+
help: you might have meant to write this as part of a block
8484
|
8585
LL | loop { 'a {} }
8686
| + +
@@ -108,7 +108,7 @@ LL | while true 'a {}
108108
| | this `while` condition successfully parsed
109109
| while parsing the body of this `while` expression
110110
|
111-
help: try placing this code inside a block
111+
help: you might have meant to write this as part of a block
112112
|
113113
LL | while true { 'a {} }
114114
| + +
@@ -136,7 +136,7 @@ LL | while let () = () 'a {}
136136
| | this `while` condition successfully parsed
137137
| while parsing the body of this `while` expression
138138
|
139-
help: try placing this code inside a block
139+
help: you might have meant to write this as part of a block
140140
|
141141
LL | while let () = () { 'a {} }
142142
| + +
@@ -161,7 +161,7 @@ error: expected `{`, found `'a`
161161
LL | for _ in 0..0 'a {}
162162
| ^^ expected `{`
163163
|
164-
help: try placing this code inside a block
164+
help: you might have meant to write this as part of a block
165165
|
166166
LL | for _ in 0..0 { 'a {} }
167167
| + +
@@ -188,7 +188,7 @@ LL | unsafe 'a {}
188188
| |
189189
| while parsing this `unsafe` expression
190190
|
191-
help: try placing this code inside a block
191+
help: you might have meant to write this as part of a block
192192
|
193193
LL | unsafe { 'a {} }
194194
| + +

Diff for: tests/ui/unsafe/unsafe-block-without-braces.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | unsafe //{
66
LL | std::mem::transmute::<f32, u32>(1.0);
77
| ^^^ expected `{`
88
|
9-
help: try placing this code inside a block
9+
help: you might have meant to write this as part of a block
1010
|
1111
LL | { std::mem::transmute::<f32, u32>(1.0); }
1212
| + +

0 commit comments

Comments
 (0)