diff options
author | Nadrieril | 2019-11-11 13:55:51 +0000 |
---|---|---|
committer | Nadrieril | 2019-11-11 15:43:30 +0000 |
commit | 1c2460bf6ba944d970c6bb6d47863d0244621887 (patch) | |
tree | 699cda35bb3998e76b8b176c7671158c798bfaaa | |
parent | c9c248a4cab21fa1ae7692cd193e3b2c698d431d (diff) |
Ensure spans are compatible in Span::union
-rw-r--r-- | dhall_syntax/src/core/span.rs | 12 |
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 |