Skip to content

Commit bde1eaa

Browse files
committed
Expose expr_unsafe in LoweringContext.
1 parent a62287e commit bde1eaa

File tree

1 file changed

+8
-5
lines changed
  • compiler/rustc_ast_lowering/src

1 file changed

+8
-5
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -924,7 +924,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
924924
arena_vec![self; new_unchecked, get_context],
925925
),
926926
};
927-
self.arena.alloc(self.expr_unsafe(call))
927+
self.arena.alloc(self.expr_unsafe(span, call))
928928
};
929929

930930
// `::std::task::Poll::Ready(result) => break result`
@@ -1826,7 +1826,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
18261826
arena_vec![self; iter],
18271827
));
18281828
// `unsafe { ... }`
1829-
let iter = self.arena.alloc(self.expr_unsafe(iter));
1829+
let iter = self.arena.alloc(self.expr_unsafe(head_span, iter));
18301830
let kind = self.make_lowered_await(head_span, iter, FutureKind::AsyncIterator);
18311831
self.arena.alloc(hir::Expr { hir_id: self.next_id(), kind, span: head_span })
18321832
}
@@ -1881,7 +1881,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
18811881
arena_vec![self; iter],
18821882
));
18831883
// `unsafe { ... }`
1884-
let iter = self.arena.alloc(self.expr_unsafe(iter));
1884+
let iter = self.arena.alloc(self.expr_unsafe(head_span, iter));
18851885
let inner_match_expr = self.arena.alloc(self.expr_match(
18861886
for_span,
18871887
iter,
@@ -2256,9 +2256,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
22562256
self.expr(span, expr_path)
22572257
}
22582258

2259-
fn expr_unsafe(&mut self, expr: &'hir hir::Expr<'hir>) -> hir::Expr<'hir> {
2259+
pub(super) fn expr_unsafe(
2260+
&mut self,
2261+
span: Span,
2262+
expr: &'hir hir::Expr<'hir>,
2263+
) -> hir::Expr<'hir> {
22602264
let hir_id = self.next_id();
2261-
let span = expr.span;
22622265
self.expr(
22632266
span,
22642267
hir::ExprKind::Block(

0 commit comments

Comments
 (0)