use rustc::ty::{self, AdtKind, Ty};
use rustc_hir as hir;
use rustc_hir::def::{CtorKind, CtorOf, DefKind, Res};
-use rustc_hir::def_id::LocalDefId;
use rustc_index::vec::Idx;
use rustc_span::Span;
// a tuple-struct or tuple-variant. This has the type of a
// `Fn` but with the user-given substitutions.
Res::Def(DefKind::Fn, _)
- | Res::Def(DefKind::Method, _)
+ | Res::Def(DefKind::AssocFn, _)
| Res::Def(DefKind::Ctor(_, CtorKind::Fn), _)
| Res::Def(DefKind::Const, _)
| Res::Def(DefKind::AssocConst, _) => {
match res {
// A regular function, constructor function or a constant.
Res::Def(DefKind::Fn, _)
- | Res::Def(DefKind::Method, _)
+ | Res::Def(DefKind::AssocFn, _)
| Res::Def(DefKind::Ctor(_, CtorKind::Fn), _)
| Res::SelfCtor(..) => {
let user_ty = user_substs_applied_to_res(cx, expr.hir_id, res);
let closure_def_id = cx.body_owner;
let upvar_id = ty::UpvarId {
var_path: ty::UpvarPath { hir_id: var_hir_id },
- closure_expr_id: LocalDefId::from_def_id(closure_def_id),
+ closure_expr_id: closure_def_id.expect_local(),
};
let var_ty = cx.tables().node_type(var_hir_id);
) -> ExprRef<'tcx> {
let upvar_id = ty::UpvarId {
var_path: ty::UpvarPath { hir_id: var_hir_id },
- closure_expr_id: cx.tcx.hir().local_def_id(closure_expr.hir_id).to_local(),
+ closure_expr_id: cx.tcx.hir().local_def_id(closure_expr.hir_id).expect_local(),
};
let upvar_capture = cx.tables().upvar_capture(upvar_id);
let temp_lifetime = cx.region_scope_tree.temporary_scope(closure_expr.hir_id.local_id);