@@ -2130,37 +2130,24 @@ impl<'hir> LoweringContext<'_, 'hir> {
2130
2130
self . arena . alloc ( self . expr ( sp, hir:: ExprKind :: Tup ( & [ ] ) ) )
2131
2131
}
2132
2132
2133
- pub ( super ) fn expr_usize ( & mut self , sp : Span , value : usize ) -> hir:: Expr < ' hir > {
2133
+ fn expr_uint ( & mut self , sp : Span , ty : ast :: UintTy , value : u128 ) -> hir:: Expr < ' hir > {
2134
2134
let lit = self . arena . alloc ( hir:: Lit {
2135
2135
span : sp,
2136
- node : ast:: LitKind :: Int (
2137
- ( value as u128 ) . into ( ) ,
2138
- ast:: LitIntType :: Unsigned ( ast:: UintTy :: Usize ) ,
2139
- ) ,
2136
+ node : ast:: LitKind :: Int ( value. into ( ) , ast:: LitIntType :: Unsigned ( ty) ) ,
2140
2137
} ) ;
2141
2138
self . expr ( sp, hir:: ExprKind :: Lit ( lit) )
2142
2139
}
2143
2140
2141
+ pub ( super ) fn expr_usize ( & mut self , sp : Span , value : usize ) -> hir:: Expr < ' hir > {
2142
+ self . expr_uint ( sp, ast:: UintTy :: Usize , value as u128 )
2143
+ }
2144
+
2144
2145
pub ( super ) fn expr_u32 ( & mut self , sp : Span , value : u32 ) -> hir:: Expr < ' hir > {
2145
- let lit = self . arena . alloc ( hir:: Lit {
2146
- span : sp,
2147
- node : ast:: LitKind :: Int (
2148
- u128:: from ( value) . into ( ) ,
2149
- ast:: LitIntType :: Unsigned ( ast:: UintTy :: U32 ) ,
2150
- ) ,
2151
- } ) ;
2152
- self . expr ( sp, hir:: ExprKind :: Lit ( lit) )
2146
+ self . expr_uint ( sp, ast:: UintTy :: U32 , value as u128 )
2153
2147
}
2154
2148
2155
2149
pub ( super ) fn expr_u16 ( & mut self , sp : Span , value : u16 ) -> hir:: Expr < ' hir > {
2156
- let lit = self . arena . alloc ( hir:: Lit {
2157
- span : sp,
2158
- node : ast:: LitKind :: Int (
2159
- u128:: from ( value) . into ( ) ,
2160
- ast:: LitIntType :: Unsigned ( ast:: UintTy :: U16 ) ,
2161
- ) ,
2162
- } ) ;
2163
- self . expr ( sp, hir:: ExprKind :: Lit ( lit) )
2150
+ self . expr_uint ( sp, ast:: UintTy :: U16 , value as u128 )
2164
2151
}
2165
2152
2166
2153
pub ( super ) fn expr_char ( & mut self , sp : Span , value : char ) -> hir:: Expr < ' hir > {
0 commit comments