Rollup merge of #130314 - compiler-errors:mac-prec, r=davidtwco
Use the same precedence for all macro-like exprs No need to make these have a different precedence since they're all written like `whatever!(expr)`, and it makes it simpler when adding new macro-based built-in operators in the future.
This commit is contained in:
commit
c896f06bdb
3 changed files with 10 additions and 14 deletions
|
@ -1293,7 +1293,7 @@ impl Expr {
|
||||||
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
|
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
|
||||||
ExprKind::Unary(..) => ExprPrecedence::Unary,
|
ExprKind::Unary(..) => ExprPrecedence::Unary,
|
||||||
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) => ExprPrecedence::Lit,
|
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) => ExprPrecedence::Lit,
|
||||||
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast,
|
ExprKind::Cast(..) => ExprPrecedence::Cast,
|
||||||
ExprKind::Let(..) => ExprPrecedence::Let,
|
ExprKind::Let(..) => ExprPrecedence::Let,
|
||||||
ExprKind::If(..) => ExprPrecedence::If,
|
ExprKind::If(..) => ExprPrecedence::If,
|
||||||
ExprKind::While(..) => ExprPrecedence::While,
|
ExprKind::While(..) => ExprPrecedence::While,
|
||||||
|
@ -1317,17 +1317,18 @@ impl Expr {
|
||||||
ExprKind::Break(..) => ExprPrecedence::Break,
|
ExprKind::Break(..) => ExprPrecedence::Break,
|
||||||
ExprKind::Continue(..) => ExprPrecedence::Continue,
|
ExprKind::Continue(..) => ExprPrecedence::Continue,
|
||||||
ExprKind::Ret(..) => ExprPrecedence::Ret,
|
ExprKind::Ret(..) => ExprPrecedence::Ret,
|
||||||
ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm,
|
|
||||||
ExprKind::OffsetOf(..) => ExprPrecedence::OffsetOf,
|
|
||||||
ExprKind::MacCall(..) => ExprPrecedence::Mac,
|
|
||||||
ExprKind::Struct(..) => ExprPrecedence::Struct,
|
ExprKind::Struct(..) => ExprPrecedence::Struct,
|
||||||
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
|
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
|
||||||
ExprKind::Paren(..) => ExprPrecedence::Paren,
|
ExprKind::Paren(..) => ExprPrecedence::Paren,
|
||||||
ExprKind::Try(..) => ExprPrecedence::Try,
|
ExprKind::Try(..) => ExprPrecedence::Try,
|
||||||
ExprKind::Yield(..) => ExprPrecedence::Yield,
|
ExprKind::Yield(..) => ExprPrecedence::Yield,
|
||||||
ExprKind::Yeet(..) => ExprPrecedence::Yeet,
|
ExprKind::Yeet(..) => ExprPrecedence::Yeet,
|
||||||
ExprKind::FormatArgs(..) => ExprPrecedence::FormatArgs,
|
|
||||||
ExprKind::Become(..) => ExprPrecedence::Become,
|
ExprKind::Become(..) => ExprPrecedence::Become,
|
||||||
|
ExprKind::InlineAsm(..)
|
||||||
|
| ExprKind::Type(..)
|
||||||
|
| ExprKind::OffsetOf(..)
|
||||||
|
| ExprKind::FormatArgs(..)
|
||||||
|
| ExprKind::MacCall(..) => ExprPrecedence::Mac,
|
||||||
ExprKind::Err(_) | ExprKind::Dummy => ExprPrecedence::Err,
|
ExprKind::Err(_) | ExprKind::Dummy => ExprPrecedence::Err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -265,10 +265,7 @@ pub enum ExprPrecedence {
|
||||||
Field,
|
Field,
|
||||||
Index,
|
Index,
|
||||||
Try,
|
Try,
|
||||||
InlineAsm,
|
|
||||||
OffsetOf,
|
|
||||||
Mac,
|
Mac,
|
||||||
FormatArgs,
|
|
||||||
|
|
||||||
Array,
|
Array,
|
||||||
Repeat,
|
Repeat,
|
||||||
|
@ -333,17 +330,14 @@ impl ExprPrecedence {
|
||||||
| ExprPrecedence::ConstBlock
|
| ExprPrecedence::ConstBlock
|
||||||
| ExprPrecedence::Field
|
| ExprPrecedence::Field
|
||||||
| ExprPrecedence::ForLoop
|
| ExprPrecedence::ForLoop
|
||||||
| ExprPrecedence::FormatArgs
|
|
||||||
| ExprPrecedence::Gen
|
| ExprPrecedence::Gen
|
||||||
| ExprPrecedence::If
|
| ExprPrecedence::If
|
||||||
| ExprPrecedence::Index
|
| ExprPrecedence::Index
|
||||||
| ExprPrecedence::InlineAsm
|
|
||||||
| ExprPrecedence::Lit
|
| ExprPrecedence::Lit
|
||||||
| ExprPrecedence::Loop
|
| ExprPrecedence::Loop
|
||||||
| ExprPrecedence::Mac
|
| ExprPrecedence::Mac
|
||||||
| ExprPrecedence::Match
|
| ExprPrecedence::Match
|
||||||
| ExprPrecedence::MethodCall
|
| ExprPrecedence::MethodCall
|
||||||
| ExprPrecedence::OffsetOf
|
|
||||||
| ExprPrecedence::Paren
|
| ExprPrecedence::Paren
|
||||||
| ExprPrecedence::Path
|
| ExprPrecedence::Path
|
||||||
| ExprPrecedence::PostfixMatch
|
| ExprPrecedence::PostfixMatch
|
||||||
|
|
|
@ -1726,7 +1726,7 @@ impl Expr<'_> {
|
||||||
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
|
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
|
||||||
ExprKind::Unary(..) => ExprPrecedence::Unary,
|
ExprKind::Unary(..) => ExprPrecedence::Unary,
|
||||||
ExprKind::Lit(_) => ExprPrecedence::Lit,
|
ExprKind::Lit(_) => ExprPrecedence::Lit,
|
||||||
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast,
|
ExprKind::Cast(..) => ExprPrecedence::Cast,
|
||||||
ExprKind::DropTemps(ref expr, ..) => expr.precedence(),
|
ExprKind::DropTemps(ref expr, ..) => expr.precedence(),
|
||||||
ExprKind::If(..) => ExprPrecedence::If,
|
ExprKind::If(..) => ExprPrecedence::If,
|
||||||
ExprKind::Let(..) => ExprPrecedence::Let,
|
ExprKind::Let(..) => ExprPrecedence::Let,
|
||||||
|
@ -1744,11 +1744,12 @@ impl Expr<'_> {
|
||||||
ExprKind::Continue(..) => ExprPrecedence::Continue,
|
ExprKind::Continue(..) => ExprPrecedence::Continue,
|
||||||
ExprKind::Ret(..) => ExprPrecedence::Ret,
|
ExprKind::Ret(..) => ExprPrecedence::Ret,
|
||||||
ExprKind::Become(..) => ExprPrecedence::Become,
|
ExprKind::Become(..) => ExprPrecedence::Become,
|
||||||
ExprKind::InlineAsm(..) => ExprPrecedence::InlineAsm,
|
|
||||||
ExprKind::OffsetOf(..) => ExprPrecedence::OffsetOf,
|
|
||||||
ExprKind::Struct(..) => ExprPrecedence::Struct,
|
ExprKind::Struct(..) => ExprPrecedence::Struct,
|
||||||
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
|
ExprKind::Repeat(..) => ExprPrecedence::Repeat,
|
||||||
ExprKind::Yield(..) => ExprPrecedence::Yield,
|
ExprKind::Yield(..) => ExprPrecedence::Yield,
|
||||||
|
ExprKind::Type(..) | ExprKind::InlineAsm(..) | ExprKind::OffsetOf(..) => {
|
||||||
|
ExprPrecedence::Mac
|
||||||
|
}
|
||||||
ExprKind::Err(_) => ExprPrecedence::Err,
|
ExprKind::Err(_) => ExprPrecedence::Err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue