use check::{coercion, FnCtxt};
use middle::ty::{self, Ty};
-use middle::infer;
+use middle::infer::{self, TypeOrigin};
use std::result::Result::{Err, Ok};
-use syntax::ast;
use syntax::codemap::Span;
+use rustc_front::hir;
// Requires that the two types unify, and prints an error message if
// they don't.
ty_a: Ty<'tcx>,
ty_b: Ty<'tcx>,
handle_err: F) where
- F: FnOnce(Span, Ty<'tcx>, Ty<'tcx>, &ty::TypeError<'tcx>),
+ F: FnOnce(Span, Ty<'tcx>, Ty<'tcx>, &ty::error::TypeError<'tcx>),
{
// n.b.: order of actual, expected is reversed
- match infer::mk_subty(fcx.infcx(), b_is_expected, infer::Misc(sp),
+ match infer::mk_subty(fcx.infcx(), b_is_expected, TypeOrigin::Misc(sp),
ty_b, ty_a) {
Ok(()) => { /* ok */ }
Err(ref err) => {
pub fn eqtype<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, sp: Span,
expected: Ty<'tcx>, actual: Ty<'tcx>) {
- match infer::mk_eqty(fcx.infcx(), false, infer::Misc(sp), actual, expected) {
+ match infer::mk_eqty(fcx.infcx(), false, TypeOrigin::Misc(sp), actual, expected) {
Ok(()) => { /* ok */ }
Err(ref err) => { fcx.report_mismatched_types(sp, expected, actual, err); }
}
pub fn coerce<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>,
sp: Span,
expected: Ty<'tcx>,
- expr: &ast::Expr) {
+ expr: &hir::Expr) {
let expr_ty = fcx.expr_ty(expr);
debug!("demand::coerce(expected = {:?}, expr_ty = {:?})",
expected,