From a20c917b29320a85b3a0f908f22b71f3e170f537 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Wed, 12 Nov 2025 21:01:32 +0100 Subject: [PATCH 1/2] Fix mismatched_lifetime_syntaxes warning Signed-off-by: Jonathan Schwender --- mozjs/src/gc/collections.rs | 2 +- mozjs/src/gc/custom.rs | 4 ++-- mozjs/src/gc/root.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mozjs/src/gc/collections.rs b/mozjs/src/gc/collections.rs index 28dd76867fd..c35d441647c 100644 --- a/mozjs/src/gc/collections.rs +++ b/mozjs/src/gc/collections.rs @@ -125,7 +125,7 @@ where Heap: Traceable + 'static, T: GCMethods + Copy, { - pub fn handle(&self) -> Handle { + pub fn handle(&self) -> Handle<'_, T> { unsafe { Handle::from_raw((*self.ptr).handle()) } } } diff --git a/mozjs/src/gc/custom.rs b/mozjs/src/gc/custom.rs index 2f36b21393b..20dd4d0e716 100644 --- a/mozjs/src/gc/custom.rs +++ b/mozjs/src/gc/custom.rs @@ -106,7 +106,7 @@ impl CustomAutoRooter { } } - pub fn root(&mut self, cx: *mut JSContext) -> CustomAutoRooterGuard { + pub fn root(&mut self, cx: *mut JSContext) -> CustomAutoRooterGuard<'_, T> { CustomAutoRooterGuard::new(cx, self) } } @@ -140,7 +140,7 @@ impl<'a, T: 'a + CustomTrace> CustomAutoRooterGuard<'a, T> { Handle::new(&self.rooter.data) } - pub fn handle_mut(&mut self) -> MutableHandle + pub fn handle_mut(&mut self) -> MutableHandle<'_, T> where T: RootKind, { diff --git a/mozjs/src/gc/root.rs b/mozjs/src/gc/root.rs index d9ee964b33f..9848e63ca69 100644 --- a/mozjs/src/gc/root.rs +++ b/mozjs/src/gc/root.rs @@ -42,7 +42,7 @@ impl<'a, T: 'a + RootKind> RootedGuard<'a, T> { Handle::new(&self) } - pub fn handle_mut(&mut self) -> MutableHandle { + pub fn handle_mut(&mut self) -> MutableHandle<'_, T> { unsafe { MutableHandle::from_marked_location(self.as_ptr()) } } @@ -206,7 +206,7 @@ impl<'a, T> MutableHandle<'a, T> { MutableHandle::from_marked_location(handle.ptr) } - pub fn handle(&self) -> Handle { + pub fn handle(&self) -> Handle<'_, T> { unsafe { Handle::new(&*self.ptr) } } From 8300852e95ff77b251dbb60865a9599fa907c6a0 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Tue, 18 Nov 2025 12:24:38 +0100 Subject: [PATCH 2/2] review suggestions Signed-off-by: Jonathan Schwender --- mozjs/src/gc/collections.rs | 2 +- mozjs/src/gc/custom.rs | 4 ++-- mozjs/src/gc/root.rs | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mozjs/src/gc/collections.rs b/mozjs/src/gc/collections.rs index c35d441647c..cbefa4621ee 100644 --- a/mozjs/src/gc/collections.rs +++ b/mozjs/src/gc/collections.rs @@ -125,7 +125,7 @@ where Heap: Traceable + 'static, T: GCMethods + Copy, { - pub fn handle(&self) -> Handle<'_, T> { + pub fn handle(&'_ self) -> Handle<'_, T> { unsafe { Handle::from_raw((*self.ptr).handle()) } } } diff --git a/mozjs/src/gc/custom.rs b/mozjs/src/gc/custom.rs index 20dd4d0e716..56e00966669 100644 --- a/mozjs/src/gc/custom.rs +++ b/mozjs/src/gc/custom.rs @@ -106,7 +106,7 @@ impl CustomAutoRooter { } } - pub fn root(&mut self, cx: *mut JSContext) -> CustomAutoRooterGuard<'_, T> { + pub fn root(&'_ mut self, cx: *mut JSContext) -> CustomAutoRooterGuard<'_, T> { CustomAutoRooterGuard::new(cx, self) } } @@ -140,7 +140,7 @@ impl<'a, T: 'a + CustomTrace> CustomAutoRooterGuard<'a, T> { Handle::new(&self.rooter.data) } - pub fn handle_mut(&mut self) -> MutableHandle<'_, T> + pub fn handle_mut(&'a mut self) -> MutableHandle<'a, T> where T: RootKind, { diff --git a/mozjs/src/gc/root.rs b/mozjs/src/gc/root.rs index 9848e63ca69..32a963f4ff0 100644 --- a/mozjs/src/gc/root.rs +++ b/mozjs/src/gc/root.rs @@ -42,7 +42,7 @@ impl<'a, T: 'a + RootKind> RootedGuard<'a, T> { Handle::new(&self) } - pub fn handle_mut(&mut self) -> MutableHandle<'_, T> { + pub fn handle_mut(&'a mut self) -> MutableHandle<'a, T> { unsafe { MutableHandle::from_marked_location(self.as_ptr()) } } @@ -206,7 +206,7 @@ impl<'a, T> MutableHandle<'a, T> { MutableHandle::from_marked_location(handle.ptr) } - pub fn handle(&self) -> Handle<'_, T> { + pub fn handle(&'a self) -> Handle<'a, T> { unsafe { Handle::new(&*self.ptr) } }