Skip to content

Commit c925c82

Browse files
author
The Miri Cronjob Bot
committed
fmt
1 parent aa74d61 commit c925c82

File tree

8 files changed

+93
-72
lines changed

8 files changed

+93
-72
lines changed

Diff for: src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -904,10 +904,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
904904
new_perm: NewPermission,
905905
) -> InterpResult<'tcx> {
906906
let val = self.ecx.read_immediate(&self.ecx.place_to_op(place)?)?;
907-
let val = self.ecx.sb_retag_reference(&val, new_perm, RetagInfo {
908-
cause: self.retag_cause,
909-
in_field: self.in_field,
910-
})?;
907+
let val = self.ecx.sb_retag_reference(
908+
&val,
909+
new_perm,
910+
RetagInfo { cause: self.retag_cause, in_field: self.in_field },
911+
)?;
911912
self.ecx.write_immediate(*val, place)?;
912913
interp_ok(())
913914
}
@@ -996,10 +997,11 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
996997
access: Some(AccessKind::Write),
997998
protector: Some(ProtectorKind::StrongProtector),
998999
};
999-
this.sb_retag_place(place, new_perm, RetagInfo {
1000-
cause: RetagCause::InPlaceFnPassing,
1001-
in_field: false,
1002-
})
1000+
this.sb_retag_place(
1001+
place,
1002+
new_perm,
1003+
RetagInfo { cause: RetagCause::InPlaceFnPassing, in_field: false },
1004+
)
10031005
}
10041006

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

Diff for: src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs

+12-8
Original file line numberDiff line numberDiff line change
@@ -379,14 +379,18 @@ pub mod diagnostics {
379379
use super::*;
380380
impl fmt::Display for PermissionPriv {
381381
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
382-
write!(f, "{}", match self {
383-
ReservedFrz { conflicted: false } => "Reserved",
384-
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
385-
ReservedIM => "Reserved (interior mutable)",
386-
Active => "Active",
387-
Frozen => "Frozen",
388-
Disabled => "Disabled",
389-
})
382+
write!(
383+
f,
384+
"{}",
385+
match self {
386+
ReservedFrz { conflicted: false } => "Reserved",
387+
ReservedFrz { conflicted: true } => "Reserved (conflicted)",
388+
ReservedIM => "Reserved (interior mutable)",
389+
Active => "Active",
390+
Frozen => "Frozen",
391+
Disabled => "Disabled",
392+
}
393+
)
390394
}
391395
}
392396

Diff for: src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs

+23-17
Original file line numberDiff line numberDiff line change
@@ -581,15 +581,18 @@ impl Tree {
581581
let mut debug_info = NodeDebugInfo::new(root_tag, root_default_perm, span);
582582
// name the root so that all allocations contain one named pointer
583583
debug_info.add_name("root of the allocation");
584-
nodes.insert(root_idx, Node {
585-
tag: root_tag,
586-
parent: None,
587-
children: SmallVec::default(),
588-
default_initial_perm: root_default_perm,
589-
// The root may never be skipped, all accesses will be local.
590-
default_initial_idempotent_foreign_access: IdempotentForeignAccess::None,
591-
debug_info,
592-
});
584+
nodes.insert(
585+
root_idx,
586+
Node {
587+
tag: root_tag,
588+
parent: None,
589+
children: SmallVec::default(),
590+
default_initial_perm: root_default_perm,
591+
// The root may never be skipped, all accesses will be local.
592+
default_initial_idempotent_foreign_access: IdempotentForeignAccess::None,
593+
debug_info,
594+
},
595+
);
593596
nodes
594597
};
595598
let rperms = {
@@ -624,14 +627,17 @@ impl<'tcx> Tree {
624627
let parent_idx = self.tag_mapping.get(&parent_tag).unwrap();
625628
let strongest_idempotent = default_initial_perm.strongest_idempotent_foreign_access(prot);
626629
// Create the node
627-
self.nodes.insert(idx, Node {
628-
tag: new_tag,
629-
parent: Some(parent_idx),
630-
children: SmallVec::default(),
631-
default_initial_perm,
632-
default_initial_idempotent_foreign_access: strongest_idempotent,
633-
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
634-
});
630+
self.nodes.insert(
631+
idx,
632+
Node {
633+
tag: new_tag,
634+
parent: Some(parent_idx),
635+
children: SmallVec::default(),
636+
default_initial_perm,
637+
default_initial_idempotent_foreign_access: strongest_idempotent,
638+
debug_info: NodeDebugInfo::new(new_tag, default_initial_perm, span),
639+
},
640+
);
635641
// Register new_tag as a child of parent_tag
636642
self.nodes.get_mut(parent_idx).unwrap().children.push(idx);
637643
// Initialize perms

Diff for: src/tools/miri/src/machine.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -1111,10 +1111,13 @@ impl<'tcx> Machine<'tcx> for MiriMachine<'tcx> {
11111111
// Call the lang item.
11121112
let panic = ecx.tcx.lang_items().get(reason.lang_item()).unwrap();
11131113
let panic = ty::Instance::mono(ecx.tcx.tcx, panic);
1114-
ecx.call_function(panic, ExternAbi::Rust, &[], None, StackPopCleanup::Goto {
1115-
ret: None,
1116-
unwind: mir::UnwindAction::Unreachable,
1117-
})?;
1114+
ecx.call_function(
1115+
panic,
1116+
ExternAbi::Rust,
1117+
&[],
1118+
None,
1119+
StackPopCleanup::Goto { ret: None, unwind: mir::UnwindAction::Unreachable },
1120+
)?;
11181121
interp_ok(())
11191122
}
11201123

