summaryrefslogtreecommitdiff
path: root/dhall_syntax/src
diff options
context:
space:
mode:
authorNadrieril2019-11-11 13:55:51 +0000
committerNadrieril2019-11-11 15:43:30 +0000
commit1c2460bf6ba944d970c6bb6d47863d0244621887 (patch)
tree699cda35bb3998e76b8b176c7671158c798bfaaa /dhall_syntax/src
parentc9c248a4cab21fa1ae7692cd193e3b2c698d431d (diff)
Ensure spans are compatible in Span::union
Diffstat (limited to '')
-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