Skip to content

Commit a9d74e9

Browse files
committed
This causes an internal compiler error
1 parent e7057dc commit a9d74e9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/png/decoder.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,12 @@ impl<R: Read> PNGDecoder<R> {
242242
)))
243243
}
244244

245-
self.interlace_method = match FromPrimitive::from_u8(try!(try!(m.by_ref().bytes().next().ok_or(ImageError::ImageEnd)))) {
246-
Some(method) => method,
247-
None => return Err(ImageError::UnsupportedError(
245+
const NONE_U8: u8 = InterlaceMethod::None as u8;
246+
const ADAM7_U8: u8 = InterlaceMethod::Adam7 as u8;
247+
self.interlace_method = match try!(try!(m.by_ref().bytes().next().ok_or(ImageError::ImageEnd))) {
248+
NONE_U8 => InterlaceMethod::None,
249+
ADAM7_U8 => InterlaceMethod::Adam7,
250+
_ => return Err(ImageError::UnsupportedError(
248251
"Unsupported interlace method.".to_string()
249252
))
250253
};

0 commit comments

Comments
 (0)