Replace ScalarKind with Primitive

This commit is contained in:
Oliver Schneider
2018-05-23 19:39:49 +02:00
parent cc60a22b10
commit c420531304
13 changed files with 83 additions and 213 deletions

View File

@@ -33,6 +33,8 @@ use std::fmt;
use rustc_data_structures::sync::Lrc;
use std::u32;
pub use rustc_target::abi::FloatTy;
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub struct Label {
pub ident: Ident,
@@ -1519,41 +1521,6 @@ impl fmt::Display for UintTy {
}
}
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy,
PartialOrd, Ord)]
pub enum FloatTy {
F32,
F64,
}
impl fmt::Debug for FloatTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Display::fmt(self, f)
}
}
impl fmt::Display for FloatTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.ty_to_string())
}
}
impl FloatTy {
pub fn ty_to_string(&self) -> &'static str {
match *self {
FloatTy::F32 => "f32",
FloatTy::F64 => "f64",
}
}
pub fn bit_width(&self) -> usize {
match *self {
FloatTy::F32 => 32,
FloatTy::F64 => 64,
}
}
}
// Bind a type to an associated type: `A=Foo`.
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug)]
pub struct TypeBinding {