use super::{check_fn, Expectation, FnCtxt};
use astconv;
-use middle::region;
use middle::subst;
use middle::ty::{self, ToPolyTraitRef, Ty};
use std::cmp;
use syntax::abi;
-use syntax::ast;
-use syntax::ast_util;
+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,
}
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 = ast_util::local_def(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);
fcx.write_ty(expr.id, closure_type);
let fn_sig = fcx.tcx().liberate_late_bound_regions(
- region::DestructionScopeData::new(body.id), &fn_ty.sig);
+ 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,