提交 41f58a7c 编写于 作者: K keatinge

Add help message for incorrect pattern syntax

上级 90e019ba
......@@ -3432,7 +3432,16 @@ fn parse_pats(&mut self) -> PResult<'a, Vec<P<Pat>>> {
loop {
pats.push(self.parse_pat()?);
if self.check(&token::BinOp(token::Or)) { self.bump();}
else { return Ok(pats); }
else {
// Accidental use of || instead of | inbetween patterns
if self.token == token::OrOr {
return Err(self.span_fatal_help(
self.span, "Unexpected token `||` after pattern",
"Did you mean to use `|` to specify multiple patterns instead?"));
}
return Ok(pats);
}
};
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册