Skip to content

Fix style check for Rust 1.88 #1333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benches/mock_bench/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub fn bench(c: &mut Criterion) {
"alloc" => alloc::bench(c),
"internal_pointer" => internal_pointer::bench(c),
"sft" => sft::bench(c),
_ => panic!("Unknown benchmark {:?}", bench),
_ => panic!("Unknown benchmark {bench:?}"),
},
Err(_) => panic!("Need to name a benchmark by the env var MMTK_BENCH"),
}
Expand Down
4 changes: 1 addition & 3 deletions src/global_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ impl GlobalState {
let old = self.scanned_stacks.fetch_add(1, Ordering::SeqCst);
debug_assert!(
old < n_mutators,
"The number of scanned stacks ({}) is more than the number of mutators ({})",
old,
n_mutators
"The number of scanned stacks ({old}) is more than the number of mutators ({n_mutators})",
);
let scanning_done = old + 1 == n_mutators;
if scanning_done {
Expand Down
10 changes: 3 additions & 7 deletions src/mmtk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,7 @@ impl<VM: VMBinding> MMTK<VM> {
let live_bytes = live_bytes_per_space[space_idx];
debug_assert!(
live_bytes <= used_bytes,
"Live bytes of objects in {} ({} bytes) is larger than used pages ({} bytes), something is wrong.",
space_name, live_bytes, used_bytes
"Live bytes of objects in {space_name} ({live_bytes} bytes) is larger than used pages ({used_bytes} bytes), something is wrong."
);
ret.insert(space_name, crate::LiveBytesStats {
live_bytes,
Expand Down Expand Up @@ -604,7 +603,7 @@ impl<VM: VMBinding> MMTK<VM> {
pub fn mmtk_debug_print_object(object: crate::util::ObjectReference) {
// If the address is unmapped, we cannot access its metadata. Just quit.
if !object.to_raw_address().is_mapped() {
println!("{} is not mapped in MMTk", object);
println!("{object} is not mapped in MMTk");
return;
}

Expand All @@ -613,10 +612,7 @@ pub fn mmtk_debug_print_object(object: crate::util::ObjectReference) {
.to_raw_address()
.is_aligned_to(crate::util::ObjectReference::ALIGNMENT)
{
println!(
"{} is not properly aligned. It is not an object reference.",
object
);
println!("{object} is not properly aligned. It is not an object reference.",);
}

// Forward to the space
Expand Down
14 changes: 2 additions & 12 deletions src/plan/generational/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,7 @@ impl<VM: VMBinding> CommonGenPlan<VM> {
let cur_nursery = self.nursery.reserved_pages();
let max_nursery = self.common.base.gc_trigger.get_max_nursery_pages();
let nursery_full = cur_nursery >= max_nursery;
trace!(
"nursery_full = {:?} (nursery = {}, max_nursery = {})",
nursery_full,
cur_nursery,
max_nursery,
);
trace!("nursery_full = {nursery_full:?} (nursery = {cur_nursery}, max_nursery = {max_nursery})");
if nursery_full {
return true;
}
Expand Down Expand Up @@ -251,12 +246,7 @@ impl<VM: VMBinding> CommonGenPlan<VM> {
let available = plan.get_available_pages();
let min_nursery = plan.base().gc_trigger.get_min_nursery_pages();
let next_gc_full_heap = available < min_nursery;
trace!(
"next gc will be full heap? {}, available pages = {}, min nursery = {}",
next_gc_full_heap,
available,
min_nursery
);
trace!("next gc will be full heap? {next_gc_full_heap}, available pages = {available}, min nursery = {min_nursery}");
next_gc_full_heap
}

Expand Down
15 changes: 2 additions & 13 deletions src/plan/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,7 @@ pub trait Plan: 'static + HasSpaces + Sync + Downcast {
let vm_live_pages = conversions::bytes_to_pages_up(vm_live_bytes);
let total = used_pages + collection_reserve + vm_live_pages;

trace!(
"Reserved pages = {}, used pages: {}, collection reserve: {}, VM live pages: {}",
total,
used_pages,
collection_reserve,
vm_live_pages,
);
trace!("Reserved pages = {total}, used pages: {used_pages}, collection reserve: {collection_reserve}, VM live pages: {vm_live_pages}");

total
}
Expand Down Expand Up @@ -268,12 +262,7 @@ pub trait Plan: 'static + HasSpaces + Sync + Downcast {
// buffers for copy allocators).
// 3. the binding disabled GC, and we end up over-allocating beyond the total pages determined by the GC trigger.
let available_pages = total_pages.saturating_sub(reserved_pages);
trace!(
"Total pages = {}, reserved pages = {}, available pages = {}",
total_pages,
reserved_pages,
available_pages,
);
trace!("Total pages = {total_pages}, reserved pages = {reserved_pages}, available pages = {available_pages}");
available_pages
}

Expand Down
3 changes: 1 addition & 2 deletions src/plan/mutator_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ impl<VM: VMBinding> std::fmt::Debug for MutatorConfig<VM> {
None => "!!!missing space here!!!",
};
f.write_fmt(format_args!(
"- {:?} = {:?} ({:?})\n",
semantic, selector, space_name
"- {semantic:?} = {selector:?} ({space_name:?})\n",
))?;
}
f.write_str("Space mapping:\n")?;
Expand Down
23 changes: 7 additions & 16 deletions src/plan/sticky/immix/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,22 +184,19 @@ impl<VM: VMBinding> Plan for StickyImmix<VM> {
if self.is_current_gc_nursery() {
// Every reachable object should be logged
if !VM::VMObjectModel::GLOBAL_LOG_BIT_SPEC.is_unlogged::<VM>(object, Ordering::SeqCst) {
error!("Object {} is not unlogged (all objects that have been traced should be unlogged/mature)", object);
error!("Object {object} is not unlogged (all objects that have been traced should be unlogged/mature)");
return false;
}

// Every reachable object should be marked
if self.immix.immix_space.in_space(object) && !self.immix.immix_space.is_marked(object)
{
error!(
"Object {} is not marked (all objects that have been traced should be marked)",
object
);
error!("Object {object} is not marked (all objects that have been traced should be marked)");
return false;
} else if self.immix.common.los.in_space(object)
&& !self.immix.common.los.is_live(object)
{
error!("LOS Object {} is not marked", object);
error!("LOS Object {object} is not marked");
return false;
}
}
Expand Down Expand Up @@ -253,15 +250,12 @@ impl<VM: VMBinding> crate::plan::generational::global::GenerationalPlanExt<VM> f
if self.immix.immix_space.in_space(object) {
if !self.is_object_in_nursery(object) {
// Mature object
trace!("Immix mature object {}, skip", object);
trace!("Immix mature object {object}, skip");
return object;
} else {
// Nursery object
let object = if KIND == TRACE_KIND_TRANSITIVE_PIN || KIND == TRACE_KIND_FAST {
trace!(
"Immix nursery object {} is being traced without moving",
object
);
trace!("Immix nursery object {object} is being traced without moving");
self.immix
.immix_space
.trace_object_without_moving(queue, object)
Expand All @@ -281,15 +275,12 @@ impl<VM: VMBinding> crate::plan::generational::global::GenerationalPlanExt<VM> f
if ret == object {
"".to_string()
} else {
format!("-> new object {}", ret)
format!("-> new object {ret}")
}
);
ret
} else {
trace!(
"Immix nursery object {} is being traced without moving",
object
);
trace!("Immix nursery object {object} is being traced without moving");
self.immix
.immix_space
.trace_object_without_moving(queue, object)
Expand Down
7 changes: 3 additions & 4 deletions src/policy/copyspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ impl<VM: VMBinding> CopySpace<VM> {
semantics: Option<CopySemantics>,
worker: &mut GCWorker<VM>,
) -> ObjectReference {
trace!("copyspace.trace_object(, {:?}, {:?})", object, semantics,);
trace!("copyspace.trace_object({object:?}, {semantics:?})");

// If this is not from space, we do not need to trace it (the object has been copied to the tosapce)
if !self.is_from_space() {
Expand All @@ -243,8 +243,7 @@ impl<VM: VMBinding> CopySpace<VM> {
#[cfg(feature = "vo_bit")]
debug_assert!(
crate::util::metadata::vo_bit::is_vo_bit_set(object),
"{:x}: VO bit not set",
object
"{object:x}: VO bit not set",
);

trace!("attempting to forward");
Expand All @@ -271,7 +270,7 @@ impl<VM: VMBinding> CopySpace<VM> {

trace!("Forwarding pointer");
queue.enqueue(new_object);
trace!("Copied [{:?} -> {:?}]", object, new_object);
trace!("Copied [{object:?} -> {new_object:?}]");
new_object
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/policy/immix/defrag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl Defrag {
|| !exhausted_reusable_space
|| stress_defrag
|| (collect_whole_heap && user_triggered && full_heap_system_gc));
info!("Defrag: {}", in_defrag);
info!("Defrag: {in_defrag}");
probe!(mmtk, immix_defrag, in_defrag);
self.in_defrag_collection
.store(in_defrag, Ordering::Release)
Expand Down
3 changes: 1 addition & 2 deletions src/policy/immix/immixspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,8 +664,7 @@ impl<VM: VMBinding> ImmixSpace<VM> {
if new_object == object {
debug_assert!(
self.is_marked(object) || self.defrag.space_exhausted() || self.is_pinned(object),
"Forwarded object is the same as original object {} even though it should have been copied",
object,
"Forwarded object is the same as original object {object} even though it should have been copied",
);
} else {
// new_object != object
Expand Down
3 changes: 1 addition & 2 deletions src/policy/immortalspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,7 @@ impl<VM: VMBinding> ImmortalSpace<VM> {
#[cfg(feature = "vo_bit")]
debug_assert!(
crate::util::metadata::vo_bit::is_vo_bit_set(object),
"{:x}: VO bit not set",
object
"{object:x}: VO bit not set",
);
if self.mark_state.test_and_mark::<VM>(object) {
// Set the unlog bit if required
Expand Down
10 changes: 3 additions & 7 deletions src/policy/largeobjectspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ impl<VM: VMBinding> LargeObjectSpace<VM> {
#[cfg(feature = "vo_bit")]
debug_assert!(
crate::util::metadata::vo_bit::is_vo_bit_set(object),
"{:x}: VO bit not set",
object
"{object:x}: VO bit not set",
);
let nursery_object = self.is_in_nursery(object);
trace!(
Expand All @@ -273,7 +272,7 @@ impl<VM: VMBinding> LargeObjectSpace<VM> {
// Note that test_and_mark() has side effects of
// clearing nursery bit/moving objects out of logical nursery
if self.test_and_mark(object, self.mark_state) {
trace!("LOS object {} is being marked now", object);
trace!("LOS object {object} is being marked now");
self.treadmill.copy(object, nursery_object);
// We just moved the object out of the logical nursery, mark it as unlogged.
// We also unlog mature objects as their unlog bit may have been unset before the
Expand All @@ -284,10 +283,7 @@ impl<VM: VMBinding> LargeObjectSpace<VM> {
}
queue.enqueue(object);
} else {
trace!(
"LOS object {} is not being marked now, it was marked before",
object
);
trace!("LOS object {object} is not being marked now, it was marked before");
}
}
object
Expand Down
14 changes: 6 additions & 8 deletions src/policy/markcompactspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,7 @@ impl<VM: VMBinding> MarkCompactSpace<VM> {
) -> ObjectReference {
debug_assert!(
crate::util::metadata::vo_bit::is_vo_bit_set(object),
"{:x}: VO bit not set",
object
"{object:x}: VO bit not set",
);
if MarkCompactSpace::<VM>::test_and_mark(object) {
queue.enqueue(object);
Expand All @@ -267,8 +266,7 @@ impl<VM: VMBinding> MarkCompactSpace<VM> {
) -> ObjectReference {
debug_assert!(
crate::util::metadata::vo_bit::is_vo_bit_set(object),
"{:x}: VO bit not set",
object
"{object:x}: VO bit not set",
);
// from this stage and onwards, mark bit is no longer needed
// therefore, it can be reused to save one extra bit in metadata
Expand Down Expand Up @@ -416,25 +414,25 @@ impl<VM: VMBinding> MarkCompactSpace<VM> {

let maybe_forwarding_pointer = Self::get_header_forwarding_pointer(obj);
if let Some(forwarding_pointer) = maybe_forwarding_pointer {
trace!("Compact {} to {}", obj, forwarding_pointer);
trace!("Compact {obj} to {forwarding_pointer}");
let new_object = forwarding_pointer;
Self::clear_header_forwarding_pointer(new_object);

// copy object
trace!(" copy from {} to {}", obj, new_object);
trace!(" copy from {obj} to {new_object}");
let end_of_new_object =
VM::VMObjectModel::copy_to(obj, new_object, Address::ZERO);
// update VO bit,
vo_bit::set_vo_bit(new_object);
to = new_object.to_object_start::<VM>() + copied_size;
debug_assert_eq!(end_of_new_object, to);
} else {
trace!("Skipping dead object {}", obj);
trace!("Skipping dead object {obj}");
}
}
}

debug!("Compact end: to = {}", to);
debug!("Compact end: to = {to}");

// reset the bump pointer
self.pr.reset_cursor(to);
Expand Down
Loading
Loading