@@ -1665,13 +1665,15 @@ impl RegionKind {
1665
1665
1666
1666
/// Type utilities
1667
1667
impl < ' a , ' gcx , ' tcx > TyS < ' tcx > {
1668
+ #[ inline]
1668
1669
pub fn is_unit ( & self ) -> bool {
1669
1670
match self . sty {
1670
1671
Tuple ( ref tys) => tys. is_empty ( ) ,
1671
1672
_ => false ,
1672
1673
}
1673
1674
}
1674
1675
1676
+ #[ inline]
1675
1677
pub fn is_never ( & self ) -> bool {
1676
1678
match self . sty {
1677
1679
Never => true ,
@@ -1726,6 +1728,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1726
1728
}
1727
1729
}
1728
1730
1731
+ #[ inline]
1729
1732
pub fn is_primitive ( & self ) -> bool {
1730
1733
match self . sty {
1731
1734
Bool | Char | Int ( _) | Uint ( _) | Float ( _) => true ,
@@ -1741,13 +1744,15 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1741
1744
}
1742
1745
}
1743
1746
1747
+ #[ inline]
1744
1748
pub fn is_ty_infer ( & self ) -> bool {
1745
1749
match self . sty {
1746
1750
Infer ( _) => true ,
1747
1751
_ => false ,
1748
1752
}
1749
1753
}
1750
1754
1755
+ #[ inline]
1751
1756
pub fn is_phantom_data ( & self ) -> bool {
1752
1757
if let Adt ( def, _) = self . sty {
1753
1758
def. is_phantom_data ( )
@@ -1756,22 +1761,26 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1756
1761
}
1757
1762
}
1758
1763
1764
+ #[ inline]
1759
1765
pub fn is_bool ( & self ) -> bool { self . sty == Bool }
1760
1766
1767
+ #[ inline]
1761
1768
pub fn is_param ( & self , index : u32 ) -> bool {
1762
1769
match self . sty {
1763
1770
ty:: Param ( ref data) => data. index == index,
1764
1771
_ => false ,
1765
1772
}
1766
1773
}
1767
1774
1775
+ #[ inline]
1768
1776
pub fn is_self ( & self ) -> bool {
1769
1777
match self . sty {
1770
1778
Param ( ref p) => p. is_self ( ) ,
1771
1779
_ => false ,
1772
1780
}
1773
1781
}
1774
1782
1783
+ #[ inline]
1775
1784
pub fn is_slice ( & self ) -> bool {
1776
1785
match self . sty {
1777
1786
RawPtr ( TypeAndMut { ty, .. } ) | Ref ( _, ty, _) => match ty. sty {
@@ -1814,13 +1823,15 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1814
1823
}
1815
1824
}
1816
1825
1826
+ #[ inline]
1817
1827
pub fn is_region_ptr ( & self ) -> bool {
1818
1828
match self . sty {
1819
1829
Ref ( ..) => true ,
1820
1830
_ => false ,
1821
1831
}
1822
1832
}
1823
1833
1834
+ #[ inline]
1824
1835
pub fn is_mutable_pointer ( & self ) -> bool {
1825
1836
match self . sty {
1826
1837
RawPtr ( TypeAndMut { mutbl : hir:: Mutability :: MutMutable , .. } ) |
@@ -1829,6 +1840,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1829
1840
}
1830
1841
}
1831
1842
1843
+ #[ inline]
1832
1844
pub fn is_unsafe_ptr ( & self ) -> bool {
1833
1845
match self . sty {
1834
1846
RawPtr ( _) => return true ,
@@ -1837,6 +1849,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1837
1849
}
1838
1850
1839
1851
/// Returns `true` if this type is an `Arc<T>`.
1852
+ #[ inline]
1840
1853
pub fn is_arc ( & self ) -> bool {
1841
1854
match self . sty {
1842
1855
Adt ( def, _) => def. is_arc ( ) ,
@@ -1845,13 +1858,15 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1845
1858
}
1846
1859
1847
1860
/// Returns `true` if this type is an `Rc<T>`.
1861
+ #[ inline]
1848
1862
pub fn is_rc ( & self ) -> bool {
1849
1863
match self . sty {
1850
1864
Adt ( def, _) => def. is_rc ( ) ,
1851
1865
_ => false ,
1852
1866
}
1853
1867
}
1854
1868
1869
+ #[ inline]
1855
1870
pub fn is_box ( & self ) -> bool {
1856
1871
match self . sty {
1857
1872
Adt ( def, _) => def. is_box ( ) ,
@@ -1870,6 +1885,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1870
1885
/// A scalar type is one that denotes an atomic datum, with no sub-components.
1871
1886
/// (A RawPtr is scalar because it represents a non-managed pointer, so its
1872
1887
/// contents are abstract to rustc.)
1888
+ #[ inline]
1873
1889
pub fn is_scalar ( & self ) -> bool {
1874
1890
match self . sty {
1875
1891
Bool | Char | Int ( _) | Float ( _) | Uint ( _) |
@@ -1880,6 +1896,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1880
1896
}
1881
1897
1882
1898
/// Returns `true` if this type is a floating point type.
1899
+ #[ inline]
1883
1900
pub fn is_floating_point ( & self ) -> bool {
1884
1901
match self . sty {
1885
1902
Float ( _) |
@@ -1888,13 +1905,15 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1888
1905
}
1889
1906
}
1890
1907
1908
+ #[ inline]
1891
1909
pub fn is_trait ( & self ) -> bool {
1892
1910
match self . sty {
1893
1911
Dynamic ( ..) => true ,
1894
1912
_ => false ,
1895
1913
}
1896
1914
}
1897
1915
1916
+ #[ inline]
1898
1917
pub fn is_enum ( & self ) -> bool {
1899
1918
match self . sty {
1900
1919
Adt ( adt_def, _) => {
@@ -1904,13 +1923,15 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1904
1923
}
1905
1924
}
1906
1925
1926
+ #[ inline]
1907
1927
pub fn is_closure ( & self ) -> bool {
1908
1928
match self . sty {
1909
1929
Closure ( ..) => true ,
1910
1930
_ => false ,
1911
1931
}
1912
1932
}
1913
1933
1934
+ #[ inline]
1914
1935
pub fn is_generator ( & self ) -> bool {
1915
1936
match self . sty {
1916
1937
Generator ( ..) => true ,
@@ -1926,13 +1947,15 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1926
1947
}
1927
1948
}
1928
1949
1950
+ #[ inline]
1929
1951
pub fn is_fresh_ty ( & self ) -> bool {
1930
1952
match self . sty {
1931
1953
Infer ( FreshTy ( _) ) => true ,
1932
1954
_ => false ,
1933
1955
}
1934
1956
}
1935
1957
1958
+ #[ inline]
1936
1959
pub fn is_fresh ( & self ) -> bool {
1937
1960
match self . sty {
1938
1961
Infer ( FreshTy ( _) ) => true ,
@@ -1942,6 +1965,7 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1942
1965
}
1943
1966
}
1944
1967
1968
+ #[ inline]
1945
1969
pub fn is_char ( & self ) -> bool {
1946
1970
match self . sty {
1947
1971
Char => true ,
@@ -1950,38 +1974,35 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
1950
1974
}
1951
1975
1952
1976
#[ inline]
1953
- pub fn is_fp ( & self ) -> bool {
1954
- match self . sty {
1955
- Infer ( FloatVar ( _) ) | Float ( _) => true ,
1956
- _ => false
1957
- }
1958
- }
1959
-
1960
1977
pub fn is_numeric ( & self ) -> bool {
1961
- self . is_integral ( ) || self . is_fp ( )
1978
+ self . is_integral ( ) || self . is_floating_point ( )
1962
1979
}
1963
1980
1981
+ #[ inline]
1964
1982
pub fn is_signed ( & self ) -> bool {
1965
1983
match self . sty {
1966
1984
Int ( _) => true ,
1967
1985
_ => false ,
1968
1986
}
1969
1987
}
1970
1988
1989
+ #[ inline]
1971
1990
pub fn is_pointer_sized ( & self ) -> bool {
1972
1991
match self . sty {
1973
1992
Int ( ast:: IntTy :: Isize ) | Uint ( ast:: UintTy :: Usize ) => true ,
1974
1993
_ => false ,
1975
1994
}
1976
1995
}
1977
1996
1997
+ #[ inline]
1978
1998
pub fn is_machine ( & self ) -> bool {
1979
1999
match self . sty {
1980
2000
Int ( ..) | Uint ( ..) | Float ( ..) => true ,
1981
2001
_ => false ,
1982
2002
}
1983
2003
}
1984
2004
2005
+ #[ inline]
1985
2006
pub fn has_concrete_skeleton ( & self ) -> bool {
1986
2007
match self . sty {
1987
2008
Param ( _) | Infer ( _) | Error => false ,
@@ -2028,13 +2049,15 @@ impl<'a, 'gcx, 'tcx> TyS<'tcx> {
2028
2049
}
2029
2050
}
2030
2051
2052
+ #[ inline]
2031
2053
pub fn is_fn ( & self ) -> bool {
2032
2054
match self . sty {
2033
2055
FnDef ( ..) | FnPtr ( _) => true ,
2034
2056
_ => false ,
2035
2057
}
2036
2058
}
2037
2059
2060
+ #[ inline]
2038
2061
pub fn is_impl_trait ( & self ) -> bool {
2039
2062
match self . sty {
2040
2063
Opaque ( ..) => true ,
0 commit comments