about summary refs log tree commit diff
path: root/src/librustc_parse/parser/expr.rs
diff options
context:
space:
mode:
authorTyson Nottingham <tgnottingham@gmail.com>2020-08-17 19:15:51 -0700
committerTyson Nottingham <tgnottingham@gmail.com>2020-08-18 12:15:57 -0700
commitff73a409957d704aba735fb29ab4be2d77efe958 (patch)
tree284576d5b5de610900c636b143d7dfe956be7f06 /src/librustc_parse/parser/expr.rs
parent792c645ca7d11a8d254df307d019c5bf01445c37 (diff)
downloadrust-ff73a409957d704aba735fb29ab4be2d77efe958.tar.gz
rust-ff73a409957d704aba735fb29ab4be2d77efe958.zip
Don't emit "is not a logical operator" error outside of associative expressions
Avoid showing this error where it doesn't make sense by not assuming
"and" and "or" were intended to mean "&&" and "||" until after we decide
to continue parsing input as an associative expression.

Note that the decision of whether or not to continue parsing input as an
associative expression doesn't actually depend on this assumption.

Fixes #75599
Diffstat (limited to 'src/librustc_parse/parser/expr.rs')
-rw-r--r--src/librustc_parse/parser/expr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs
index 0ceb588b3af..d16347954fa 100644
--- a/src/librustc_parse/parser/expr.rs
+++ b/src/librustc_parse/parser/expr.rs
@@ -308,7 +308,7 @@ impl<'a> Parser<'a> {
     }
 
     fn should_continue_as_assoc_expr(&mut self, lhs: &Expr) -> bool {
-        match (self.expr_is_complete(lhs), self.check_assoc_op().map(|op| op.node)) {
+        match (self.expr_is_complete(lhs), AssocOp::from_token(&self.token)) {
             // Semi-statement forms are odd:
             // See https://github.com/rust-lang/rust/issues/29071
             (true, None) => false,