use middle::ty::TyClosure;
use middle::ty::{TyBox, TyTrait, TyInt, TyUint, TyInfer};
use middle::ty::{self, TypeAndMut, Ty, HasTypeFlags};
-use middle::ty_fold::{self, TypeFoldable};
+use middle::ty::fold::TypeFoldable;
use std::fmt;
use syntax::abi;
}
};
- let new_value = ty_fold::replace_late_bound_regions(tcx, &value, |br| {
+ let new_value = tcx.replace_late_bound_regions(&value, |br| {
let _ = start_or_continue(f, "for<", ", ");
ty::ReLateBound(ty::DebruijnIndex::new(1), match br {
ty::BrNamed(_, name) => {
struct TraitAndProjections<'tcx>(ty::TraitRef<'tcx>, Vec<ty::ProjectionPredicate<'tcx>>);
impl<'tcx> TypeFoldable<'tcx> for TraitAndProjections<'tcx> {
- fn fold_with<F:ty_fold::TypeFolder<'tcx>>(&self, folder: &mut F)
+ fn fold_with<F:ty::fold::TypeFolder<'tcx>>(&self, folder: &mut F)
-> TraitAndProjections<'tcx> {
TraitAndProjections(self.0.fold_with(folder), self.1.fold_with(folder))
}
}
}
+impl<'tcx> fmt::Debug for ty::adjustment::AutoAdjustment<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ ty::adjustment::AdjustReifyFnPointer => {
+ write!(f, "AdjustReifyFnPointer")
+ }
+ ty::adjustment::AdjustUnsafeFnPointer => {
+ write!(f, "AdjustUnsafeFnPointer")
+ }
+ ty::adjustment::AdjustDerefRef(ref data) => {
+ write!(f, "{:?}", data)
+ }
+ }
+ }
+}
+
+impl<'tcx> fmt::Debug for ty::adjustment::AutoDerefRef<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "AutoDerefRef({}, unsize={:?}, {:?})",
+ self.autoderefs, self.unsize, self.autoref)
+ }
+}
+
+impl<'tcx> fmt::Debug for ty::TraitTy<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "TraitTy({:?},{:?})",
+ self.principal,
+ self.bounds)
+ }
+}
+
+impl<'tcx> fmt::Debug for ty::Predicate<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ ty::Predicate::Trait(ref a) => write!(f, "{:?}", a),
+ ty::Predicate::Equate(ref pair) => write!(f, "{:?}", pair),
+ ty::Predicate::RegionOutlives(ref pair) => write!(f, "{:?}", pair),
+ ty::Predicate::TypeOutlives(ref pair) => write!(f, "{:?}", pair),
+ ty::Predicate::Projection(ref pair) => write!(f, "{:?}", pair),
+ ty::Predicate::WellFormed(ty) => write!(f, "WF({:?})", ty),
+ ty::Predicate::ObjectSafe(trait_def_id) => {
+ write!(f, "ObjectSafe({:?})", trait_def_id)
+ }
+ }
+ }
+}
+
impl fmt::Display for ty::BoundRegion {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if verbose() {
}
}
+impl<'tcx> fmt::Debug for ty::ClosureTy<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "ClosureTy({},{:?},{})",
+ self.unsafety,
+ self.sig,
+ self.abi)
+ }
+}
+
+impl<'tcx> fmt::Debug for ty::ClosureUpvar<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "ClosureUpvar({:?},{:?})",
+ self.def,
+ self.ty)
+ }
+}
+
+impl<'a, 'tcx> fmt::Debug for ty::ParameterEnvironment<'a, 'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "ParameterEnvironment(\
+ free_substs={:?}, \
+ implicit_region_bound={:?}, \
+ caller_bounds={:?})",
+ self.free_substs,
+ self.implicit_region_bound,
+ self.caller_bounds)
+ }
+}
+
+impl<'tcx> fmt::Debug for ty::ObjectLifetimeDefault {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ ty::ObjectLifetimeDefault::Ambiguous => write!(f, "Ambiguous"),
+ ty::ObjectLifetimeDefault::BaseDefault => write!(f, "BaseDefault"),
+ ty::ObjectLifetimeDefault::Specific(ref r) => write!(f, "{:?}", r),
+ }
+ }
+}
+
impl fmt::Display for ty::Region {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if verbose() {
}
}
+impl fmt::Debug for ty::Variance {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ f.write_str(match *self {
+ ty::Covariant => "+",
+ ty::Contravariant => "-",
+ ty::Invariant => "o",
+ ty::Bivariant => "*",
+ })
+ }
+}
+
impl fmt::Debug for ty::ItemVariances {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "ItemVariances(types={:?}, regions={:?})",
}
}
+impl fmt::Debug for ty::TyVid {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "_#{}t", self.index)
+ }
+}
+
+impl fmt::Debug for ty::IntVid {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "_#{}i", self.index)
+ }
+}
+
+impl fmt::Debug for ty::FloatVid {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "_#{}f", self.index)
+ }
+}
+
+impl fmt::Debug for ty::RegionVid {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "'_#{}r", self.index)
+ }
+}
+
+impl<'tcx> fmt::Debug for ty::FnSig<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "({:?}; variadic: {})->{:?}", self.inputs, self.variadic, self.output)
+ }
+}
+
+impl fmt::Debug for ty::InferTy {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ ty::TyVar(ref v) => v.fmt(f),
+ ty::IntVar(ref v) => v.fmt(f),
+ ty::FloatVar(ref v) => v.fmt(f),
+ ty::FreshTy(v) => write!(f, "FreshTy({:?})", v),
+ ty::FreshIntTy(v) => write!(f, "FreshIntTy({:?})", v),
+ ty::FreshFloatTy(v) => write!(f, "FreshFloatTy({:?})", v)
+ }
+ }
+}
+
+impl fmt::Debug for ty::IntVarValue {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ ty::IntType(ref v) => v.fmt(f),
+ ty::UintType(ref v) => v.fmt(f),
+ }
+ }
+}
+
// The generic impl doesn't work yet because projections are not
// normalized under HRTB.
/*impl<T> fmt::Display for ty::Binder<T>