Skip to content

Commit ceb5598

Browse files
Add inline const and other possible curly brace expressions to expr_trailing_brace
1 parent f7af36b commit ceb5598

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

compiler/rustc_ast/src/util/classify.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,20 +40,21 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
4040
| Range(_, Some(e), _)
4141
| Ret(Some(e))
4242
| Unary(_, e)
43-
| Yield(Some(e)) => {
43+
| Yield(Some(e))
44+
| Yeet(Some(e))
45+
| Become(e) => {
4446
expr = e;
4547
}
4648
Closure(closure) => {
4749
expr = &closure.body;
4850
}
4951
Gen(..) | Block(..) | ForLoop(..) | If(..) | Loop(..) | Match(..) | Struct(..)
50-
| TryBlock(..) | While(..) => break Some(expr),
52+
| TryBlock(..) | While(..) | ConstBlock(_) => break Some(expr),
5153
Break(_, _)
5254
| Range(_, _, _)
5355
| Ret(_)
5456
| Yield(_)
5557
| Array(_)
56-
| ConstBlock(_)
5758
| Call(_, _)
5859
| MethodCall(_)
5960
| Tup(_)
@@ -66,17 +67,22 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
6667
| Underscore
6768
| Path(_, _)
6869
| Continue(_)
69-
| InlineAsm(_)
70-
| OffsetOf(_, _)
71-
| MacCall(_)
7270
| Repeat(_, _)
7371
| Paren(_)
7472
| Try(_)
7573
| Yeet(_)
76-
| Become(_)
74+
| InlineAsm(_)
75+
| OffsetOf(_, _)
76+
| MacCall(_)
7777
| IncludedBytes(_)
7878
| FormatArgs(_)
79-
| Err => break None, // _ => break None,
79+
| Err => break None,
80+
// More complex cases
81+
// InlineAsm
82+
// OffsetOf
83+
// MacCall
84+
// IncludedBytes
85+
// FormatArgs
8086
}
8187
}
8288
}

0 commit comments

Comments
 (0)