]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/check/closure.rs
Auto merge of #30036 - mitaa:doc_id, r=alexcrichton
[rust.git] / src / librustc_typeck / check / closure.rs
index a3714fead8e28caaa29980fa28a3921af7dae7d2..4f7a6395395461f4d444916b0934d5e5d3f4a42f 100644 (file)
 use super::{check_fn, Expectation, FnCtxt};
 
 use astconv;
-use middle::def_id::DefId;
 use middle::subst;
 use middle::ty::{self, ToPolyTraitRef, Ty};
 use std::cmp;
 use syntax::abi;
-use syntax::ast;
+use rustc_front::hir;
 
 pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
-                                   expr: &ast::Expr,
-                                   _capture: ast::CaptureClause,
-                                   decl: &'tcx ast::FnDecl,
-                                   body: &'tcx ast::Block,
+                                   expr: &hir::Expr,
+                                   _capture: hir::CaptureClause,
+                                   decl: &'tcx hir::FnDecl,
+                                   body: &'tcx hir::Block,
                                    expected: Expectation<'tcx>) {
     debug!("check_expr_closure(expr={:?},expected={:?})",
            expr,
@@ -41,19 +40,19 @@ pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
 }
 
 fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
-                          expr: &ast::Expr,
+                          expr: &hir::Expr,
                           opt_kind: Option<ty::ClosureKind>,
-                          decl: &'tcx ast::FnDecl,
-                          body: &'tcx ast::Block,
+                          decl: &'tcx hir::FnDecl,
+                          body: &'tcx hir::Block,
                           expected_sig: Option<ty::FnSig<'tcx>>) {
-    let expr_def_id = DefId::local(expr.id);
+    let expr_def_id = fcx.tcx().map.local_def_id(expr.id);
 
     debug!("check_closure opt_kind={:?} expected_sig={:?}",
            opt_kind,
            expected_sig);
 
     let mut fn_ty = astconv::ty_of_closure(fcx,
-                                           ast::Unsafety::Normal,
+                                           hir::Unsafety::Normal,
                                            decl,
                                            abi::RustCall,
                                            expected_sig);
@@ -79,7 +78,7 @@ fn check_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
         fcx.tcx().region_maps.item_extent(body.id), &fn_ty.sig);
 
     check_fn(fcx.ccx,
-             ast::Unsafety::Normal,
+             hir::Unsafety::Normal,
              expr.id,
              &fn_sig,
              decl,