[breaking-change] don't glob export ast::FloatTy variants

This commit is contained in:
Oliver Schneider 2016-02-08 16:09:01 +01:00
parent 80bf9ae18a
commit ccf48bcd40
14 changed files with 37 additions and 38 deletions

View File

@ -1314,8 +1314,8 @@ fn cast_const<'tcx>(tcx: &ty::ctxt<'tcx>, val: ConstVal, ty: Ty) -> CastResult {
ty::TyUint(ast::TyU32) => convert_val!(u32, Uint, u64),
ty::TyUint(ast::TyU64) => convert_val!(u64, Uint, u64),
ty::TyFloat(ast::TyF32) => convert_val!(f32, Float, f64),
ty::TyFloat(ast::TyF64) => convert_val!(f64, Float, f64),
ty::TyFloat(ast::FloatTy::F32) => convert_val!(f32, Float, f64),
ty::TyFloat(ast::FloatTy::F64) => convert_val!(f64, Float, f64),
_ => Err(ErrKind::CannotCast),
}
}

View File

@ -202,8 +202,8 @@ impl<'tcx> CommonTypes<'tcx> {
u16: mk(TyUint(ast::TyU16)),
u32: mk(TyUint(ast::TyU32)),
u64: mk(TyUint(ast::TyU64)),
f32: mk(TyFloat(ast::TyF32)),
f64: mk(TyFloat(ast::TyF64)),
f32: mk(TyFloat(ast::FloatTy::F32)),
f64: mk(TyFloat(ast::FloatTy::F64)),
}
}
}
@ -860,8 +860,8 @@ impl<'tcx> ctxt<'tcx> {
pub fn mk_mach_float(&self, tm: ast::FloatTy) -> Ty<'tcx> {
match tm {
ast::TyF32 => self.types.f32,
ast::TyF64 => self.types.f64,
ast::FloatTy::F32 => self.types.f32,
ast::FloatTy::F64 => self.types.f64,
}
}

View File

