let inputs = relate_arg_vecs(relation,
&a.inputs,
&b.inputs)?;
+ let output = relation.relate(&a.output, &b.output)?;
- let output = match (a.output, b.output) {
- (ty::FnConverging(a_ty), ty::FnConverging(b_ty)) =>
- Ok(ty::FnConverging(relation.relate(&a_ty, &b_ty)?)),
- (ty::FnDiverging, ty::FnDiverging) =>
- Ok(ty::FnDiverging),
- (a, b) =>
- Err(TypeError::ConvergenceMismatch(
- expected_found(relation, &(a != ty::FnDiverging), &(b != ty::FnDiverging)))),
- }?;
-
- return Ok(ty::FnSig {inputs: inputs,
- output: output,
- variadic: a.variadic});
+ Ok(ty::FnSig {inputs: inputs,
+ output: output,
+ variadic: a.variadic})
}
}
Ok(tcx.types.err)
}
+ (&ty::TyNever, _) |
(&ty::TyChar, _) |
(&ty::TyBool, _) |
(&ty::TyInt(_), _) |
Ok(tcx.mk_projection(projection_ty.trait_ref, projection_ty.item_name))
}
+ (&ty::TyAnon(a_def_id, a_substs), &ty::TyAnon(b_def_id, b_substs))
+ if a_def_id == b_def_id =>
+ {
+ let substs = relate_substs(relation, None, a_substs, b_substs)?;
+ Ok(tcx.mk_anon(a_def_id, substs))
+ }
+
_ =>
{
Err(TypeError::Sorts(expected_found(relation, &a, &b)))