Skip to content

Commit 8ed95d1

Browse files
committed
Auto merge of #130709 - RalfJung:miri-sync, r=RalfJung
Miri subtree update r? `@ghost`
2 parents 0af7f0f + 599b329 commit 8ed95d1

File tree

86 files changed

+2200
-2149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+2200
-2149
lines changed

src/tools/miri/.github/workflows/ci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
schedule:
1313
- cron: '44 4 * * *' # At 4:44 UTC every day.
1414

15+
permissions:
16+
contents: write
17+
1518
defaults:
1619
run:
1720
shell: bash

src/tools/miri/miri-script/src/args.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::env;
22
use std::iter;
33

4-
use anyhow::{bail, Result};
4+
use anyhow::{Result, bail};
55

66
pub struct Args {
77
args: iter::Peekable<env::Args>,

src/tools/miri/miri-script/src/commands.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ use std::path::PathBuf;
88
use std::process;
99
use std::time::Duration;
1010

11-
use anyhow::{anyhow, bail, Context, Result};
11+
use anyhow::{Context, Result, anyhow, bail};
1212
use path_macro::path;
1313
use walkdir::WalkDir;
14-
use xshell::{cmd, Shell};
14+
use xshell::{Shell, cmd};
1515

16-
use crate::util::*;
1716
use crate::Command;
17+
use crate::util::*;
1818

1919
/// Used for rustc syncs.
2020
const JOSH_FILTER: &str =

src/tools/miri/miri-script/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod util;
66

77
use std::ops::Range;
88

9-
use anyhow::{anyhow, bail, Context, Result};
9+
use anyhow::{Context, Result, anyhow, bail};
1010

1111
#[derive(Clone, Debug)]
1212
pub enum Command {

src/tools/miri/miri-script/src/util.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use std::path::{Path, PathBuf};
55
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
66
use std::{env, iter, thread};
77

8-
use anyhow::{anyhow, bail, Context, Result};
8+
use anyhow::{Context, Result, anyhow, bail};
99
use dunce::canonicalize;
1010
use path_macro::path;
11-
use xshell::{cmd, Cmd, Shell};
11+
use xshell::{Cmd, Shell, cmd};
1212

1313
pub fn miri_dir() -> std::io::Result<PathBuf> {
1414
const MIRI_SCRIPT_ROOT_DIR: &str = env!("CARGO_MANIFEST_DIR");

src/tools/miri/rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e2dc1a1c0f97a90319181a721ab317210307617a
1+
6ce376774c0bc46ac8be247bca93ff5a1287a8fc

src/tools/miri/rustfmt.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "Two"
1+
style_edition = "2024"
22
use_small_heuristics = "Max"
33
match_arm_blocks = false
44
match_arm_leading_pipes = "Preserve"

src/tools/miri/src/alloc_addresses/reuse_pool.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rand::Rng;
44

55
use rustc_target::abi::{Align, Size};
66

7-
use crate::{concurrency::VClock, MemoryKind, MiriConfig, ThreadId};
7+
use crate::{MemoryKind, MiriConfig, ThreadId, concurrency::VClock};
88

99
const MAX_POOL_SIZE: usize = 64;
1010

src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs

+10-12
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ use std::mem;
1212

1313
use rustc_data_structures::fx::FxHashSet;
1414
use rustc_middle::mir::{Mutability, RetagKind};
15-
use rustc_middle::ty::{self, layout::HasParamEnv, Ty};
15+
use rustc_middle::ty::{self, Ty, layout::HasParamEnv};
1616
use rustc_target::abi::{Abi, Size};
1717

1818
use crate::borrow_tracker::{
19-
stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder},
2019
GlobalStateInner, ProtectorKind,
20+
stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder},
2121
};
2222
use crate::concurrency::data_race::{NaReadType, NaWriteType};
2323
use crate::*;
@@ -913,11 +913,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
913913
new_perm: NewPermission,
914914
) -> InterpResult<'tcx> {
915915
let val = self.ecx.read_immediate(&self.ecx.place_to_op(place)?)?;
916-
let val = self.ecx.sb_retag_reference(
917-
&val,
918-
new_perm,
919-
RetagInfo { cause: self.retag_cause, in_field: self.in_field },
920-
)?;
916+
let val = self.ecx.sb_retag_reference(&val, new_perm, RetagInfo {
917+
cause: self.retag_cause,
918+
in_field: self.in_field,
919+
})?;
921920
self.ecx.write_immediate(*val, place)?;
922921
Ok(())
923922
}
@@ -1003,11 +1002,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
10031002
access: Some(AccessKind::Write),
10041003
protector: Some(ProtectorKind::StrongProtector),
10051004
};
1006-
this.sb_retag_place(
1007-
place,
1008-
new_perm,
1009-
RetagInfo { cause: RetagCause::InPlaceFnPassing, in_field: false },
1010-
)
1005+
this.sb_retag_place(place, new_perm, RetagInfo {
1006+
cause: RetagCause::InPlaceFnPassing,
1007+
in_field: false,
1008+
})
10111009
}
10121010

