}
if !verbose {
- if generics.types.last().map_or(false, |def| def.default.is_some()) {
+ if generics.types.last().map_or(false, |def| def.has_default) {
if let Some(substs) = tcx.lift(&substs) {
let tps = substs.types().rev().skip(child_types);
for (def, actual) in generics.types.iter().rev().zip(tps) {
- if def.default.subst(tcx, substs) != Some(actual) {
+ if !def.has_default {
+ break;
+ }
+ if tcx.item_type(def.def_id).subst(tcx, substs) != actual {
break;
}
num_supplied_defaults += 1;
let new_value = tcx.replace_late_bound_regions(&value, |br| {
let _ = start_or_continue(f, "for<", ", ");
let br = match br {
- ty::BrNamed(_, name, _) => {
+ ty::BrNamed(_, name) => {
let _ = write!(f, "{}", name);
br
}
let name = Symbol::intern("'r");
let _ = write!(f, "{}", name);
ty::BrNamed(tcx.hir.local_def_id(CRATE_NODE_ID),
- name,
- ty::Issue32330::WontChange)
+ name)
}
};
tcx.mk_region(ty::ReLateBound(ty::DebruijnIndex::new(1), br))
}
}
-impl<'tcx> fmt::Debug for ty::TypeParameterDef<'tcx> {
+impl fmt::Debug for ty::TypeParameterDef {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TypeParameterDef({}, {:?}, {})",
self.name,
match *self {
ty::Predicate::Trait(ref a) => write!(f, "{:?}", a),
ty::Predicate::Equate(ref pair) => write!(f, "{:?}", pair),
+ ty::Predicate::Subtype(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),
}
match *self {
- BrNamed(_, name, _) => write!(f, "{}", name),
+ BrNamed(_, name) => write!(f, "{}", name),
BrAnon(_) | BrFresh(_) | BrEnv => Ok(())
}
}
match *self {
BrAnon(n) => write!(f, "BrAnon({:?})", n),
BrFresh(n) => write!(f, "BrFresh({:?})", n),
- BrNamed(did, name, issue32330) => {
- write!(f, "BrNamed({:?}:{:?}, {:?}, {:?})",
- did.krate, did.index, name, issue32330)
+ BrNamed(did, name) => {
+ write!(f, "BrNamed({:?}:{:?}, {:?})",
+ did.krate, did.index, name)
}
BrEnv => "BrEnv".fmt(f),
}
}
}
-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({:?},{:?})",
impl<'tcx> fmt::Display for ty::FnSig<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ if self.unsafety == hir::Unsafety::Unsafe {
+ write!(f, "unsafe ")?;
+ }
+
+ if self.abi != Abi::Rust {
+ write!(f, "extern {} ", self.abi)?;
+ }
+
write!(f, "fn")?;
fn_sig(f, self.inputs(), self.variadic, self.output())
}
}
}
+impl<'tcx> fmt::Display for ty::Binder<ty::SubtypePredicate<'tcx>> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ ty::tls::with(|tcx| in_binder(f, tcx, self, tcx.lift(self)))
+ }
+}
+
impl<'tcx> fmt::Display for ty::Binder<ty::ProjectionPredicate<'tcx>> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
ty::tls::with(|tcx| in_binder(f, tcx, self, tcx.lift(self)))
write!(f, ")")
}
TyFnDef(def_id, substs, ref bare_fn) => {
- if bare_fn.unsafety == hir::Unsafety::Unsafe {
- write!(f, "unsafe ")?;
- }
-
- if bare_fn.abi != Abi::Rust {
- write!(f, "extern {} ", bare_fn.abi)?;
- }
-
- write!(f, "{} {{", bare_fn.sig.0)?;
+ write!(f, "{} {{", bare_fn.0)?;
parameterized(f, substs, def_id, &[])?;
write!(f, "}}")
}
TyFnPtr(ref bare_fn) => {
- if bare_fn.unsafety == hir::Unsafety::Unsafe {
- write!(f, "unsafe ")?;
- }
-
- if bare_fn.abi != Abi::Rust {
- write!(f, "extern {} ", bare_fn.abi)?;
- }
-
- write!(f, "{}", bare_fn.sig.0)
+ write!(f, "{}", bare_fn.0)
}
TyInfer(infer_ty) => write!(f, "{}", infer_ty),
TyError => write!(f, "[type error]"),
TyParam(ref param_ty) => write!(f, "{}", param_ty),
- TyAdt(def, substs) => {
- ty::tls::with(|tcx| {
- if def.did.is_local() &&
- !tcx.item_types.borrow().contains_key(&def.did) {
- write!(f, "{}<..>", tcx.item_path_str(def.did))
- } else {
- parameterized(f, substs, def.did, &[])
- }
- })
- }
+ TyAdt(def, substs) => parameterized(f, substs, def.did, &[]),
TyDynamic(data, r) => {
write!(f, "{}", data)?;
let r = r.to_string();
}
}
+impl<'tcx> fmt::Display for ty::SubtypePredicate<'tcx> {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ write!(f, "{} <: {}", self.a, self.b)
+ }
+}
+
impl<'tcx> fmt::Debug for ty::TraitPredicate<'tcx> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "TraitPredicate({:?})",
match *self {
ty::Predicate::Trait(ref data) => write!(f, "{}", data),
ty::Predicate::Equate(ref predicate) => write!(f, "{}", predicate),
+ ty::Predicate::Subtype(ref predicate) => write!(f, "{}", predicate),
ty::Predicate::RegionOutlives(ref predicate) => write!(f, "{}", predicate),
ty::Predicate::TypeOutlives(ref predicate) => write!(f, "{}", predicate),
ty::Predicate::Projection(ref predicate) => write!(f, "{}", predicate),