| use std::fmt; |
| |
| use rustc_middle::ty; |
| |
| use crate::traits; |
| use crate::traits::project::Normalized; |
| |
| // Structural impls for the structs in `traits`. |
| |
| impl<'tcx, T: fmt::Debug> fmt::Debug for Normalized<'tcx, T> { |
| fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| write!(f, "Normalized({:?}, {:?})", self.value, self.obligations) |
| } |
| } |
| |
| impl<'tcx, O: fmt::Debug> fmt::Debug for traits::Obligation<'tcx, O> { |
| fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| if ty::tls::with(|tcx| tcx.sess.verbose_internals()) { |
| write!( |
| f, |
| "Obligation(predicate={:?}, cause={:?}, param_env={:?}, depth={})", |
| self.predicate, self.cause, self.param_env, self.recursion_depth |
| ) |
| } else { |
| write!(f, "Obligation(predicate={:?}, depth={})", self.predicate, self.recursion_depth) |
| } |
| } |
| } |
| |
| impl<'tcx> fmt::Debug for traits::MismatchedProjectionTypes<'tcx> { |
| fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| write!(f, "MismatchedProjectionTypes({:?})", self.err) |
| } |
| } |