Enable f16
and f128
in HIR
This commit is contained in:
parent
80bb15ed91
commit
dc65095298
@ -2444,7 +2444,7 @@ pub enum PrimTy {
|
||||
|
||||
impl PrimTy {
|
||||
/// All of the primitive types
|
||||
pub const ALL: [Self; 17] = [
|
||||
pub const ALL: [Self; 19] = [
|
||||
// any changes here should also be reflected in `PrimTy::from_name`
|
||||
Self::Int(IntTy::I8),
|
||||
Self::Int(IntTy::I16),
|
||||
@ -2458,9 +2458,10 @@ impl PrimTy {
|
||||
Self::Uint(UintTy::U64),
|
||||
Self::Uint(UintTy::U128),
|
||||
Self::Uint(UintTy::Usize),
|
||||
Self::Float(FloatTy::F16),
|
||||
Self::Float(FloatTy::F32),
|
||||
Self::Float(FloatTy::F64),
|
||||
// FIXME(f16_f128): add these when enabled below
|
||||
Self::Float(FloatTy::F128),
|
||||
Self::Bool,
|
||||
Self::Char,
|
||||
Self::Str,
|
||||
@ -2508,12 +2509,10 @@ pub fn from_name(name: Symbol) -> Option<Self> {
|
||||
sym::u64 => Self::Uint(UintTy::U64),
|
||||
sym::u128 => Self::Uint(UintTy::U128),
|
||||
sym::usize => Self::Uint(UintTy::Usize),
|
||||
sym::f16 => Self::Float(FloatTy::F16),
|
||||
sym::f32 => Self::Float(FloatTy::F32),
|
||||
sym::f64 => Self::Float(FloatTy::F64),
|
||||
// FIXME(f16_f128): enabling these will open the gates of f16 and f128 being
|
||||
// understood by rustc.
|
||||
// sym::f16 => Self::Float(FloatTy::F16),
|
||||
// sym::f128 => Self::Float(FloatTy::F128),
|
||||
sym::f128 => Self::Float(FloatTy::F128),
|
||||
sym::bool => Self::Bool,
|
||||
sym::char => Self::Char,
|
||||
sym::str => Self::Str,
|
||||
|
@ -561,10 +561,11 @@ fn lint_literal<'tcx>(
|
||||
ty::Float(t) => {
|
||||
let is_infinite = match lit.node {
|
||||
ast::LitKind::Float(v, _) => match t {
|
||||
ty::FloatTy::F16 => unimplemented!("f16_f128"),
|
||||
// FIXME(f16_f128): add this check once we have library support
|
||||
ty::FloatTy::F16 => Ok(false),
|
||||
ty::FloatTy::F32 => v.as_str().parse().map(f32::is_infinite),
|
||||
ty::FloatTy::F64 => v.as_str().parse().map(f64::is_infinite),
|
||||
ty::FloatTy::F128 => unimplemented!("f16_f128"),
|
||||
ty::FloatTy::F128 => Ok(false),
|
||||
},
|
||||
_ => bug!(),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user