From fe45c9b84e68dfc28b6e1890069c8f35393d8d68 Mon Sep 17 00:00:00 2001 From: GrayJack Date: Tue, 23 Apr 2024 02:58:39 -0300 Subject: [PATCH] fix: Use `'static` lifetime for `CFunOptions` This fixes another UB --- src/client.rs | 2 +- src/env.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client.rs b/src/client.rs index cbe2929180..e89dc4f053 100644 --- a/src/client.rs +++ b/src/client.rs @@ -245,7 +245,7 @@ impl JanetClient { /// # } /// ``` #[inline] - pub fn add_c_fn(&mut self, cfun_opt: CFunOptions) { + pub fn add_c_fn(&mut self, cfun_opt: CFunOptions<'static>) { if self.env().is_none() { self.env_table = Some(JanetEnvironment::default()); } diff --git a/src/env.rs b/src/env.rs index 30dfeab9fd..b5e30fd79d 100644 --- a/src/env.rs +++ b/src/env.rs @@ -90,7 +90,7 @@ impl JanetEnvironment { /// Add a C function in the environment and register it on the VM. #[crate::cjvg("1.0.0", "1.17.0")] #[inline] - pub fn add_c_fn(&mut self, cfun_opt: CFunOptions) { + pub fn add_c_fn(&mut self, cfun_opt: CFunOptions<'static>) { let namespace = cfun_opt .namespace .map(|s| s.as_ptr()) @@ -121,7 +121,7 @@ impl JanetEnvironment { /// Add a C function in the environment and register it on the VM. #[crate::cjvg("1.17.0")] #[inline] - pub fn add_c_fn(&mut self, cfun_opt: CFunOptions) { + pub fn add_c_fn(&mut self, cfun_opt: CFunOptions<'static>) { let namespace = cfun_opt .namespace .map(|s| s.as_ptr())