1
Fork 0
This commit is contained in:
Esteban Küber 2019-05-02 15:53:09 -07:00
parent 617ce2b7ee
commit e0cef5cf40
11 changed files with 23 additions and 23 deletions

View file

@ -4182,7 +4182,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
{ {
err.span_suggestion( err.span_suggestion(
*sp, *sp,
"parenthesis are required to parse this \ "parentheses are required to parse this \
as an expression", as an expression",
format!("({})", snippet), format!("({})", snippet),
Applicability::MachineApplicable, Applicability::MachineApplicable,

View file

@ -2934,7 +2934,7 @@ impl<'a> Parser<'a> {
if let Ok(snippet) = self.sess.source_map().span_to_snippet(*sp) { if let Ok(snippet) = self.sess.source_map().span_to_snippet(*sp) {
err.span_suggestion( err.span_suggestion(
*sp, *sp,
"parenthesis are required to parse this as an expression", "parentheses are required to parse this as an expression",
format!("({})", snippet), format!("({})", snippet),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
@ -2979,7 +2979,7 @@ impl<'a> Parser<'a> {
"struct literals are not allowed here", "struct literals are not allowed here",
); );
err.multipart_suggestion( err.multipart_suggestion(
"surround the struct literal with parenthesis", "surround the struct literal with parentheses",
vec![ vec![
(lo.shrink_to_lo(), "(".to_string()), (lo.shrink_to_lo(), "(".to_string()),
(expr.span.shrink_to_hi(), ")".to_string()), (expr.span.shrink_to_hi(), ")".to_string()),
@ -3661,7 +3661,7 @@ impl<'a> Parser<'a> {
.unwrap_or_else(|_| pprust::expr_to_string(&lhs)); .unwrap_or_else(|_| pprust::expr_to_string(&lhs));
err.span_suggestion( err.span_suggestion(
lhs.span, lhs.span,
"parenthesis are required to parse this as an expression", "parentheses are required to parse this as an expression",
format!("({})", snippet), format!("({})", snippet),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );
@ -4982,7 +4982,7 @@ impl<'a> Parser<'a> {
if let Ok(snippet) = self.sess.source_map().span_to_snippet(*sp) { if let Ok(snippet) = self.sess.source_map().span_to_snippet(*sp) {
err.span_suggestion( err.span_suggestion(
*sp, *sp,
"parenthesis are required to parse this as an expression", "parentheses are required to parse this as an expression",
format!("({})", snippet), format!("({})", snippet),
Applicability::MachineApplicable, Applicability::MachineApplicable,
); );

View file

@ -3,7 +3,7 @@ error: struct literals are not allowed here
| |
LL | if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); } LL | if let S { x: _x, y: 2 } = S { x: 1, y: 2 } { println!("Ok"); }
| ^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | if let S { x: _x, y: 2 } = (S { x: 1, y: 2 }) { println!("Ok"); } LL | if let S { x: _x, y: 2 } = (S { x: 1, y: 2 }) { println!("Ok"); }
| ^ ^ | ^ ^
@ -19,7 +19,7 @@ error: struct literals are not allowed here
| |
LL | for _ in std::ops::Range { start: 0, end: 10 } {} LL | for _ in std::ops::Range { start: 0, end: 10 } {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | for _ in (std::ops::Range { start: 0, end: 10 }) {} LL | for _ in (std::ops::Range { start: 0, end: 10 }) {}
| ^ ^ | ^ ^

View file

@ -4,7 +4,7 @@ error: expected expression, found `+`
LL | {2} + {2} LL | {2} + {2}
| --- ^ expected expression | --- ^ expected expression
| | | |
| help: parenthesis are required to parse this as an expression: `({2})` | help: parentheses are required to parse this as an expression: `({2})`
error: expected expression, found `+` error: expected expression, found `+`
--> $DIR/expr-as-stmt.rs:12:9 --> $DIR/expr-as-stmt.rs:12:9
@ -12,7 +12,7 @@ error: expected expression, found `+`
LL | {2} + 2 LL | {2} + 2
| --- ^ expected expression | --- ^ expected expression
| | | |
| help: parenthesis are required to parse this as an expression: `({2})` | help: parentheses are required to parse this as an expression: `({2})`
error: expected expression, found `+` error: expected expression, found `+`
--> $DIR/expr-as-stmt.rs:18:12 --> $DIR/expr-as-stmt.rs:18:12
@ -20,13 +20,13 @@ error: expected expression, found `+`
LL | { 42 } + foo; LL | { 42 } + foo;
| ------ ^ expected expression | ------ ^ expected expression
| | | |
| help: parenthesis are required to parse this as an expression: `({ 42 })` | help: parentheses are required to parse this as an expression: `({ 42 })`
error: expected expression, found `&&` error: expected expression, found `&&`
--> $DIR/expr-as-stmt.rs:30:5 --> $DIR/expr-as-stmt.rs:30:5
| |
LL | if let Some(x) = a { true } else { false } LL | if let Some(x) = a { true } else { false }
| ------------------------------------------ help: parenthesis are required to parse this as an expression: `(if let Some(x) = a { true } else { false })` | ------------------------------------------ help: parentheses are required to parse this as an expression: `(if let Some(x) = a { true } else { false })`
LL | && LL | &&
| ^^ expected expression | ^^ expected expression
@ -35,7 +35,7 @@ error: expected expression, found `>`
| |
LL | } > 0 LL | } > 0
| ^ expected expression | ^ expected expression
help: parenthesis are required to parse this as an expression help: parentheses are required to parse this as an expression
| |
LL | (match x { LL | (match x {
LL | _ => 1, LL | _ => 1,
@ -84,7 +84,7 @@ error[E0614]: type `{integer}` cannot be dereferenced
LL | { 3 } * 3 LL | { 3 } * 3
| ----- ^^^ | ----- ^^^
| | | |
| help: parenthesis are required to parse this as an expression: `({ 3 })` | help: parentheses are required to parse this as an expression: `({ 3 })`
error: aborting due to 10 previous errors error: aborting due to 10 previous errors

View file

@ -3,7 +3,7 @@ error: expected pattern, found `+`
| |
LL | } + 5 LL | } + 5
| ^ expected pattern | ^ expected pattern
help: parenthesis are required to parse this as an expression help: parentheses are required to parse this as an expression
| |
LL | 0 => ({ LL | 0 => ({
LL | 0 LL | 0

View file

@ -6,7 +6,7 @@ LL | for x in Foo {
LL | | x: 3 LL | | x: 3
LL | | }.hi() { LL | | }.hi() {
| |_____^ | |_____^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | for x in (Foo { LL | for x in (Foo {
LL | x: 3 LL | x: 3

View file

@ -6,7 +6,7 @@ LL | if Foo {
LL | | x: 3 LL | | x: 3
LL | | }.hi() { LL | | }.hi() {
| |_____^ | |_____^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | if (Foo { LL | if (Foo {
LL | x: 3 LL | x: 3

View file

@ -6,7 +6,7 @@ LL | match Foo {
LL | | x: 3 LL | | x: 3
LL | | } { LL | | } {
| |_____^ | |_____^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | match (Foo { LL | match (Foo {
LL | x: 3 LL | x: 3

View file

@ -6,7 +6,7 @@ LL | while Foo {
LL | | x: 3 LL | | x: 3
LL | | }.hi() { LL | | }.hi() {
| |_____^ | |_____^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | while (Foo { LL | while (Foo {
LL | x: 3 LL | x: 3

View file

@ -6,7 +6,7 @@ LL | while || Foo {
LL | | x: 3 LL | | x: 3
LL | | }.hi() { LL | | }.hi() {
| |_____^ | |_____^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | while || (Foo { LL | while || (Foo {
LL | x: 3 LL | x: 3

View file

@ -3,7 +3,7 @@ error: struct literals are not allowed here
| |
LL | if x == E::I { field1: true, field2: 42 } {} LL | if x == E::I { field1: true, field2: 42 } {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | if x == (E::I { field1: true, field2: 42 }) {} LL | if x == (E::I { field1: true, field2: 42 }) {}
| ^ ^ | ^ ^
@ -13,7 +13,7 @@ error: struct literals are not allowed here
| |
LL | if x == E::V { field: false } {} LL | if x == E::V { field: false } {}
| ^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | if x == (E::V { field: false }) {} LL | if x == (E::V { field: false }) {}
| ^ ^ | ^ ^
@ -23,7 +23,7 @@ error: struct literals are not allowed here
| |
LL | if x == E::J { field: -42 } {} LL | if x == E::J { field: -42 } {}
| ^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | if x == (E::J { field: -42 }) {} LL | if x == (E::J { field: -42 }) {}
| ^ ^ | ^ ^
@ -33,7 +33,7 @@ error: struct literals are not allowed here
| |
LL | if x == E::K { field: "" } {} LL | if x == E::K { field: "" } {}
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
help: surround the struct literal with parenthesis help: surround the struct literal with parentheses
| |
LL | if x == (E::K { field: "" }) {} LL | if x == (E::K { field: "" }) {}
| ^ ^ | ^ ^