From 20b1a38414101f842a6d9201133a5aaaa45a7cec Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 31 Jan 2022 16:06:44 +0100 Subject: Switch from `Rc` to `Arc` --- src/eval/function.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/eval/function.rs') diff --git a/src/eval/function.rs b/src/eval/function.rs index 931a90a0..0edc1e78 100644 --- a/src/eval/function.rs +++ b/src/eval/function.rs @@ -1,5 +1,5 @@ use std::fmt::{self, Debug, Formatter, Write}; -use std::rc::Rc; +use std::sync::Arc; use super::{Cast, EvalContext, Value}; use crate::diag::{At, TypResult}; @@ -8,9 +8,9 @@ use crate::util::EcoString; /// An evaluatable function. #[derive(Clone)] -pub struct Function(Rc>); +pub struct Function(Arc>); -/// The unsized structure behind the [`Rc`]. +/// The unsized structure behind the [`Arc`]. struct Inner { name: Option, func: T, @@ -24,7 +24,7 @@ impl Function { where F: Fn(&mut EvalContext, &mut Args) -> TypResult + 'static, { - Self(Rc::new(Inner { name, func })) + Self(Arc::new(Inner { name, func })) } /// The name of the function. @@ -53,8 +53,8 @@ impl PartialEq for Function { fn eq(&self, other: &Self) -> bool { // We cast to thin pointers for comparison. std::ptr::eq( - Rc::as_ptr(&self.0) as *const (), - Rc::as_ptr(&other.0) as *const (), + Arc::as_ptr(&self.0) as *const (), + Arc::as_ptr(&other.0) as *const (), ) } } -- cgit v1.2.3