summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dhall_syntax/src/core/span.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/dhall_syntax/src/core/span.rs b/dhall_syntax/src/core/span.rs
index d63a619..f9c7008 100644
--- a/dhall_syntax/src/core/span.rs
+++ b/dhall_syntax/src/core/span.rs
@@ -40,11 +40,13 @@ impl Span {
use std::cmp::{max, min};
use Span::*;
match (self, other) {
- (Parsed(x), Parsed(y)) => Parsed(ParsedSpan {
- input: x.input.clone(),
- start: min(x.start, y.start),
- end: max(x.end, y.end),
- }),
+ (Parsed(x), Parsed(y)) if Rc::ptr_eq(&x.input, &y.input) => {
+ Parsed(ParsedSpan {
+ input: x.input.clone(),
+ start: min(x.start, y.start),
+ end: max(x.end, y.end),
+ })
+ }
_ => panic!(
"Tried to union incompatible spans: {:?} and {:?}",
self, other