File tree 2 files changed +12
-24
lines changed
2 files changed +12
-24
lines changed Original file line number Diff line number Diff line change @@ -278,10 +278,6 @@ impl BinOp {
278
278
/// Return the type of this operation for the given input Ty.
279
279
/// This function does not perform type checking, and it currently doesn't handle SIMD.
280
280
pub fn ty ( & self , lhs_ty : Ty , rhs_ty : Ty ) -> Ty {
281
- let lhs_kind = lhs_ty. kind ( ) ;
282
- let rhs_kind = rhs_ty. kind ( ) ;
283
- assert ! ( lhs_kind. is_primitive( ) || lhs_kind. is_any_ptr( ) ) ;
284
- assert ! ( rhs_kind. is_primitive( ) || rhs_kind. is_any_ptr( ) ) ;
285
281
match self {
286
282
BinOp :: Add
287
283
| BinOp :: AddUnchecked
@@ -295,13 +291,23 @@ impl BinOp {
295
291
| BinOp :: BitAnd
296
292
| BinOp :: BitOr => {
297
293
assert_eq ! ( lhs_ty, rhs_ty) ;
294
+ assert ! ( lhs_ty. kind( ) . is_primitive( ) ) ;
298
295
lhs_ty
299
296
}
300
- BinOp :: Shl | BinOp :: ShlUnchecked | BinOp :: Shr | BinOp :: ShrUnchecked | BinOp :: Offset => {
297
+ BinOp :: Shl | BinOp :: ShlUnchecked | BinOp :: Shr | BinOp :: ShrUnchecked => {
298
+ assert ! ( lhs_ty. kind( ) . is_primitive( ) ) ;
299
+ assert ! ( rhs_ty. kind( ) . is_primitive( ) ) ;
300
+ lhs_ty
301
+ }
302
+ BinOp :: Offset => {
303
+ assert ! ( lhs_ty. kind( ) . is_raw_ptr( ) ) ;
304
+ assert ! ( rhs_ty. kind( ) . is_integral( ) ) ;
301
305
lhs_ty
302
306
}
303
307
BinOp :: Eq | BinOp :: Lt | BinOp :: Le | BinOp :: Ne | BinOp :: Ge | BinOp :: Gt => {
304
308
assert_eq ! ( lhs_ty, rhs_ty) ;
309
+ let lhs_kind = lhs_ty. kind ( ) ;
310
+ assert ! ( lhs_kind. is_primitive( ) || lhs_kind. is_raw_ptr( ) || lhs_kind. is_fn_ptr( ) ) ;
305
311
Ty :: bool_ty ( )
306
312
}
307
313
}
Original file line number Diff line number Diff line change @@ -283,24 +283,6 @@ impl TyKind {
283
283
)
284
284
}
285
285
286
- /// A scalar type is one that denotes an atomic datum, with no sub-components.
287
- /// (A RawPtr is scalar because it represents a non-managed pointer, so its
288
- /// contents are abstract to rustc.)
289
- #[ inline]
290
- pub fn is_scalar ( & self ) -> bool {
291
- matches ! (
292
- self ,
293
- TyKind :: RigidTy ( RigidTy :: Bool )
294
- | TyKind :: RigidTy ( RigidTy :: Char )
295
- | TyKind :: RigidTy ( RigidTy :: Int ( _) )
296
- | TyKind :: RigidTy ( RigidTy :: Float ( _) )
297
- | TyKind :: RigidTy ( RigidTy :: Uint ( _) )
298
- | TyKind :: RigidTy ( RigidTy :: FnDef ( ..) )
299
- | TyKind :: RigidTy ( RigidTy :: FnPtr ( _) )
300
- | TyKind :: RigidTy ( RigidTy :: RawPtr ( ..) )
301
- )
302
- }
303
-
304
286
#[ inline]
305
287
pub fn is_float ( & self ) -> bool {
306
288
matches ! ( self , TyKind :: RigidTy ( RigidTy :: Float ( _) ) )
@@ -871,7 +853,7 @@ pub struct Binder<T> {
871
853
872
854
impl < T > Binder < T > {
873
855
/// Create a new binder with the given bound vars.
874
- pub fn new ( value : T , bound_vars : Vec < BoundVariableKind > ) -> Self {
856
+ pub fn bind_with_vars ( value : T , bound_vars : Vec < BoundVariableKind > ) -> Self {
875
857
Binder { value, bound_vars }
876
858
}
877
859
You can’t perform that action at this time.
0 commit comments