Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/expr_store/body.rs')
| -rw-r--r-- | crates/hir-def/src/expr_store/body.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/hir-def/src/expr_store/body.rs b/crates/hir-def/src/expr_store/body.rs index 2764677226..3c7452507e 100644 --- a/crates/hir-def/src/expr_store/body.rs +++ b/crates/hir-def/src/expr_store/body.rs @@ -117,7 +117,9 @@ impl Body { impl Body { pub fn root_expr(&self) -> ExprId { - self.store.expr_roots().next().unwrap() + // A `Body` can also contain root expressions that aren't the body (in the param patterns), + // but the body always come last. + self.store.expr_roots().next_back().unwrap() } pub fn pretty_print( |