This commit is contained in:
Ralf Jung 2025-04-24 11:02:55 +02:00
parent f1b6b85f08
commit f2bbc1bf06
4 changed files with 12 additions and 14 deletions

View file

@ -61,8 +61,7 @@ fn all_read_accesses_commute() {
// ... and produce the same final result.
assert_eq!(
loc12, loc21,
"Read accesses {:?} followed by {:?} do not commute !",
rel1, rel2
"Read accesses {rel1:?} followed by {rel2:?} do not commute !"
);
}
}
@ -674,8 +673,8 @@ mod spurious_read {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let (x, y) = self.retag_permissions();
write!(f, "{}; ", self.xy_rel)?;
write!(f, "y: ({}); ", y,)?;
write!(f, "retag x ({}); ", x)?;
write!(f, "y: ({y}); ")?;
write!(f, "retag x ({x}); ")?;
write!(f, "<arbitrary code>; <spurious read x>;")?;
Ok(())
@ -730,17 +729,17 @@ mod spurious_read {
// protector.
final_source
.distinguishable::</*X*/ AllowRet, /*Y*/ AllowRet>(&final_target)
.then_some(format!("{}", final_target))
.then_some(format!("{final_target}"))
} else {
Some(format!("UB"))
}
};
if let Some(final_target) = distinguishable {
eprintln!(
"For pattern '{}', inserting a spurious read through x makes the final state '{}' instead of '{}' which is observable",
pat, final_target, final_source
"For pattern '{pat}', inserting a spurious read through x makes the final state '{final_target}' \
instead of '{final_source}' which is observable"
);
eprintln!(" (arbitrary code instanciated with '{}')", opaque);
eprintln!(" (arbitrary code instanciated with '{opaque}')");
err += 1;
// We found an instanciation of the opaque code that makes this Pattern
// fail, we don't really need to check the rest.

View file

@ -381,7 +381,7 @@ impl AccessType {
});
if let Some(ty) = ty {
msg.push_str(&format!(" of type `{}`", ty));
msg.push_str(&format!(" of type `{ty}`"));
}
msg

View file

@ -721,9 +721,8 @@ impl<'tcx> MiriMachine<'tcx> {
// Check if host target == the session target.
if host_triple != target_triple {
panic!(
"calling external C functions in linked .so file requires host and target to be the same: host={}, target={}",
host_triple,
target_triple,
"calling native C functions in linked .so file requires host and target to be the same: \
host={host_triple}, target={target_triple}",
);
}
// Note: it is the user's responsibility to provide a correct SO file.

View file

@ -191,10 +191,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
tm_zone.push('+');
}
let offset_hour = offset_in_seconds.abs() / 3600;
write!(tm_zone, "{:02}", offset_hour).unwrap();
write!(tm_zone, "{offset_hour:02}").unwrap();
let offset_min = (offset_in_seconds.abs() % 3600) / 60;
if offset_min != 0 {
write!(tm_zone, "{:02}", offset_min).unwrap();
write!(tm_zone, "{offset_min:02}").unwrap();
}
// Add null terminator for C string compatibility.