kill the closure_kind query
This commit is contained in:
parent
2dff9a49e5
commit
eb26e30b91
9 changed files with 3 additions and 28 deletions
|
|
@ -498,7 +498,6 @@ define_dep_nodes!( <'tcx>
|
|||
[] IsAutoImpl(DefId),
|
||||
[] ImplTraitRef(DefId),
|
||||
[] ImplPolarity(DefId),
|
||||
[] ClosureKind(DefId),
|
||||
[] FnSignature(DefId),
|
||||
[] GenSignature(DefId),
|
||||
[] CoerceUnsizedInfo(DefId),
|
||||
|
|
|
|||
|
|
@ -167,10 +167,6 @@ define_maps! { <'tcx>
|
|||
/// for trans. This is also the only query that can fetch non-local MIR, at present.
|
||||
[] fn optimized_mir: MirOptimized(DefId) -> &'tcx mir::Mir<'tcx>,
|
||||
|
||||
/// Type of each closure. The def ID is the ID of the
|
||||
/// expression defining the closure.
|
||||
[] fn closure_kind: ClosureKind(DefId) -> ty::ClosureKind,
|
||||
|
||||
/// The result of unsafety-checking this def-id.
|
||||
[] fn unsafety_check_result: UnsafetyCheckResult(DefId) -> mir::UnsafetyCheckResult,
|
||||
|
||||
|
|
|
|||
|
|
@ -782,7 +782,6 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
|
|||
DepKind::IsAutoImpl => { force!(is_auto_impl, def_id!()); }
|
||||
DepKind::ImplTraitRef => { force!(impl_trait_ref, def_id!()); }
|
||||
DepKind::ImplPolarity => { force!(impl_polarity, def_id!()); }
|
||||
DepKind::ClosureKind => { force!(closure_kind, def_id!()); }
|
||||
DepKind::FnSignature => { force!(fn_sig, def_id!()); }
|
||||
DepKind::GenSignature => { force!(generator_sig, def_id!()); }
|
||||
DepKind::CoerceUnsizedInfo => { force!(coerce_unsized_info, def_id!()); }
|
||||
|
|
|
|||
|
|
@ -141,7 +141,6 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
(cdata.mir_const_qualif(def_id.index), Rc::new(IdxSetBuf::new_empty(0)))
|
||||
}
|
||||
typeck_tables_of => { cdata.item_body_tables(def_id.index, tcx) }
|
||||
closure_kind => { cdata.closure_kind(def_id.index) }
|
||||
fn_sig => { cdata.fn_sig(def_id.index, tcx) }
|
||||
inherent_impls => { Rc::new(cdata.get_inherent_implementations_for_type(def_id.index)) }
|
||||
is_const_fn => { cdata.is_const_fn(def_id.index) }
|
||||
|
|
|
|||
|
|
@ -1020,13 +1020,6 @@ impl<'a, 'tcx> CrateMetadata {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn closure_kind(&self, closure_id: DefIndex) -> ty::ClosureKind {
|
||||
match self.entry(closure_id).kind {
|
||||
EntryKind::Closure(data) => data.decode(self).kind,
|
||||
_ => bug!(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn fn_sig(&self,
|
||||
id: DefIndex,
|
||||
tcx: TyCtxt<'a, 'tcx, 'tcx>)
|
||||
|
|
|
|||
|
|
@ -1214,7 +1214,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
|
|||
EntryKind::Generator(self.lazy(&data))
|
||||
} else {
|
||||
let data = ClosureData {
|
||||
kind: tcx.closure_kind(def_id),
|
||||
sig: self.lazy(&tcx.fn_sig(def_id)),
|
||||
};
|
||||
EntryKind::Closure(self.lazy(&data))
|
||||
|
|
|
|||
|
|
@ -512,10 +512,9 @@ impl_stable_hash_for!(struct MethodData<'tcx> { fn_data, container, has_self });
|
|||
|
||||
#[derive(RustcEncodable, RustcDecodable)]
|
||||
pub struct ClosureData<'tcx> {
|
||||
pub kind: ty::ClosureKind,
|
||||
pub sig: Lazy<ty::PolyFnSig<'tcx>>,
|
||||
}
|
||||
impl_stable_hash_for!(struct ClosureData<'tcx> { kind, sig });
|
||||
impl_stable_hash_for!(struct ClosureData<'tcx> { sig });
|
||||
|
||||
#[derive(RustcEncodable, RustcDecodable)]
|
||||
pub struct GeneratorData<'tcx> {
|
||||
|
|
|
|||
|
|
@ -713,8 +713,8 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
|
|||
});
|
||||
let region = cx.tcx.mk_region(region);
|
||||
|
||||
let self_expr = if let ty::TyClosure(..) = closure_ty.sty {
|
||||
match cx.tcx.closure_kind(closure_def_id) {
|
||||
let self_expr = if let ty::TyClosure(_, closure_substs) = closure_ty.sty {
|
||||
match cx.infcx.closure_kind(closure_def_id, closure_substs).unwrap() {
|
||||
ty::ClosureKind::Fn => {
|
||||
let ref_closure_ty = cx.tcx.mk_ref(region,
|
||||
ty::TypeAndMut {
|
||||
|
|
|
|||
|
|
@ -722,7 +722,6 @@ pub fn provide(providers: &mut Providers) {
|
|||
typeck_item_bodies,
|
||||
typeck_tables_of,
|
||||
has_typeck_tables,
|
||||
closure_kind,
|
||||
generator_sig,
|
||||
adt_destructor,
|
||||
used_trait_imports,
|
||||
|
|
@ -738,14 +737,6 @@ fn generator_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
tcx.typeck_tables_of(def_id).generator_sigs()[hir_id].map(|s| ty::Binder(s))
|
||||
}
|
||||
|
||||
fn closure_kind<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> ty::ClosureKind {
|
||||
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
|
||||
let hir_id = tcx.hir.node_to_hir_id(node_id);
|
||||
tcx.typeck_tables_of(def_id).closure_kinds()[hir_id].0
|
||||
}
|
||||
|
||||
fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||
def_id: DefId)
|
||||
-> Option<ty::Destructor> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue