pub found: T,
}
+impl<T> ExpectedFound<T> {
+ pub fn new(a_is_expected: bool, a: T, b: T) -> Self {
+ if a_is_expected {
+ ExpectedFound { expected: a, found: b }
+ } else {
+ ExpectedFound { expected: b, found: a }
+ }
+ }
+}
+
// Data structures used in type unification
#[derive(Clone, Debug, TypeFoldable)]
pub enum TypeError<'tcx> {
ty::FnPtr(_) => "fn pointer".into(),
ty::Dynamic(ref inner, ..) => {
if let Some(principal) = inner.principal() {
- format!("trait `{}`", tcx.def_path_str(principal.def_id())).into()
+ format!("trait object `dyn {}`", tcx.def_path_str(principal.def_id())).into()
} else {
- "trait".into()
+ "trait object".into()
}
}
ty::Closure(..) => "closure".into(),