]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/demand.rs
Auto merge of #30036 - mitaa:doc_id, r=alexcrichton
[rust.git] / src / librustc_typeck / check / demand.rs
index 392515926da0c9b71735ffd7423f62b9e92e8877..63dac49b384a7aa23d865bf4494ed2114363cd76 100644 (file)
 
 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.
@@ -32,10 +32,10 @@ pub fn suptype_with_fn<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
                                     ty_a: Ty<'tcx>,
                                     ty_b: Ty<'tcx>,
                                     handle_err: F) where
-    F: FnOnce(Span, Ty<'tcx>, Ty<'tcx>, &ty::type_err<'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) => {
@@ -46,7 +46,7 @@ pub fn suptype_with_fn<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
 
 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); }
     }
@@ -56,7 +56,7 @@ pub fn eqtype<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, sp: Span,
 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,