diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 5fee7173c87..83d0a1fdfdb 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -295,12 +295,7 @@ impl<'a, 'tcx, T> SpecializedDecoder> for DecodeContext<'a, 'tcx> { impl<'a, 'tcx> SpecializedDecoder for DecodeContext<'a, 'tcx> { fn specialized_decode(&mut self) -> Result { - let cnum = CrateNum::from_u32(u32::decode(self)?); - if cnum == LOCAL_CRATE { - Ok(self.cdata().cnum) - } else { - Ok(self.cdata().cnum_map.borrow()[cnum]) - } + ty_codec::decode_cnum(self) } }