10131011
/// Mark the given tag as exposed. It was found on a pointer with the given AllocId.

src/tools/miri/src/borrow_tracker/stacked_borrows/stack.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ use std::ops::Range;
44
use rustc_data_structures::fx::FxHashSet;
55
use tracing::trace;
66

7+
use crate::ProvenanceExtra;
78
use crate::borrow_tracker::{
8-
stacked_borrows::{Item, Permission},
99
AccessKind, BorTag,
10+
stacked_borrows::{Item, Permission},
1011
};
11-
use crate::ProvenanceExtra;
1212

1313
/// Exactly what cache size we should use is a difficult trade-off. There will always be some
1414
/// workload which has a `BorTag` working set which exceeds the size of the cache, and ends up

src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ use std::ops::Range;
44
use rustc_data_structures::fx::FxHashMap;
55
use rustc_span::{Span, SpanData};
66

7+
use crate::borrow_tracker::ProtectorKind;
78
use crate::borrow_tracker::tree_borrows::{
89
perms::{PermTransition, Permission},
910
tree::LocationState,
1011
unimap::UniIndex,
1112
};
12-
use crate::borrow_tracker::ProtectorKind;
1313
use crate::*;
1414

1515
/// Cause of an access: either a real access or one

src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use rustc_middle::{
22
mir::{Mutability, RetagKind},
3-
ty::{self, layout::HasParamEnv, Ty},
3+
ty::{self, Ty, layout::HasParamEnv},
44
};
55
use rustc_span::def_id::DefId;
66
use rustc_target::abi::{Abi, Size};

src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs

+10-14
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use std::cmp::{Ordering, PartialOrd};
22
use std::fmt;
33

4+
use crate::AccessKind;
45
use crate::borrow_tracker::tree_borrows::diagnostics::TransitionError;
56
use crate::borrow_tracker::tree_borrows::tree::AccessRelatedness;
6-
use crate::AccessKind;
77

88
/// The activation states of a pointer.
99
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
@@ -345,18 +345,14 @@ pub mod diagnostics {
345345
use super::*;
346346
impl fmt::Display for PermissionPriv {
347347
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
348-
write!(
349-
f,
350-
"{}",
351-
match self {
352-
ReservedFrz { conflicted: false } => "Reserved",
353-
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
354-
ReservedIM => "Reserved (interior mutable)",
355-
Active => "Active",
356-
Frozen => "Frozen",
357-
Disabled => "Disabled",
358-
}
359-
)
348+
write!(f, "{}", match self {
349+
ReservedFrz { conflicted: false } => "Reserved",
350+
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
351+
ReservedIM => "Reserved (interior mutable)",
352+
Active => "Active",
353+
Frozen => "Frozen",
354+
Disabled => "Disabled",
355+
})
360356
}
361357
}
362358