@ -267,8 +267,8 @@ impl LateLintPass for TypeLimits {
fn float_ty_range(float_ty: ast::FloatTy) -> (f64, f64) {
match float_ty {
ast::TyF32 => (f32::MIN as f64, f32::MAX as f64),
ast::TyF64 => (f64::MIN, f64::MAX)
ast::FloatTy::F32 => (f32::MIN as f64, f32::MAX as f64),
ast::FloatTy::F64 => (f64::MIN, f64::MAX)
}
}

View File

@ -94,8 +94,8 @@ pub fn enc_ty<'a, 'tcx>(w: &mut Cursor<Vec<u8>>, cx: &ctxt<'a, 'tcx>, t: Ty<'tcx
}
ty::TyFloat(t) => {
match t {
ast::TyF32 => write!(w, "Mf"),
ast::TyF64 => write!(w, "MF"),
ast::FloatTy::F32 => write!(w, "Mf"),
ast::FloatTy::F64 => write!(w, "MF"),
};
}
ty::TyEnum(def, substs) => {

View File

@ -60,9 +60,9 @@ use rustc::middle::subst::{ParamSpace, FnSpace, TypeSpace};
use rustc::middle::ty::{Freevar, FreevarMap, TraitMap, GlobMap};
use rustc::util::nodemap::{NodeMap, DefIdSet, FnvHashMap};
use syntax::ast;
use syntax::ast::{self, FloatTy};
use syntax::ast::{CRATE_NODE_ID, Name, NodeId, CrateNum, TyIs, TyI8, TyI16, TyI32, TyI64};
use syntax::ast::{TyUs, TyU8, TyU16, TyU32, TyU64, TyF64, TyF32};
use syntax::ast::{TyUs, TyU8, TyU16, TyU32, TyU64};
use syntax::attr::AttrMetaMethods;
use syntax::codemap::{self, Span, Pos};
use syntax::errors::DiagnosticBuilder;
@ -1074,8 +1074,8 @@ impl PrimitiveTypeTable {
table.intern("bool", TyBool);
table.intern("char", TyChar);
table.intern("f32", TyFloat(TyF32));
table.intern("f64", TyFloat(TyF64));
table.intern("f32", TyFloat(FloatTy::F32));
table.intern("f64", TyFloat(FloatTy::F64));
table.intern("isize", TyInt(TyIs));
table.intern("i8", TyInt(TyI8));
table.intern("i16", TyInt(TyI16));

View File

@ -1230,8 +1230,8 @@ pub fn push_unique_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
ty::TyUint(ast::TyU16) => output.push_str("u16"),
ty::TyUint(ast::TyU32) => output.push_str("u32"),
ty::TyUint(ast::TyU64) => output.push_str("u64"),
ty::TyFloat(ast::TyF32) => output.push_str("f32"),
ty::TyFloat(ast::TyF64) => output.push_str("f64"),
ty::TyFloat(ast::FloatTy::F32) => output.push_str("f32"),
ty::TyFloat(ast::FloatTy::F64) => output.push_str("f64"),
ty::TyStruct(adt_def, substs) |
ty::TyEnum(adt_def, substs) => {
push_item_name(cx, adt_def.did, output);

View File

@ -147,8 +147,8 @@ impl Type {
pub fn float_from_ty(ccx: &CrateContext, t: ast::FloatTy) -> Type {
match t {
ast::TyF32 => Type::f32(ccx),
ast::TyF64 => Type::f64(ccx),
ast::FloatTy::F32 => Type::f32(ccx),
ast::FloatTy::F64 => Type::f64(ccx),
}
}

View File

@ -443,8 +443,8 @@ fn match_intrinsic_type_to_type<'tcx, 'a>(
n = bits)),
},
Float(bits) => match (bits, &t.sty) {
(32, &ty::TyFloat(ast::FloatTy::TyF32)) |
(64, &ty::TyFloat(ast::FloatTy::TyF64)) => {},
(32, &ty::TyFloat(ast::FloatTy::F32)) |
(64, &ty::TyFloat(ast::FloatTy::F64)) => {},
_ => simple_error(&format!("`{}`", t),
&format!("`f{n}`", n = bits)),
},

View File

@ -357,11 +357,11 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
let lang_def_id = self.tcx().lang_items.usize_impl();
self.assemble_inherent_impl_for_primitive(lang_def_id);
}
ty::TyFloat(ast::TyF32) => {
ty::TyFloat(ast::FloatTy::F32) => {
let lang_def_id = self.tcx().lang_items.f32_impl();
self.assemble_inherent_impl_for_primitive(lang_def_id);
}
ty::TyFloat(ast::TyF64) => {
ty::TyFloat(ast::FloatTy::F64) => {
let lang_def_id = self.tcx().lang_items.f64_impl();
self.assemble_inherent_impl_for_primitive(lang_def_id);
}

View File

@ -2556,7 +2556,7 @@ fn check_argument_types<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
let arg_ty = structurally_resolved_type(fcx, arg.span,
fcx.expr_ty(&**arg));
match arg_ty.sty {
ty::TyFloat(ast::TyF32) => {
ty::TyFloat(ast::FloatTy::F32) => {
fcx.type_error_message(arg.span,
|t| {
format!("can't pass an {} to variadic \

View File

@ -191,14 +191,14 @@ impl<'cx, 'tcx> OrphanChecker<'cx, 'tcx> {
"usize",
item.span);
}
ty::TyFloat(ast::TyF32) => {
ty::TyFloat(ast::FloatTy::F32) => {
self.check_primitive_impl(def_id,
self.tcx.lang_items.f32_impl(),
"f32",
"f32",
item.span);
}
ty::TyFloat(ast::TyF64) => {
ty::TyFloat(ast::FloatTy::F64) => {
self.check_primitive_impl(def_id,
self.tcx.lang_items.f64_impl(),
"f64",

View File

@ -1650,8 +1650,8 @@ impl<'tcx> Clean<Type> for ty::Ty<'tcx> {
ty::TyUint(ast::TyU16) => Primitive(U16),
ty::TyUint(ast::TyU32) => Primitive(U32),
ty::TyUint(ast::TyU64) => Primitive(U64),
ty::TyFloat(ast::TyF32) => Primitive(F32),
ty::TyFloat(ast::TyF64) => Primitive(F64),
ty::TyFloat(ast::FloatTy::F32) => Primitive(F32),
ty::TyFloat(ast::FloatTy::F64) => Primitive(F64),
ty::TyStr => Primitive(Str),
ty::TyBox(t) => {
let box_did = cx.tcx_opt().and_then(|tcx| {
@ -2629,8 +2629,8 @@ fn resolve_type(cx: &DocContext,
hir::TyUint(ast::TyU16) => return Primitive(U16),
hir::TyUint(ast::TyU32) => return Primitive(U32),
hir::TyUint(ast::TyU64) => return Primitive(U64),
hir::TyFloat(ast::TyF32) => return Primitive(F32),
hir::TyFloat(ast::TyF64) => return Primitive(F64),
hir::TyFloat(ast::FloatTy::F32) => return Primitive(F32),
hir::TyFloat(ast::FloatTy::F64) => return Primitive(F64),
},
Def::SelfTy(..) if path.segments.len() == 1 => {
return Generic(special_idents::type_self.name.to_string());

View File

@ -10,7 +10,6 @@
// The Rust abstract syntax tree.
pub use self::FloatTy::*;
pub use self::ForeignItem_::*;
pub use self::IntTy::*;
pub use self::Item_::*;
@ -1509,8 +1508,8 @@ impl fmt::Display for UintTy {
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy)]
pub enum FloatTy {
TyF32,
TyF64,
F32,
F64,
}
impl fmt::Debug for FloatTy {
@ -1528,15 +1527,15 @@ impl fmt::Display for FloatTy {
impl FloatTy {
pub fn ty_to_string(&self) -> &'static str {
match *self {
TyF32 => "f32",
TyF64 => "f64",
FloatTy::F32 => "f32",
FloatTy::F64 => "f64",
}
}
pub fn bit_width(&self) -> usize {
match *self {
TyF32 => 32,
TyF64 => 64,
FloatTy::F32 => 32,
FloatTy::F64 => 64,
}
}
}

View File

@ -452,8 +452,8 @@ fn filtered_float_lit(data: token::InternedString, suffix: Option<&str>,
sd: &Handler, sp: Span) -> ast::Lit_ {
debug!("filtered_float_lit: {}, {:?}", data, suffix);
match suffix.as_ref().map(|s| &**s) {
Some("f32") => ast::LitFloat(data, ast::TyF32),
Some("f64") => ast::LitFloat(data, ast::TyF64),
Some("f32") => ast::LitFloat(data, ast::FloatTy::F32),
Some("f64") => ast::LitFloat(data, ast::FloatTy::F64),
Some(suf) => {
if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) {
// if it looks like a width, lets try to be helpful.