Add sanity check to BinOp::ty()
This commit is contained in:
parent
77d7e44573
commit
4616b9fd1d
2 changed files with 27 additions and 8 deletions
|
@ -244,6 +244,19 @@ impl TyKind {
|
|||
matches!(self, TyKind::RigidTy(RigidTy::FnPtr(..)))
|
||||
}
|
||||
|
||||
pub fn is_primitive(&self) -> bool {
|
||||
matches!(
|
||||
self,
|
||||
TyKind::RigidTy(
|
||||
RigidTy::Bool
|
||||
| RigidTy::Char
|
||||
| RigidTy::Int(_)
|
||||
| RigidTy::Uint(_)
|
||||
| RigidTy::Float(_)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
pub fn trait_principal(&self) -> Option<Binder<ExistentialTraitRef>> {
|
||||
if let TyKind::RigidTy(RigidTy::Dynamic(predicates, _, _)) = self {
|
||||
if let Some(Binder { value: ExistentialPredicate::Trait(trait_ref), bound_vars }) =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue