@@ -22,6 +22,7 @@ pub struct View<'tcx, T> {
22
22
impl < T > Copy for View < ' _ , T > { }
23
23
24
24
impl < T > Clone for View < ' _ , T > {
25
+ #[ inline]
25
26
fn clone ( & self ) -> Self {
26
27
View { ty : self . ty , _marker : PhantomData }
27
28
}
49
50
T : TyDeref < ' tcx > ,
50
51
{
51
52
type Target = T ;
53
+
54
+ #[ inline]
52
55
fn deref ( & self ) -> & Self :: Target {
53
56
match T :: ty_deref ( self . ty ) {
54
57
Some ( t) => t,
@@ -62,13 +65,15 @@ impl<'tcx, T> View<'tcx, T>
62
65
where
63
66
T : TyDeref < ' tcx > ,
64
67
{
68
+ #[ inline]
65
69
pub fn new ( ty : Ty < ' tcx > ) -> Option < Self > {
66
70
T :: ty_deref ( ty) ?;
67
71
Some ( View { ty, _marker : PhantomData } )
68
72
}
69
73
}
70
74
71
75
impl < ' tcx , T > View < ' tcx , T > {
76
+ #[ inline]
72
77
pub fn as_ty ( & self ) -> Ty < ' tcx > {
73
78
self . ty
74
79
}
@@ -83,6 +88,7 @@ pub unsafe trait TyDeref<'tcx>: Sized + 'tcx {
83
88
macro_rules! impl_ty_deref {
84
89
( $ty: ty, $variant: ident) => {
85
90
unsafe impl <' tcx> TyDeref <' tcx> for $ty {
91
+ #[ inline]
86
92
fn ty_deref( ty: Ty <' tcx>) -> Option <& ' tcx Self > {
87
93
match & ty. kind {
88
94
ty:: $variant( p) => Some ( p) ,
@@ -129,6 +135,7 @@ pub enum ViewKind<'tcx> {
129
135
}
130
136
131
137
impl < ' tcx > From < Ty < ' tcx > > for ViewKind < ' tcx > {
138
+ #[ inline]
132
139
fn from ( ty : Ty < ' tcx > ) -> Self {
133
140
match ty. kind {
134
141
ty:: RawPtr ( tm) => Self :: RawPtr ( tm) ,
0 commit comments