From bb02cc47c49ee3cc1e913c243d69ee7cb23df598 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 16 Jun 2022 16:00:25 +1000 Subject: Move `finish` out of the `Encoder` trait. This simplifies things, but requires making `CacheEncoder` non-generic. (This was previously merged as commit 4 in #94732 and then was reverted in #97905 because it caused a perf regression.) --- compiler/rustc_metadata/src/rmeta/encoder.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'compiler/rustc_metadata/src') diff --git a/compiler/rustc_metadata/src/rmeta/encoder.rs b/compiler/rustc_metadata/src/rmeta/encoder.rs index 91ca4ecf3e1..2db0800190a 100644 --- a/compiler/rustc_metadata/src/rmeta/encoder.rs +++ b/compiler/rustc_metadata/src/rmeta/encoder.rs @@ -94,9 +94,6 @@ macro_rules! encoder_methods { } impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> { - type Ok = ::Ok; - type Err = ::Err; - encoder_methods! { emit_usize(usize); emit_u128(u128); @@ -119,10 +116,6 @@ impl<'a, 'tcx> Encoder for EncodeContext<'a, 'tcx> { emit_str(&str); emit_raw_bytes(&[u8]); } - - fn finish(self) -> Result { - self.opaque.finish() - } } impl<'a, 'tcx, T> Encodable> for LazyValue { @@ -2216,7 +2209,7 @@ fn encode_metadata_impl(tcx: TyCtxt<'_>) -> EncodedMetadata { // culminating in the `CrateRoot` which points to all of it. let root = ecx.encode_crate_root(); - let mut result = ecx.opaque.finish().unwrap(); + let mut result = ecx.opaque.finish(); // Encode the root position. let header = METADATA_HEADER.len(); -- cgit 1.4.1-3-g733a5