Skip to content

Commit 241a654

Browse files
committed
Fix remaining uses of CaptureBy::Value
1 parent 8de4899 commit 241a654

File tree

5 files changed

+9
-9
lines changed

5 files changed

+9
-9
lines changed

Diff for: compiler/rustc_ast_lowering/src/item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12011201
}
12021202

12031203
let async_expr = this.make_async_expr(
1204-
CaptureBy::Value,
1204+
CaptureBy::Value { move_kw: rustc_span::DUMMY_SP },
12051205
closure_id,
12061206
None,
12071207
body.span,

Diff for: compiler/rustc_ast_pretty/src/pprust/state/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ impl<'a> State<'a> {
673673

674674
fn print_capture_clause(&mut self, capture_clause: ast::CaptureBy) {
675675
match capture_clause {
676-
ast::CaptureBy::Value => self.word_space("move"),
676+
ast::CaptureBy::Value { .. } => self.word_space("move"),
677677
ast::CaptureBy::Ref => {}
678678
}
679679
}

Diff for: compiler/rustc_hir_pretty/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2017,7 +2017,7 @@ impl<'a> State<'a> {
20172017

20182018
fn print_capture_clause(&mut self, capture_clause: hir::CaptureBy) {
20192019
match capture_clause {
2020-
hir::CaptureBy::Value => self.word_space("move"),
2020+
hir::CaptureBy::Value { .. } => self.word_space("move"),
20212021
hir::CaptureBy::Ref => {}
20222022
}
20232023
}

Diff for: compiler/rustc_hir_typeck/src/upvar.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
424424
origin = updated.1;
425425

426426
let (place, capture_kind) = match capture_clause {
427-
hir::CaptureBy::Value => adjust_for_move_closure(place, capture_kind),
427+
hir::CaptureBy::Value { .. } => adjust_for_move_closure(place, capture_kind),
428428
hir::CaptureBy::Ref => adjust_for_non_move_closure(place, capture_kind),
429429
};
430430

@@ -958,7 +958,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
958958
let ty = self.resolve_vars_if_possible(self.node_ty(var_hir_id));
959959

960960
let ty = match closure_clause {
961-
hir::CaptureBy::Value => ty, // For move closure the capture kind should be by value
961+
hir::CaptureBy::Value { .. } => ty, // For move closure the capture kind should be by value
962962
hir::CaptureBy::Ref => {
963963
// For non move closure the capture kind is the max capture kind of all captures
964964
// according to the ordering ImmBorrow < UniqueImmBorrow < MutBorrow < ByValue
@@ -1073,7 +1073,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
10731073

10741074
match closure_clause {
10751075
// Only migrate if closure is a move closure
1076-
hir::CaptureBy::Value => {
1076+
hir::CaptureBy::Value { .. } => {
10771077
let mut diagnostics_info = FxIndexSet::default();
10781078
let upvars =
10791079
self.tcx.upvars_mentioned(closure_def_id).expect("must be an upvar");
@@ -1479,10 +1479,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14791479
// If the data will be moved out of this place, then the place will be truncated
14801480
// at the first Deref in `adjust_upvar_borrow_kind_for_consume` and then moved into
14811481
// the closure.
1482-
hir::CaptureBy::Value if !place.deref_tys().any(Ty::is_ref) => {
1482+
hir::CaptureBy::Value { .. } if !place.deref_tys().any(Ty::is_ref) => {
14831483
ty::UpvarCapture::ByValue
14841484
}
1485-
hir::CaptureBy::Value | hir::CaptureBy::Ref => ty::UpvarCapture::ByRef(ty::ImmBorrow),
1485+
hir::CaptureBy::Value { .. } | hir::CaptureBy::Ref => ty::UpvarCapture::ByRef(ty::ImmBorrow),
14861486
}
14871487
}
14881488

Diff for: compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2938,7 +2938,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
29382938
else {
29392939
bug!("expected closure in SizedClosureCapture obligation");
29402940
};
2941-
if let hir::CaptureBy::Value = closure.capture_clause
2941+
if let hir::CaptureBy::Value { .. } = closure.capture_clause
29422942
&& let Some(span) = closure.fn_arg_span
29432943
{
29442944
err.span_label(span, "this closure captures all values by move");

0 commit comments

Comments
 (0)