@@ -551,7 +547,7 @@ impl Permission {
551547
#[cfg(test)]
552548
mod propagation_optimization_checks {
553549
pub use super::*;
554-
use crate::borrow_tracker::tree_borrows::exhaustive::{precondition, Exhaustive};
550+
use crate::borrow_tracker::tree_borrows::exhaustive::{Exhaustive, precondition};
555551

556552
impl Exhaustive for PermissionPriv {
557553
fn exhaustive() -> Box<dyn Iterator<Item = Self>> {

src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs

+15-21
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use rustc_span::Span;
1919
use rustc_target::abi::Size;
2020

2121
use crate::borrow_tracker::tree_borrows::{
22+
Permission,
2223
diagnostics::{self, NodeDebugInfo, TbError, TransitionError},
2324
perms::PermTransition,
2425
unimap::{UniEntry, UniIndex, UniKeyMap, UniValMap},
25-
Permission,
2626
};
2727
use crate::borrow_tracker::{GlobalState, ProtectorKind};
2828
use crate::*;
@@ -587,16 +587,13 @@ impl Tree {
587587
let mut debug_info = NodeDebugInfo::new(root_tag, root_default_perm, span);
588588
// name the root so that all allocations contain one named pointer
589589
debug_info.add_name("root of the allocation");
590-
nodes.insert(
591-
root_idx,
592-
Node {
593-
tag: root_tag,
594-
parent: None,
595-
children: SmallVec::default(),
596-
default_initial_perm: root_default_perm,
597-
debug_info,
598-
},
599-
);
590+
nodes.insert(root_idx, Node {
591+
tag: root_tag,
592+
parent: None,
593+
children: SmallVec::default(),
594+
default_initial_perm: root_default_perm,
595+
debug_info,
596+
});
600597
nodes
601598
};
602599
let rperms = {
@@ -626,16 +623,13 @@ impl<'tcx> Tree {
626623
let idx = self.tag_mapping.insert(new_tag);
627624
let parent_idx = self.tag_mapping.get(&parent_tag).unwrap();
628625
// Create the node
629-
self.nodes.insert(
630-
idx,
631-
Node {
632-
tag: new_tag,
633-
parent: Some(parent_idx),
634-
children: SmallVec::default(),
635-
default_initial_perm,
636-
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
637-
},
638-
);
626+
self.nodes.insert(idx, Node {
627+
tag: new_tag,
628+
parent: Some(parent_idx),
629+
children: SmallVec::default(),
630+
default_initial_perm,
631+
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
632+
});
639633
// Register new_tag as a child of parent_tag
640634
self.nodes.get_mut(parent_idx).unwrap().children.push(idx);
641635
// Initialize perms

src/tools/miri/src/borrow_tracker/tree_borrows/tree/tests.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![cfg(test)]
33

44
use super::*;
5-
use crate::borrow_tracker::tree_borrows::exhaustive::{precondition, Exhaustive};
5+
use crate::borrow_tracker::tree_borrows::exhaustive::{Exhaustive, precondition};
66
use std::fmt;
77

88
impl Exhaustive for LocationState {

src/tools/miri/src/concurrency/sync.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::any::Any;
2-
use std::collections::{hash_map::Entry, VecDeque};
2+
use std::collections::{VecDeque, hash_map::Entry};
33
use std::ops::Not;
44
use std::time::Duration;
55

@@ -283,12 +283,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
283283
data: Option<Box<dyn Any>>,
284284
) -> InterpResult<'tcx, MutexId> {
285285
let this = self.eval_context_mut();
286-
this.create_id(
287-
lock,
288-
offset,
289-
|ecx| &mut ecx.machine.sync.mutexes,
290-
Mutex { data, ..Default::default() },
291-
)
286+
this.create_id(lock, offset, |ecx| &mut ecx.machine.sync.mutexes, Mutex {
287+
data,
288+
..Default::default()
289+
})
292290
}
293291

294292
/// Lazily create a new mutex.
@@ -355,12 +353,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
355353
data: Option<Box<dyn Any>>,
356354
) -> InterpResult<'tcx, CondvarId> {
357355
let this = self.eval_context_mut();
358-
this.create_id(
359-
condvar,
360-
offset,
361-
|ecx| &mut ecx.machine.sync.condvars,
362-
Condvar { data, ..Default::default() },
363-
)
356+
this.create_id(condvar, offset, |ecx| &mut ecx.machine.sync.condvars, Condvar {
357+
data,
358+
..Default::default()
359+
})
364360
}
365361

366362
fn condvar_get_or_create_id(

src/tools/miri/src/concurrency/vector_clock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc_index::Idx;
2-
use rustc_span::{Span, SpanData, DUMMY_SP};
2+
use rustc_span::{DUMMY_SP, Span, SpanData};
33
use smallvec::SmallVec;
44
use std::{
55
cmp::Ordering,

src/tools/miri/src/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::fmt::{self, Write};
22
use std::num::NonZero;
33

44
use rustc_errors::{Diag, DiagMessage, Level};
5-
use rustc_span::{SpanData, Symbol, DUMMY_SP};
5+
use rustc_span::{DUMMY_SP, SpanData, Symbol};
66
use rustc_target::abi::{Align, Size};
77

88
use crate::borrow_tracker::stacked_borrows::diagnostics::TagHistory;

src/tools/miri/src/eval.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1313
use rustc_hir::def::Namespace;
1414
use rustc_hir::def_id::DefId;
1515
use rustc_middle::ty::{
16-
self,
16+
self, Ty, TyCtxt,
1717
layout::{LayoutCx, LayoutOf},
18-
Ty, TyCtxt,
1918
};
2019
use rustc_target::spec::abi::Abi;
2120

src/tools/miri/src/helpers.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use std::time::Duration;
77

88
use rand::RngCore;
99

10-
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
1110
use rustc_apfloat::Float;
11+
use rustc_apfloat::ieee::{Double, Half, Quad, Single};
1212
use rustc_hir::{
13-
def::{DefKind, Namespace},
14-
def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE},
1513
Safety,
14+
def::{DefKind, Namespace},
15+
def_id::{CRATE_DEF_INDEX, CrateNum, DefId, LOCAL_CRATE},
1616
};
1717
use rustc_index::IndexVec;
1818
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
@@ -21,9 +21,8 @@ use rustc_middle::middle::exported_symbols::ExportedSymbol;
2121
use rustc_middle::mir;
2222
use rustc_middle::ty::layout::{FnAbiOf, MaybeResult};
2323
use rustc_middle::ty::{
24-
self,
24+
self, FloatTy, IntTy, Ty, TyCtxt, UintTy,
2525
layout::{LayoutOf, TyAndLayout},
26-
FloatTy, IntTy, Ty, TyCtxt, UintTy,
2726
};
2827
use rustc_session::config::CrateType;
2928
use rustc_span::{Span, Symbol};

src/tools/miri/src/intrinsics/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use rustc_middle::{
99
mir,
1010
ty::{self, FloatTy},
1111
};
12-
use rustc_span::{sym, Symbol};
12+
use rustc_span::{Symbol, sym};
1313
use rustc_target::abi::Size;
1414

1515
use crate::*;
1616
use atomic::EvalContextExt as _;
17-
use helpers::{check_arg_count, ToHost, ToSoft};
17+
use helpers::{ToHost, ToSoft, check_arg_count};
1818
use simd::EvalContextExt as _;
1919

2020
impl<'tcx> EvalContextExt<'tcx> for crate::MiriInterpCx<'tcx> {}

src/tools/miri/src/intrinsics/simd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ use either::Either;
33
use rustc_apfloat::{Float, Round};
44
use rustc_middle::ty::layout::{HasParamEnv, LayoutOf};
55
use rustc_middle::{mir, ty, ty::FloatTy};
6-
use rustc_span::{sym, Symbol};
6+
use rustc_span::{Symbol, sym};
77
use rustc_target::abi::{Endian, HasDataLayout};
88

9-
use crate::helpers::{bool_to_simd_element, check_arg_count, simd_element_to_bool, ToHost, ToSoft};
9+
use crate::helpers::{ToHost, ToSoft, bool_to_simd_element, check_arg_count, simd_element_to_bool};
1010
use crate::*;
1111

1212
#[derive(Copy, Clone)]

0 commit comments

Comments
 (0)