Skip to content

Commit 7687b7e

Browse files
committed
rustup, fmt
1 parent 5ca1f85 commit 7687b7e

File tree

8 files changed

+62
-41
lines changed

8 files changed

+62
-41
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2019147c5642c08cdb9ad4cacd97dd1fa4ffa701
1+
acb8934fd57b3c2740c4abac0a5728c2c9b1423b

src/concurrency/sync.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -322,10 +322,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
322322
/// otherwise returns the value from the closure
323323
fn rwlock_get_or_create<F>(&mut self, existing: F) -> InterpResult<'tcx, RwLockId>
324324
where
325-
F: FnOnce(
326-
&mut MiriInterpCx<'mir, 'tcx>,
327-
RwLockId,
328-
) -> InterpResult<'tcx, Option<RwLockId>>,
325+
F: FnOnce(&mut MiriInterpCx<'mir, 'tcx>, RwLockId) -> InterpResult<'tcx, Option<RwLockId>>,
329326
{
330327
let this = self.eval_context_mut();
331328
let next_index = this.machine.threads.sync.rwlocks.next_index();

src/concurrency/thread.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ pub enum SchedulingAction {
3232

3333
/// Timeout callbacks can be created by synchronization primitives to tell the
3434
/// scheduler that they should be called once some period of time passes.
35-
type TimeoutCallback<'mir, 'tcx> =
36-
Box<dyn FnOnce(&mut InterpCx<'mir, 'tcx, MiriMachine<'mir, 'tcx>>) -> InterpResult<'tcx> + 'tcx>;
35+
type TimeoutCallback<'mir, 'tcx> = Box<
36+
dyn FnOnce(&mut InterpCx<'mir, 'tcx, MiriMachine<'mir, 'tcx>>) -> InterpResult<'tcx> + 'tcx,
37+
>;
3738

3839
/// A thread identifier.
3940
#[derive(Clone, Copy, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]

src/diagnostics.rs

+46-27
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ fn prune_stacktrace<'tcx>(
109109
if has_local_frame {
110110
// Remove all frames marked with `caller_location` -- that attribute indicates we
111111
// usually want to point at the caller, not them.
112-
stacktrace.retain(|frame| !frame.instance.def.requires_caller_location(machine.tcx));
112+
stacktrace
113+
.retain(|frame| !frame.instance.def.requires_caller_location(machine.tcx));
113114

114115
// This is part of the logic that `std` uses to select the relevant part of a
115116
// backtrace. But here, we only look for __rust_begin_short_backtrace, not
@@ -371,56 +372,48 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
371372
pub fn emit_diagnostic(&self, e: NonHaltingDiagnostic) {
372373
use NonHaltingDiagnostic::*;
373374

374-
let stacktrace = MiriInterpCx::generate_stacktrace_from_stack(self.threads.active_thread_stack());
375+
let stacktrace =
376+
MiriInterpCx::generate_stacktrace_from_stack(self.threads.active_thread_stack());
375377
let (stacktrace, _was_pruned) = prune_stacktrace(stacktrace, self);
376378

377379
let (title, diag_level) = match e {
378-
RejectedIsolatedOp(_) =>
379-
("operation rejected by isolation", DiagLevel::Warning),
380+
RejectedIsolatedOp(_) => ("operation rejected by isolation", DiagLevel::Warning),
380381
Int2Ptr { .. } => ("integer-to-pointer cast", DiagLevel::Warning),
381382
CreatedPointerTag(..)
382383
| PoppedPointerTag(..)
383384
| CreatedCallId(..)
384385
| CreatedAlloc(..)
385386
| FreedAlloc(..)
386387
| ProgressReport { .. }
387-
| WeakMemoryOutdatedLoad =>
388-
("tracking was triggered", DiagLevel::Note),
388+
| WeakMemoryOutdatedLoad => ("tracking was triggered", DiagLevel::Note),
389389
};
390390

391391
let msg = match e {
392-
CreatedPointerTag(tag, None) =>
393-
format!("created tag {tag:?}"),
392+
CreatedPointerTag(tag, None) => format!("created tag {tag:?}"),
394393
CreatedPointerTag(tag, Some((alloc_id, range))) =>
395394
format!("created tag {tag:?} at {alloc_id:?}{range:?}"),
396395
PoppedPointerTag(item, tag) =>
397396
match tag {
398-
None =>
399-
format!(
400-
"popped tracked tag for item {item:?} due to deallocation",
401-
),
397+
None => format!("popped tracked tag for item {item:?} due to deallocation",),
402398
Some((tag, access)) => {
403399
format!(
404400
"popped tracked tag for item {item:?} due to {access:?} access for {tag:?}",
405401
)
406402
}
407403
},
408-
CreatedCallId(id) =>
409-
format!("function call with id {id}"),
404+
CreatedCallId(id) => format!("function call with id {id}"),
410405
CreatedAlloc(AllocId(id), size, align, kind) =>
411406
format!(
412407
"created {kind} allocation of {size} bytes (alignment {align} bytes) with id {id}",
413408
size = size.bytes(),
414409
align = align.bytes(),
415410
),
416-
FreedAlloc(AllocId(id)) =>
417-
format!("freed allocation with id {id}"),
411+
FreedAlloc(AllocId(id)) => format!("freed allocation with id {id}"),
418412
RejectedIsolatedOp(ref op) =>
419413
format!("{op} was made to return an error due to isolation"),
420414
ProgressReport { .. } =>
421415
format!("progress report: current operation being executed is here"),
422-
Int2Ptr { .. } =>
423-
format!("integer-to-pointer cast"),
416+
Int2Ptr { .. } => format!("integer-to-pointer cast"),
424417
WeakMemoryOutdatedLoad =>
425418
format!("weak memory emulation: outdated value returned from load"),
426419
};
@@ -429,22 +422,48 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> {
429422
ProgressReport { block_count } => {
430423
// It is important that each progress report is slightly different, since
431424
// identical diagnostics are being deduplicated.
432-
vec![
433-
(None, format!("so far, {block_count} basic blocks have been executed")),
434-
]
425+
vec![(None, format!("so far, {block_count} basic blocks have been executed"))]
435426
}
436427
_ => vec![],
437428
};
438429

439430
let helps = match e {
440431
Int2Ptr { details: true } =>
441432
vec![
442-
(None, format!("This program is using integer-to-pointer casts or (equivalently) `ptr::from_exposed_addr`,")),
443-
(None, format!("which means that Miri might miss pointer bugs in this program.")),
444-
(None, format!("See https://doc.rust-lang.org/nightly/std/ptr/fn.from_exposed_addr.html for more details on that operation.")),
445-
(None, format!("To ensure that Miri does not miss bugs in your program, use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead.")),
446-
(None, format!("You can then pass the `-Zmiri-strict-provenance` flag to Miri, to ensure you are not relying on `from_exposed_addr` semantics.")),
447-
(None, format!("Alternatively, the `-Zmiri-permissive-provenance` flag disables this warning.")),
433+
(
434+
None,
435+
format!(
436+
"This program is using integer-to-pointer casts or (equivalently) `ptr::from_exposed_addr`,"
437+
),
438+
),
439+
(
440+
None,
441+
format!("which means that Miri might miss pointer bugs in this program."),
442+
),
443+
(
444+
None,
445+
format!(
446+
"See https://doc.rust-lang.org/nightly/std/ptr/fn.from_exposed_addr.html for more details on that operation."
447+
),
448+
),
449+
(
450+
None,
451+
format!(
452+
"To ensure that Miri does not miss bugs in your program, use Strict Provenance APIs (https://doc.rust-lang.org/nightly/std/ptr/index.html#strict-provenance, https://crates.io/crates/sptr) instead."
453+
),
454+
),
455+
(
456+
None,
457+
format!(
458+
"You can then pass the `-Zmiri-strict-provenance` flag to Miri, to ensure you are not relying on `from_exposed_addr` semantics."
459+
),
460+
),
461+
(
462+
None,
463+
format!(
464+
"Alternatively, the `-Zmiri-permissive-provenance` flag disables this warning."
465+
),
466+
),
448467
],
449468
_ => vec![],
450469
};

src/eval.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
180180
entry_id: DefId,
181181
entry_type: EntryFnType,
182182
config: &MiriConfig,
183-
) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, MiriMachine<'mir, 'tcx>>, MPlaceTy<'tcx, Provenance>)> {
183+
) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, MiriMachine<'mir, 'tcx>>, MPlaceTy<'tcx, Provenance>)>
184+
{
184185
let param_env = ty::ParamEnv::reveal_all();
185186
let layout_cx = LayoutCx { tcx, param_env };
186187
let mut ecx = InterpCx::new(

src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,17 @@ pub use crate::concurrency::{
9494
},
9595
};
9696
pub use crate::diagnostics::{
97-
report_error, EvalContextExt as DiagnosticsEvalContextExt,
98-
NonHaltingDiagnostic, TerminationInfo,
97+
report_error, EvalContextExt as DiagnosticsEvalContextExt, NonHaltingDiagnostic,
98+
TerminationInfo,
9999
};
100100
pub use crate::eval::{
101101
create_ecx, eval_entry, AlignmentCheck, BacktraceStyle, IsolatedOp, MiriConfig, RejectOpWith,
102102
};
103103
pub use crate::helpers::{CurrentSpan, EvalContextExt as HelpersEvalContextExt};
104104
pub use crate::intptrcast::ProvenanceMode;
105105
pub use crate::machine::{
106-
AllocExtra, MiriMachine, FrameData, MiriInterpCx, MiriInterpCxExt, MiriMemoryKind,
107-
Provenance, ProvenanceExtra, NUM_CPUS, PAGE_SIZE, STACK_ADDR, STACK_SIZE,
106+
AllocExtra, FrameData, MiriInterpCx, MiriInterpCxExt, MiriMachine, MiriMemoryKind, Provenance,
107+
ProvenanceExtra, NUM_CPUS, PAGE_SIZE, STACK_ADDR, STACK_SIZE,
108108
};
109109
pub use crate::mono_hash_map::MonoHashMap;
110110
pub use crate::operator::EvalContextExt as OperatorEvalContextExt;

src/stacked_borrows/diagnostics.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,9 @@ impl<'span, 'history, 'ecx, 'mir, 'tcx> DiagnosticCx<'span, 'history, 'ecx, 'mir
471471
Some((orig_tag, kind))
472472
}
473473
};
474-
self.current_span.machine().emit_diagnostic(NonHaltingDiagnostic::PoppedPointerTag(*item, summary));
474+
self.current_span
475+
.machine()
476+
.emit_diagnostic(NonHaltingDiagnostic::PoppedPointerTag(*item, summary));
475477
}
476478
}
477479

src/stacked_borrows/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,8 @@ impl Stacks {
572572
// not through a pointer). That is, whenever we directly write to a local, this will pop
573573
// everything else off the stack, invalidating all previous pointers,
574574
// and in particular, *all* raw pointers.
575-
MemoryKind::Stack => (extra.base_ptr_tag(id, current_span.machine()), Permission::Unique),
575+
MemoryKind::Stack =>
576+
(extra.base_ptr_tag(id, current_span.machine()), Permission::Unique),
576577
// Everything else is shared by default.
577578
_ => (extra.base_ptr_tag(id, current_span.machine()), Permission::SharedReadWrite),
578579
};

0 commit comments

Comments
 (0)