From: Ian Jackson Date: Sat, 10 Jul 2021 15:19:33 +0000 (+0100) Subject: zcoord: Reject attempt to make range [X,X> X-Git-Tag: otter-0.7.2~161 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=cc3656f33feaa69a6ae1560d46e0284a82dbdcac;p=otter.git zcoord: Reject attempt to make range [X,X> Signed-off-by: Ian Jackson --- diff --git a/base/zcoord.rs b/base/zcoord.rs index f236ba1d..dbf37491 100644 --- a/base/zcoord.rs +++ b/base/zcoord.rs @@ -107,6 +107,8 @@ pub struct ParseError; pub enum RangeImpossible { #[error("Z coordinate range has end before start, cannot iterate")] Backwards, + #[error("Z coordinate range has end equal to start, cannot iterate")] + Empty, } #[derive(Error,Clone,Copy,Debug,Eq,PartialEq,Serialize,Deserialize)] @@ -382,7 +384,7 @@ impl Mutable { let aso = 'ok: loop { for i in 0.. { if i >= a.limbs.len() && i >= b.limbs.len() { // Oh actually these numbers are equal! - break 'ok ASRD { i: 0, step: ZERO }; + throw!(RangeImpossible::Empty); } current.extend_to_limb(i);