Rollup merge of #119062 - compiler-errors:asm-in-let-else, r=davidtwco,est31
Deny braced macro invocations in let-else Fixes #119057 Pending T-lang decision cc `@dtolnay`
This commit is contained in:
commit
2e4c6fc998
7 changed files with 98 additions and 21 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
// Predicates on exprs and stmts that the pretty-printer and parser use
|
||||
|
||||
use crate::ast;
|
||||
use crate::{ast, token::Delimiter};
|
||||
|
||||
/// Does this expression require a semicolon to be treated
|
||||
/// as a statement? The negation of this: 'can this expression
|
||||
|
@ -59,8 +59,12 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
|
|||
| While(..)
|
||||
| ConstBlock(_) => break Some(expr),
|
||||
|
||||
// FIXME: These can end in `}`, but changing these would break stable code.
|
||||
InlineAsm(_) | OffsetOf(_, _) | MacCall(_) | IncludedBytes(_) | FormatArgs(_) => {
|
||||
MacCall(mac) => {
|
||||
break (mac.args.delim == Delimiter::Brace).then_some(expr);
|
||||
}
|
||||
|
||||
InlineAsm(_) | OffsetOf(_, _) | IncludedBytes(_) | FormatArgs(_) => {
|
||||
// These should have been denied pre-expansion.
|
||||
break None;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue