summaryrefslogtreecommitdiff
path: root/dhall_syntax/src
diff options
context:
space:
mode:
authorNadrieril2019-08-13 22:24:04 +0200
committerNadrieril2019-08-13 22:24:04 +0200
commit43094c8c52319aa82b03e73700ca1b5f65da13c6 (patch)
tree553cc678ea3cab0d7e83c43ba5fe29434e93a888 /dhall_syntax/src
parent8d45d633dfa60e8d64c9e6e742de4e33496bf0fa (diff)
The syntax has very little sharing; no need for Rc anymore
Diffstat (limited to 'dhall_syntax/src')
-rw-r--r--dhall_syntax/src/core/expr.rs16
1 files changed, 5 insertions, 11 deletions
diff --git a/dhall_syntax/src/core/expr.rs b/dhall_syntax/src/core/expr.rs
index 4c809f8..e3f8cec 100644
--- a/dhall_syntax/src/core/expr.rs
+++ b/dhall_syntax/src/core/expr.rs
@@ -168,8 +168,8 @@ pub enum Builtin {
}
// Each node carries an annotation. In practice it's either X (no annotation) or a Span.
-#[derive(Debug)]
-pub struct SubExpr<Embed>(Rc<(Expr<Embed>, Option<Span>)>);
+#[derive(Debug, Clone)]
+pub struct SubExpr<Embed>(Box<(Expr<Embed>, Option<Span>)>);
impl<Embed: PartialEq> std::cmp::PartialEq for SubExpr<Embed> {
fn eq(&self, other: &Self) -> bool {
@@ -336,11 +336,11 @@ impl<E> SubExpr<E> {
}
pub fn new(x: Expr<E>, n: Span) -> Self {
- SubExpr(Rc::new((x, Some(n))))
+ SubExpr(Box::new((x, Some(n))))
}
pub fn from_expr_no_span(x: Expr<E>) -> Self {
- SubExpr(Rc::new((x, None)))
+ SubExpr(Box::new((x, None)))
}
pub fn from_builtin(b: Builtin) -> Self {
@@ -348,7 +348,7 @@ impl<E> SubExpr<E> {
}
pub fn rewrap<E2>(&self, x: Expr<E2>) -> SubExpr<E2> {
- SubExpr(Rc::new((x, (self.0).1.clone())))
+ SubExpr(Box::new((x, (self.0).1.clone())))
}
}
@@ -361,12 +361,6 @@ impl<E> SubExpr<E> {
}
}
-impl<E> Clone for SubExpr<E> {
- fn clone(&self) -> Self {
- SubExpr(Rc::clone(&self.0))
- }
-}
-
// Should probably rename this
pub fn rc<E>(x: Expr<E>) -> SubExpr<E> {
SubExpr::from_expr_no_span(x)