about summary refs log tree commit diff
path: root/compiler/rustc_ast/src/util
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2022-09-08 10:52:51 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2022-11-17 13:45:59 +1100
commit6b7ca2fcf2ebbba705f7a98c00bd56b5348ee9d7 (patch)
tree36212a72da44e033e4bae2d42d087abcf488748f /compiler/rustc_ast/src/util
parentbebd57a9602e48431c90274fbf7d96683b0708b6 (diff)
downloadrust-6b7ca2fcf2ebbba705f7a98c00bd56b5348ee9d7.tar.gz
rust-6b7ca2fcf2ebbba705f7a98c00bd56b5348ee9d7.zip
Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and patterns.
Diffstat (limited to 'compiler/rustc_ast/src/util')
-rw-r--r--compiler/rustc_ast/src/util/classify.rs4
-rw-r--r--compiler/rustc_ast/src/util/parser.rs2
2 files changed, 4 insertions, 2 deletions
diff --git a/compiler/rustc_ast/src/util/classify.rs b/compiler/rustc_ast/src/util/classify.rs
index 6ea3db6d303..fbb4cf43a95 100644
--- a/compiler/rustc_ast/src/util/classify.rs
+++ b/compiler/rustc_ast/src/util/classify.rs
@@ -36,7 +36,6 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
             | Binary(_, _, e)
             | Box(e)
             | Break(_, Some(e))
-            | Closure(.., e, _)
             | Let(_, e, _)
             | Range(_, Some(e), _)
             | Ret(Some(e))
@@ -44,6 +43,9 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
             | Yield(Some(e)) => {
                 expr = e;
             }
+            Closure(closure) => {
+                expr = &closure.body;
+            }
             Async(..) | Block(..) | ForLoop(..) | If(..) | Loop(..) | Match(..) | Struct(..)
             | TryBlock(..) | While(..) => break Some(expr),
             _ => break None,
diff --git a/compiler/rustc_ast/src/util/parser.rs b/compiler/rustc_ast/src/util/parser.rs
index b40ad6f700e..30c55dffb18 100644
--- a/compiler/rustc_ast/src/util/parser.rs
+++ b/compiler/rustc_ast/src/util/parser.rs
@@ -396,7 +396,7 @@ pub fn contains_exterior_struct_lit(value: &ast::Expr) -> bool {
             contains_exterior_struct_lit(&x)
         }
 
-        ast::ExprKind::MethodCall(_, ref receiver, _, _) => {
+        ast::ExprKind::MethodCall(box ast::MethodCall { ref receiver, .. }) => {
             // X { y: 1 }.bar(...)
             contains_exterior_struct_lit(&receiver)
         }