From 4d4b7e82a2e2eddc287b3836570a3647f4732687 Mon Sep 17 00:00:00 2001 From: Kunshan Wang Date: Tue, 12 Aug 2025 10:44:55 +0800 Subject: [PATCH 1/2] Fix Clippy 1.89 warnings Clippy 1.89 starts to warn about `mismatched_lifetime_syntaxes`. We fix our function signatures by adding `'_` in the return types. --- src/plan/global.rs | 2 +- src/scheduler/worker.rs | 4 ++-- src/util/heap/externalpageresource.rs | 2 +- src/util/heap/layout/map32.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/plan/global.rs b/src/plan/global.rs index cd087bc20f..8b6865f42c 100644 --- a/src/plan/global.rs +++ b/src/plan/global.rs @@ -410,7 +410,7 @@ impl CreateSpecificPlanArgs<'_, VM> { zeroed: bool, permission_exec: bool, vmrequest: VMRequest, - ) -> PlanCreateSpaceArgs { + ) -> PlanCreateSpaceArgs<'_, VM> { PlanCreateSpaceArgs { name, zeroed, diff --git a/src/scheduler/worker.rs b/src/scheduler/worker.rs index 40a54e4046..005ee95e1a 100644 --- a/src/scheduler/worker.rs +++ b/src/scheduler/worker.rs @@ -111,11 +111,11 @@ const STAT_BORROWED_MSG: &str = "GCWorkerShared.stat is already borrowed. This the mutator calls harness_begin or harness_end while the GC is running."; impl GCWorkerShared { - pub fn borrow_stat(&self) -> AtomicRef> { + pub fn borrow_stat(&self) -> AtomicRef<'_, WorkerLocalStat> { self.stat.try_borrow().expect(STAT_BORROWED_MSG) } - pub fn borrow_stat_mut(&self) -> AtomicRefMut> { + pub fn borrow_stat_mut(&self) -> AtomicRefMut<'_, WorkerLocalStat> { self.stat.try_borrow_mut().expect(STAT_BORROWED_MSG) } } diff --git a/src/util/heap/externalpageresource.rs b/src/util/heap/externalpageresource.rs index 613042b8ba..3c8a8d3c2f 100644 --- a/src/util/heap/externalpageresource.rs +++ b/src/util/heap/externalpageresource.rs @@ -77,7 +77,7 @@ impl ExternalPageResource { lock.push(pages); } - pub fn get_external_pages(&self) -> MutexGuard> { + pub fn get_external_pages(&self) -> MutexGuard<'_, Vec> { self.ranges.lock().unwrap() } } diff --git a/src/util/heap/layout/map32.rs b/src/util/heap/layout/map32.rs index 1f32dd8200..c3628c572e 100644 --- a/src/util/heap/layout/map32.rs +++ b/src/util/heap/layout/map32.rs @@ -268,7 +268,7 @@ impl Map32 { /// Get a mutable reference to the inner Map32Inner with a lock. /// The caller should only use the mutable reference while holding the lock. #[allow(clippy::mut_from_ref)] - fn mut_self_with_sync(&self) -> (MutexGuard<()>, &mut Map32Inner) { + fn mut_self_with_sync(&self) -> (MutexGuard<'_, ()>, &mut Map32Inner) { let guard = self.sync.lock().unwrap(); (guard, unsafe { self.mut_self() }) } From 277462ac1521260c0b887012f051e61abc119fd9 Mon Sep 17 00:00:00 2001 From: Kunshan Wang Date: Tue, 12 Aug 2025 11:22:03 +0800 Subject: [PATCH 2/2] Allow dead code in my_vm They are used by the VMBinding, but Clippy consider them dead code, too. --- src/vm/tests/mock_tests/mock_test_doc_weakref_code_example.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vm/tests/mock_tests/mock_test_doc_weakref_code_example.rs b/src/vm/tests/mock_tests/mock_test_doc_weakref_code_example.rs index d7be4e8fe6..218c461b72 100644 --- a/src/vm/tests/mock_tests/mock_test_doc_weakref_code_example.rs +++ b/src/vm/tests/mock_tests/mock_test_doc_weakref_code_example.rs @@ -16,7 +16,8 @@ struct VMScanning; // Just to make the code example look better. use MockVM as MyVM; -// Placeholders for functions supposed to be implemented byu the VM. +// Placeholders for functions supposed to be implemented by the VM. +#[allow(dead_code)] mod my_vm { use crate::util::ObjectReference;