1
Fork 0

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:
Matthias Krüger 2024-01-19 08:15:03 +01:00 committed by GitHub
commit 2e4c6fc998
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 98 additions and 21 deletions

View file

@ -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;
}