From 19a1b8bfef47fca60ce5efc92ca479a475799d6e Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sun, 10 Mar 2019 00:14:37 +0100 Subject: Use Rc for Label Closes #18 --- dhall_core/src/core.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'dhall_core/src') diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index e3e1f5c..5026328 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -2,6 +2,7 @@ use std::collections::BTreeMap; use std::fmt::{self, Display}; use std::path::PathBuf; +use std::rc::Rc; /// Constants for a pure type system /// @@ -70,35 +71,36 @@ pub struct Import { // The type for labels throughout the AST // It owns the data because otherwise lifetimes would make recursive imports impossible #[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)] -pub struct Label(String); +pub struct Label(Rc); impl From for Label { fn from(s: String) -> Self { - Label(s) + let s: &str = &s; + Label(s.into()) } } impl From<&'static str> for Label { fn from(s: &'static str) -> Self { - Label(s.to_owned()) + Label(s.into()) } } impl From