Skip to content

Commit 478e042

Browse files
authored
Merge pull request #4162 from rust-lang/rustup-2025-01-29
Automatic Rustup
2 parents 489a487 + ea07395 commit 478e042

File tree

5 files changed

+44
-6
lines changed

5 files changed

+44
-6
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2f348cb7ce4063fa4eb40038e6ada3c5214717bd
1+
122fb29eb639aae852b9dcba0fd7aefc691be118

src/borrow_tracker/stacked_borrows/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
865865
let this = self.eval_context_mut();
866866
let new_perm = NewPermission::from_ref_ty(val.layout.ty, kind, this);
867867
let cause = match kind {
868-
RetagKind::TwoPhase { .. } => RetagCause::TwoPhase,
868+
RetagKind::TwoPhase => RetagCause::TwoPhase,
869869
RetagKind::FnEntry => unreachable!(),
870870
RetagKind::Raw | RetagKind::Default => RetagCause::Normal,
871871
};
@@ -880,7 +880,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
880880
let this = self.eval_context_mut();
881881
let retag_fields = this.machine.borrow_tracker.as_mut().unwrap().get_mut().retag_fields;
882882
let retag_cause = match kind {
883-
RetagKind::TwoPhase { .. } => unreachable!(), // can only happen in `retag_ptr_value`
883+
RetagKind::TwoPhase => unreachable!(), // can only happen in `retag_ptr_value`
884884
RetagKind::FnEntry => RetagCause::FnEntry,
885885
RetagKind::Default | RetagKind::Raw => RetagCause::Normal,
886886
};

src/eval.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,15 +558,15 @@ where
558558

559559
match chars.next() {
560560
Some('"') => {
561-
cmd.extend(iter::repeat('\\').take(nslashes * 2 + 1));
561+
cmd.extend(iter::repeat_n('\\', nslashes * 2 + 1));
562562
cmd.push('"');
563563
}
564564
Some(c) => {
565-
cmd.extend(iter::repeat('\\').take(nslashes));
565+
cmd.extend(iter::repeat_n('\\', nslashes));
566566
cmd.push(c);
567567
}
568568
None => {
569-
cmd.extend(iter::repeat('\\').take(nslashes * 2));
569+
cmd.extend(iter::repeat_n('\\', nslashes * 2));
570570
break;
571571
}
572572
}

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@
3636
clippy::needless_question_mark,
3737
clippy::needless_lifetimes,
3838
clippy::too_long_first_doc_paragraph,
39+
// Temporarily disabled as fixing it would cause conflicts
40+
clippy::manual_repeat_n,
41+
// We don't use translatable diagnostics
3942
rustc::diagnostic_outside_of_impl,
4043
// We are not implementing queries here so it's fine
4144
rustc::potential_query_instability,

tests/pass/disjoint-array-accesses.rs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// This is a regression test for issue #135671 where a MIR refactor about arrays and their lengths
2+
// unexpectedly caused borrowck errors for disjoint borrows of array elements, for which we had no
3+
// tests. This is a collection of a few code samples from that issue.
4+
5+
//@revisions: stack tree
6+
//@[tree]compile-flags: -Zmiri-tree-borrows
7+
8+
struct Test {
9+
a: i32,
10+
b: i32,
11+
}
12+
13+
fn one() {
14+
let inputs: &mut [_] = &mut [Test { a: 0, b: 0 }];
15+
let a = &mut inputs[0].a;
16+
let b = &mut inputs[0].b;
17+
18+
*a = 0;
19+
*b = 1;
20+
}
21+
22+
fn two() {
23+
let slice = &mut [(0, 0)][..];
24+
std::mem::swap(&mut slice[0].0, &mut slice[0].1);
25+
}
26+
27+
fn three(a: &mut [(i32, i32)], i: usize, j: usize) -> (&mut i32, &mut i32) {
28+
(&mut a[i].0, &mut a[j].1)
29+
}
30+
31+
fn main() {
32+
one();
33+
two();
34+
three(&mut [(1, 2), (3, 4)], 0, 1);
35+
}

0 commit comments

Comments
 (0)