pub use self::InferRegion::*;
pub use self::ImplOrTraitItemId::*;
pub use self::UnboxedClosureKind::*;
-pub use self::TraitStore::*;
pub use self::ast_ty_to_ty_cache_entry::*;
pub use self::Variance::*;
pub use self::AutoAdjustment::*;
use middle::ty_fold::{self, TypeFoldable, TypeFolder};
use middle::ty_walk::TypeWalker;
use util::ppaux::{note_and_explain_region, bound_region_ptr_to_string};
-use util::ppaux::{trait_store_to_string, ty_to_string};
+use util::ppaux::ty_to_string;
use util::ppaux::{Repr, UserString};
use util::common::{memoized, ErrorReported};
use util::nodemap::{NodeMap, NodeSet, DefIdMap, DefIdSet};
pub mutbl: ast::Mutability,
}
-#[derive(Clone, Copy, PartialEq, Eq, Hash, RustcEncodable, RustcDecodable, Show)]
-pub enum TraitStore {
- /// Box<Trait>
- UniqTraitStore,
- /// &Trait and &mut Trait
- RegionTraitStore(Region, ast::Mutability),
-}
-
#[derive(Clone, Copy, Show)]
pub struct field_ty {
pub name: Name,
region_depth: u32,
}
-impl fmt::Show for TypeFlags {
+impl fmt::Debug for TypeFlags {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.bits)
}
#[derive(Clone, PartialEq, Eq, Hash, Show)]
pub struct ClosureTy<'tcx> {
pub unsafety: ast::Unsafety,
- pub onceness: ast::Onceness,
- pub store: TraitStore,
- pub bounds: ExistentialBounds<'tcx>,
- pub sig: PolyFnSig<'tcx>,
pub abi: abi::Abi,
+ pub sig: PolyFnSig<'tcx>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, Show)]
terr_onceness_mismatch(expected_found<Onceness>),
terr_abi_mismatch(expected_found<abi::Abi>),
terr_mutability,
- terr_sigil_mismatch(expected_found<TraitStore>),
terr_box_mutability,
terr_ptr_mutability,
terr_ref_mutability,
terr_regions_no_overlap(Region, Region),
terr_regions_insufficiently_polymorphic(BoundRegion, Region),
terr_regions_overly_polymorphic(BoundRegion, Region),
- terr_trait_stores_differ(terr_vstore_kind, expected_found<TraitStore>),
terr_sorts(expected_found<Ty<'tcx>>),
terr_integer_as_char,
terr_int_mismatch(expected_found<IntVarValue>),
}
}
-impl fmt::Show for TyVid {
+impl fmt::Debug for TyVid {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result{
write!(f, "_#{}t", self.index)
}
}
-impl fmt::Show for IntVid {
+impl fmt::Debug for IntVid {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "_#{}i", self.index)
}
}
-impl fmt::Show for FloatVid {
+impl fmt::Debug for FloatVid {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "_#{}f", self.index)
}
}
-impl fmt::Show for RegionVid {
+impl fmt::Debug for RegionVid {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "'_#{}r", self.index)
}
}
-impl<'tcx> fmt::Show for FnSig<'tcx> {
+impl<'tcx> fmt::Debug for FnSig<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "({:?}; variadic: {})->{:?}", self.inputs, self.variadic, self.output)
}
}
-impl fmt::Show for InferTy {
+impl fmt::Debug for InferTy {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
TyVar(ref v) => v.fmt(f),
}
}
-impl fmt::Show for IntVarValue {
+impl fmt::Debug for IntVarValue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match *self {
IntType(ref v) => v.fmt(f),
}
}
-impl fmt::Show for TypeContents {
+impl fmt::Debug for TypeContents {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TypeContents({:b})", self.bits)
}
ty_fn_sig(fty).inputs()
}
-pub fn ty_closure_store(fty: Ty) -> TraitStore {
- match fty.sty {
- ty_unboxed_closure(..) => {
- // Close enough for the purposes of all the callers of this
- // function (which is soon to be deprecated anyhow).
- UniqTraitStore
- }
- ref s => {
- panic!("ty_closure_store() called on non-closure type: {:?}", s)
- }
- }
-}
-
pub fn ty_fn_ret<'tcx>(fty: Ty<'tcx>) -> Binder<FnOutput<'tcx>> {
match fty.sty {
ty_bare_fn(_, ref f) => f.sig.output(),
/// afterwards to present additional details, particularly when it comes to lifetime-related
/// errors.
pub fn type_err_to_str<'tcx>(cx: &ctxt<'tcx>, err: &type_err<'tcx>) -> String {
- fn tstore_to_closure(s: &TraitStore) -> String {
- match s {
- &UniqTraitStore => "proc".to_string(),
- &RegionTraitStore(..) => "closure".to_string()
- }
- }
-
match *err {
terr_cyclic_ty => "cyclic type of infinite size".to_string(),
terr_mismatch => "types differ".to_string(),
values.expected,
values.found)
}
- terr_sigil_mismatch(values) => {
- format!("expected {}, found {}",
- tstore_to_closure(&values.expected),
- tstore_to_closure(&values.found))
- }
terr_mutability => "values differ in mutability".to_string(),
terr_box_mutability => {
"boxed values differ in mutability".to_string()
found bound lifetime parameter {}",
bound_region_ptr_to_string(cx, br))
}
- terr_trait_stores_differ(_, ref values) => {
- format!("trait storage differs: expected `{}`, found `{}`",
- trait_store_to_string(cx, (*values).expected),
- trait_store_to_string(cx, (*values).found))
- }
terr_sorts(values) => {
// A naive approach to making sure that we're not reporting silly errors such as:
// (expected closure, found closure).
impl<'tcx> Repr<'tcx> for ClosureTy<'tcx> {
fn repr(&self, tcx: &ctxt<'tcx>) -> String {
- format!("ClosureTy({},{},{:?},{},{},{})",
+ format!("ClosureTy({},{},{})",
self.unsafety,
- self.onceness,
- self.store,
- self.bounds.repr(tcx),
self.sig.repr(tcx),
self.abi)
}
self.free_substs.repr(tcx),
self.implicit_region_bound.repr(tcx),
self.caller_bounds.repr(tcx))
- }
}
+}