about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-02-15 23:48:43 +0000
committerbors <bors@rust-lang.org>2022-02-15 23:48:43 +0000
commit393fdc10483da930cdbb00eabc3635030d2e776f (patch)
tree06051c3b994dc99715d7f294a525dd1c057d3d1c /compiler
parent09cb29c64c2a0e15debf2d6fca2bc7c71a682033 (diff)
parentea7142076194517f84a5b867bd49e62a814a8622 (diff)
downloadrust-393fdc10483da930cdbb00eabc3635030d2e776f.tar.gz
rust-393fdc10483da930cdbb00eabc3635030d2e776f.zip
Auto merge of #94021 - tmiasko:inline, r=nagisa
Inline a few trivial conversion functions
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_infer/src/infer/type_variable.rs1
-rw-r--r--compiler/rustc_middle/src/infer/unify_key.rs4
-rw-r--r--compiler/rustc_middle/src/ty/subst.rs4
-rw-r--r--compiler/rustc_mir_transform/src/dest_prop.rs2
-rw-r--r--compiler/rustc_span/src/hygiene.rs2
-rw-r--r--compiler/rustc_target/src/spec/mod.rs2
-rw-r--r--compiler/rustc_type_ir/src/lib.rs5
7 files changed, 20 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/infer/type_variable.rs b/compiler/rustc_infer/src/infer/type_variable.rs
index d320728a43f..0864edf4451 100644
--- a/compiler/rustc_infer/src/infer/type_variable.rs
+++ b/compiler/rustc_infer/src/infer/type_variable.rs
@@ -416,6 +416,7 @@ impl<'tcx> ut::UnifyKey for TyVidEqKey<'tcx> {
     fn index(&self) -> u32 {
         self.vid.as_u32()
     }
+    #[inline]
     fn from_index(i: u32) -> Self {
         TyVidEqKey::from(ty::TyVid::from_u32(i))
     }
diff --git a/compiler/rustc_middle/src/infer/unify_key.rs b/compiler/rustc_middle/src/infer/unify_key.rs
index 7a6d08fcc34..dd303aaada9 100644
--- a/compiler/rustc_middle/src/infer/unify_key.rs
+++ b/compiler/rustc_middle/src/infer/unify_key.rs
@@ -32,9 +32,11 @@ impl<'tcx> From<ty::RegionVid> for RegionVidKey<'tcx> {
 
 impl<'tcx> UnifyKey for RegionVidKey<'tcx> {
     type Value = UnifiedRegion<'tcx>;
+    #[inline]
     fn index(&self) -> u32 {
         self.vid.as_u32()
     }
+    #[inline]
     fn from_index(i: u32) -> Self {
         RegionVidKey::from(ty::RegionVid::from_u32(i))
     }
@@ -118,9 +120,11 @@ pub struct ConstVarValue<'tcx> {
 
 impl<'tcx> UnifyKey for ty::ConstVid<'tcx> {
     type Value = ConstVarValue<'tcx>;
+    #[inline]
     fn index(&self) -> u32 {
         self.index
     }
+    #[inline]
     fn from_index(i: u32) -> Self {
         ty::ConstVid { index: i, phantom: PhantomData }
     }
diff --git a/compiler/rustc_middle/src/ty/subst.rs b/compiler/rustc_middle/src/ty/subst.rs
index 151dbcea6b5..7dccef5e3ef 100644
--- a/compiler/rustc_middle/src/ty/subst.rs
+++ b/compiler/rustc_middle/src/ty/subst.rs
@@ -48,6 +48,7 @@ pub enum GenericArgKind<'tcx> {
 }
 
 impl<'tcx> GenericArgKind<'tcx> {
+    #[inline]
     fn pack(self) -> GenericArg<'tcx> {
         let (tag, ptr) = match self {
             GenericArgKind::Lifetime(lt) => {
@@ -94,18 +95,21 @@ impl<'tcx> PartialOrd for GenericArg<'tcx> {
 }
 
 impl<'tcx> From<ty::Region<'tcx>> for GenericArg<'tcx> {
+    #[inline]
     fn from(r: ty::Region<'tcx>) -> GenericArg<'tcx> {
         GenericArgKind::Lifetime(r).pack()
     }
 }
 
 impl<'tcx> From<Ty<'tcx>> for GenericArg<'tcx> {
+    #[inline]
     fn from(ty: Ty<'tcx>) -> GenericArg<'tcx> {
         GenericArgKind::Type(ty).pack()
     }
 }
 
 impl<'tcx> From<ty::Const<'tcx>> for GenericArg<'tcx> {
+    #[inline]
     fn from(c: ty::Const<'tcx>) -> GenericArg<'tcx> {
         GenericArgKind::Const(c).pack()
     }
diff --git a/compiler/rustc_mir_transform/src/dest_prop.rs b/compiler/rustc_mir_transform/src/dest_prop.rs
index d469be74641..237ead591a5 100644
--- a/compiler/rustc_mir_transform/src/dest_prop.rs
+++ b/compiler/rustc_mir_transform/src/dest_prop.rs
@@ -222,9 +222,11 @@ impl From<Local> for UnifyLocal {
 
 impl UnifyKey for UnifyLocal {
     type Value = ();
+    #[inline]
     fn index(&self) -> u32 {
         self.0.as_u32()
     }
+    #[inline]
     fn from_index(u: u32) -> Self {
         Self(Local::from_u32(u))
     }
diff --git a/compiler/rustc_span/src/hygiene.rs b/compiler/rustc_span/src/hygiene.rs
index e0d6bd8cb7b..8265eb23c3d 100644
--- a/compiler/rustc_span/src/hygiene.rs
+++ b/compiler/rustc_span/src/hygiene.rs
@@ -172,10 +172,12 @@ impl LocalExpnId {
     /// The ID of the theoretical expansion that generates freshly parsed, unexpanded AST.
     pub const ROOT: LocalExpnId = LocalExpnId::from_u32(0);
 
+    #[inline]
     pub fn from_raw(idx: ExpnIndex) -> LocalExpnId {
         LocalExpnId::from_u32(idx.as_u32())
     }
 
+    #[inline]
     pub fn as_raw(self) -> ExpnIndex {
         ExpnIndex::from_u32(self.as_u32())
     }
diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs
index d735f3d41fd..bfafe2d83d7 100644
--- a/compiler/rustc_target/src/spec/mod.rs
+++ b/compiler/rustc_target/src/spec/mod.rs
@@ -1541,11 +1541,13 @@ impl Default for TargetOptions {
 impl Deref for Target {
     type Target = TargetOptions;
 
+    #[inline]
     fn deref(&self) -> &Self::Target {
         &self.options
     }
 }
 impl DerefMut for Target {
+    #[inline]
     fn deref_mut(&mut self) -> &mut Self::Target {
         &mut self.options
     }
diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs
index ec6fb622d32..e26f0033156 100644
--- a/compiler/rustc_type_ir/src/lib.rs
+++ b/compiler/rustc_type_ir/src/lib.rs
@@ -400,9 +400,11 @@ pub enum InferTy {
 /// they carry no values.
 impl UnifyKey for TyVid {
     type Value = ();
+    #[inline]
     fn index(&self) -> u32 {
         self.as_u32()
     }
+    #[inline]
     fn from_index(i: u32) -> TyVid {
         TyVid::from_u32(i)
     }
@@ -419,6 +421,7 @@ impl UnifyKey for IntVid {
     fn index(&self) -> u32 {
         self.index
     }
+    #[inline]
     fn from_index(i: u32) -> IntVid {
         IntVid { index: i }
     }
@@ -431,9 +434,11 @@ impl EqUnifyValue for FloatVarValue {}
 
 impl UnifyKey for FloatVid {
     type Value = Option<FloatVarValue>;
+    #[inline]
     fn index(&self) -> u32 {
         self.index
     }
+    #[inline]
     fn from_index(i: u32) -> FloatVid {
         FloatVid { index: i }
     }