Skip to content

Commit 8d4973f

Browse files
committed
move_ref_pattern: don't ICE on unreachable 2xby-move conflicts
1 parent 0253f86 commit 8d4973f

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

Diff for: src/librustc_mir_build/hair/pattern/check_match.rs

-3
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,6 @@ fn check_borrow_conflicts_in_at_patterns(cx: &MatchVisitor<'_, '_>, pat: &Pat<'_
648648
let mut conflicts_ref = Vec::new();
649649
sub.each_binding(|_, hir_id, span, _| {
650650
match tables.extract_binding_mode(sess, hir_id, span) {
651-
Some(ty::BindByValue(_)) if is_binding_by_move(cx, hir_id, span) => {
652-
sess.delay_span_bug(span, "by-move in subpat unchecked by borrowck");
653-
}
654651
Some(ty::BindByValue(_)) | None => {}
655652
Some(ty::BindByReference(_)) => conflicts_ref.push(span),
656653
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// When conflicts between by-move bindings in `by_move_1 @ has_by_move` patterns
2+
// happen and that code is unreachable according to borrowck, we accept this code.
3+
// In particular, we want to ensure here that an ICE does not happen, which it did originally.
4+
5+
// check-pass
6+
7+
#![feature(move_ref_pattern)]
8+
#![feature(bindings_after_at)]
9+
10+
fn main() {
11+
return;
12+
13+
struct S;
14+
let a @ (b, c) = (S, S);
15+
}

0 commit comments

Comments
 (0)