diff options
| author | Lukas Markeffsky <@> | 2022-12-03 23:54:06 +0100 |
|---|---|---|
| committer | Lukas Markeffsky <@> | 2022-12-03 23:54:06 +0100 |
| commit | c808d0b289c1f8e0f26885bf44cb2ba1873ba10e (patch) | |
| tree | 2c749b95c1092ed834008f6a415b396afc843b98 /compiler/rustc_parse/src/parser/expr.rs | |
| parent | 35c00a9731809292959e98b1e7da3c6e2673f3cc (diff) | |
| download | rust-c808d0b289c1f8e0f26885bf44cb2ba1873ba10e.tar.gz rust-c808d0b289c1f8e0f26885bf44cb2ba1873ba10e.zip | |
more comments
Diffstat (limited to 'compiler/rustc_parse/src/parser/expr.rs')
| -rw-r--r-- | compiler/rustc_parse/src/parser/expr.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 377638ab968..0a948a2810a 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -390,10 +390,11 @@ impl<'a> Parser<'a> { // want to keep their span info to improve diagnostics in these cases in a later stage. (true, Some(AssocOp::Multiply)) | // `{ 42 } *foo = bar;` or `{ 42 } * 3` (true, Some(AssocOp::Subtract)) | // `{ 42 } -5` - (true, Some(AssocOp::Add)) | // `{ 42 } + 42 + (true, Some(AssocOp::Add)) | // `{ 42 } + 42` (unary plus) (true, Some(AssocOp::LAnd)) | // `{ 42 } &&x` (#61475) or `{ 42 } && if x { 1 } else { 0 }` - (true, Some(AssocOp::LOr)) | - (true, Some(AssocOp::BitOr)) => { + (true, Some(AssocOp::LOr)) | // `{ 42 } || 42` ("logical or" or closure) + (true, Some(AssocOp::BitOr)) // `{ 42 } | 42` or `{ 42 } |x| 42` + => { // These cases are ambiguous and can't be identified in the parser alone. // // Bitwise AND is left out because guessing intent is hard. We can make |