Diff for: src/tools/miri/src/shims/extern_static.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ impl<'tcx> MiriMachine<'tcx> {
6060

6161
match ecx.tcx.sess.target.os.as_ref() {
6262
"linux" => {
63-
Self::null_ptr_extern_statics(ecx, &[
64-
"__cxa_thread_atexit_impl",
65-
"__clock_gettime64",
66-
])?;
63+
Self::null_ptr_extern_statics(
64+
ecx,
65+
&["__cxa_thread_atexit_impl", "__clock_gettime64"],
66+
)?;
6767
Self::weak_symbol_extern_statics(ecx, &["getrandom", "statx"])?;
6868
}
6969
"freebsd" => {

Diff for: src/tools/miri/src/shims/panic.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,13 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
247247
// Call the lang item associated with this message.
248248
let fn_item = this.tcx.require_lang_item(msg.panic_function(), None);
249249
let instance = ty::Instance::mono(this.tcx.tcx, fn_item);
250-
this.call_function(instance, ExternAbi::Rust, &[], None, StackPopCleanup::Goto {
251-
ret: None,
252-
unwind,
253-
})?;
250+
this.call_function(
251+
instance,
252+
ExternAbi::Rust,
253+
&[],
254+
None,
255+
StackPopCleanup::Goto { ret: None, unwind },
256+
)?;
254257
}
255258
}
256259
interp_ok(())

Diff for: src/tools/miri/tests/pass-dep/libc/libc-epoll-no-blocking.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,10 @@ fn test_two_same_fd_in_same_epoll_instance() {
230230
//Two notification should be received.
231231
let expected_event = u32::try_from(libc::EPOLLIN | libc::EPOLLOUT).unwrap();
232232
let expected_value = 5 as u64;
233-
check_epoll_wait::<8>(epfd, &[
234-
(expected_event, expected_value),
235-
(expected_event, expected_value),
236-
]);
233+
check_epoll_wait::<8>(
234+
epfd,
235+
&[(expected_event, expected_value), (expected_event, expected_value)],
236+
);
237237
}
238238

239239
fn test_epoll_eventfd() {
@@ -290,10 +290,10 @@ fn test_epoll_socketpair_both_sides() {
290290
let expected_value0 = fds[0] as u64;
291291
let expected_event1 = u32::try_from(libc::EPOLLOUT).unwrap();
292292
let expected_value1 = fds[1] as u64;
293-
check_epoll_wait::<8>(epfd, &[
294-
(expected_event0, expected_value0),
295-
(expected_event1, expected_value1),
296-
]);
293+
check_epoll_wait::<8>(
294+
epfd,
295+
&[(expected_event0, expected_value0), (expected_event1, expected_value1)],
296+
);
297297

298298
// Read from fds[0].
299299
let mut buf: [u8; 5] = [0; 5];
@@ -453,10 +453,10 @@ fn test_socketpair_read() {
453453
let expected_value0 = fds[0] as u64;
454454
let expected_event1 = u32::try_from(libc::EPOLLOUT).unwrap();
455455
let expected_value1 = fds[1] as u64;
456-
check_epoll_wait::<8>(epfd, &[
457-
(expected_event0, expected_value0),
458-
(expected_event1, expected_value1),
459-
]);
456+
check_epoll_wait::<8>(
457+
epfd,
458+
&[(expected_event0, expected_value0), (expected_event1, expected_value1)],
459+
);
460460

461461
// Read 3 bytes from fds[0].
462462
let mut buf: [u8; 3] = [0; 3];

Diff for: src/tools/miri/tests/ui.rs

+18-15
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,25 @@ fn miri_config(
129129
config.comment_defaults.base().add_custom("edition", Edition("2021".into()));
130130

131131
if let Some(WithDependencies { bless }) = with_dependencies {
132-
config.comment_defaults.base().set_custom("dependencies", DependencyBuilder {
133-
program: CommandBuilder {
134-
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
135-
// (It's a separate crate, so we don't get an env var from cargo.)
136-
program: miri_path()
137-
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
138-
// There is no `cargo miri build` so we just use `cargo miri run`.
139-
args: ["miri", "run"].into_iter().map(Into::into).collect(),
140-
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
141-
envs: vec![("RUSTFLAGS".into(), None)],
142-
..CommandBuilder::cargo()
132+
config.comment_defaults.base().set_custom(
133+
"dependencies",
134+
DependencyBuilder {
135+
program: CommandBuilder {
136+
// Set the `cargo-miri` binary, which we expect to be in the same folder as the `miri` binary.
137+
// (It's a separate crate, so we don't get an env var from cargo.)
138+
program: miri_path()
139+
.with_file_name(format!("cargo-miri{}", env::consts::EXE_SUFFIX)),
140+
// There is no `cargo miri build` so we just use `cargo miri run`.
141+
args: ["miri", "run"].into_iter().map(Into::into).collect(),
142+
// Reset `RUSTFLAGS` to work around <https://github.com/rust-lang/rust/pull/119574#issuecomment-1876878344>.
143+
envs: vec![("RUSTFLAGS".into(), None)],
144+
..CommandBuilder::cargo()
145+
},
146+
crate_manifest_path: Path::new("test_dependencies").join("Cargo.toml"),
147+
build_std: None,
148+
bless_lockfile: bless,
143149
},
144-
crate_manifest_path: Path::new("test_dependencies").join("Cargo.toml"),
145-
build_std: None,
146-
bless_lockfile: bless,
147-
});
150+
);
148151
}
149152
config
150153
}

0 commit comments

Comments
 (0)