Skip to content

Commit d046777

Browse files
committed
Inline GenericArg conversion functions
1 parent cd37638 commit d046777

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_middle/src/ty/subst.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ pub enum GenericArgKind<'tcx> {
4848
}
4949

5050
impl<'tcx> GenericArgKind<'tcx> {
51+
#[inline]
5152
fn pack(self) -> GenericArg<'tcx> {
5253
let (tag, ptr) = match self {
5354
GenericArgKind::Lifetime(lt) => {
@@ -94,18 +95,21 @@ impl<'tcx> PartialOrd for GenericArg<'tcx> {
9495
}
9596

9697
impl<'tcx> From<ty::Region<'tcx>> for GenericArg<'tcx> {
98+
#[inline]
9799
fn from(r: ty::Region<'tcx>) -> GenericArg<'tcx> {
98100
GenericArgKind::Lifetime(r).pack()
99101
}
100102
}
101103

102104
impl<'tcx> From<Ty<'tcx>> for GenericArg<'tcx> {
105+
#[inline]
103106
fn from(ty: Ty<'tcx>) -> GenericArg<'tcx> {
104107
GenericArgKind::Type(ty).pack()
105108
}
106109
}
107110

108111
impl<'tcx> From<ty::Const<'tcx>> for GenericArg<'tcx> {
112+
#[inline]
109113
fn from(c: ty::Const<'tcx>) -> GenericArg<'tcx> {
110114
GenericArgKind::Const(c).pack()
111115
}

0 commit comments

Comments
 (0)