]> git.lizzy.rs Git - rust.git/commitdiff
Inline some encoding and decoding methods.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 19 Feb 2020 05:54:36 +0000 (16:54 +1100)
committerNicholas Nethercote <nnethercote@mozilla.com>
Wed, 19 Feb 2020 05:54:36 +0000 (16:54 +1100)
This is a small performance win.

src/librustc/ty/codec.rs
src/librustc/ty/query/on_disk_cache.rs

index df1602b2ac46d83dd9265983a1eca524d252e490..c305999a64ba7ffd60b89984a7bb049b27283f4c 100644 (file)
@@ -301,6 +301,7 @@ pub fn decode_allocation<D>(decoder: &mut D) -> Result<&'tcx Allocation, D::Erro
 macro_rules! __impl_decoder_methods {
     ($($name:ident -> $ty:ty;)*) => {
         $(
+            #[inline]
             fn $name(&mut self) -> Result<$ty, Self::Error> {
                 self.opaque.$name()
             }
index 45d95e97a9cf06480eae036686e205f6e871a5c2..2f0f8e609c65fd51bfbc8d48cba3f8142ec1a18c 100644 (file)
@@ -943,6 +943,7 @@ fn specialized_encode(&mut self, val: &mir::ClearCrossCrate<T>) -> Result<(), Se
 
 macro_rules! encoder_methods {
     ($($name:ident($ty:ty);)*) => {
+        #[inline]
         $(fn $name(&mut self, value: $ty) -> Result<(), Self::Error> {
             self.encoder.$name(value)
         })*