about summary refs log tree commit diff
path: root/compiler/rustc_serialize/src/serialize.rs
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-02-24 23:58:32 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2023-02-25 01:04:56 +0100
commit7de205ea3affa62d0f847380ab7313d465c4b2e4 (patch)
tree9909b2fcc017a5b134a8ba1d27453e87e843c75d /compiler/rustc_serialize/src/serialize.rs
parent07c993eba8b76eae497e98433ae075b00f01be10 (diff)
downloadrust-7de205ea3affa62d0f847380ab7313d465c4b2e4.tar.gz
rust-7de205ea3affa62d0f847380ab7313d465c4b2e4.zip
Emit the enum discriminant separately for the Encodable macro
Diffstat (limited to 'compiler/rustc_serialize/src/serialize.rs')
-rw-r--r--compiler/rustc_serialize/src/serialize.rs12
1 files changed, 0 insertions, 12 deletions
diff --git a/compiler/rustc_serialize/src/serialize.rs b/compiler/rustc_serialize/src/serialize.rs
index 377c364961b..567fe06109b 100644
--- a/compiler/rustc_serialize/src/serialize.rs
+++ b/compiler/rustc_serialize/src/serialize.rs
@@ -43,7 +43,6 @@ pub trait Encoder {
     fn emit_str(&mut self, v: &str);
     fn emit_raw_bytes(&mut self, s: &[u8]);
 
-    // Convenience for the derive macro:
     fn emit_enum_variant<F>(&mut self, v_id: usize, f: F)
     where
         F: FnOnce(&mut Self),
@@ -51,17 +50,6 @@ pub trait Encoder {
         self.emit_usize(v_id);
         f(self);
     }
-
-    // We put the field index in a const generic to allow the emit_usize to be
-    // compiled into a more efficient form. In practice, the variant index is
-    // known at compile-time, and that knowledge allows much more efficient
-    // codegen than we'd otherwise get. LLVM isn't always able to make the
-    // optimization that would otherwise be necessary here, likely due to the
-    // multiple levels of inlining and const-prop that are needed.
-    #[inline]
-    fn emit_fieldless_enum_variant<const ID: usize>(&mut self) {
-        self.emit_usize(ID)
-    }
 }
 
 // Note: all the methods in this trait are infallible, which may be surprising.