Skip to content

Commit eb26e30

Browse files
committed
kill the closure_kind query
1 parent 2dff9a4 commit eb26e30

File tree

9 files changed

+3
-28
lines changed

9 files changed

+3
-28
lines changed

src/librustc/dep_graph/dep_node.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ define_dep_nodes!( <'tcx>
498498
[] IsAutoImpl(DefId),
499499
[] ImplTraitRef(DefId),
500500
[] ImplPolarity(DefId),
501-
[] ClosureKind(DefId),
502501
[] FnSignature(DefId),
503502
[] GenSignature(DefId),
504503
[] CoerceUnsizedInfo(DefId),

src/librustc/ty/maps/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,6 @@ define_maps! { <'tcx>
167167
/// for trans. This is also the only query that can fetch non-local MIR, at present.
168168
[] fn optimized_mir: MirOptimized(DefId) -> &'tcx mir::Mir<'tcx>,
169169

170-
/// Type of each closure. The def ID is the ID of the
171-
/// expression defining the closure.
172-
[] fn closure_kind: ClosureKind(DefId) -> ty::ClosureKind,
173-
174170
/// The result of unsafety-checking this def-id.
175171
[] fn unsafety_check_result: UnsafetyCheckResult(DefId) -> mir::UnsafetyCheckResult,
176172

src/librustc/ty/maps/plumbing.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,6 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
782782
DepKind::IsAutoImpl => { force!(is_auto_impl, def_id!()); }
783783
DepKind::ImplTraitRef => { force!(impl_trait_ref, def_id!()); }
784784
DepKind::ImplPolarity => { force!(impl_polarity, def_id!()); }
785-
DepKind::ClosureKind => { force!(closure_kind, def_id!()); }
786785
DepKind::FnSignature => { force!(fn_sig, def_id!()); }
787786
DepKind::GenSignature => { force!(generator_sig, def_id!()); }
788787
DepKind::CoerceUnsizedInfo => { force!(coerce_unsized_info, def_id!()); }

src/librustc_metadata/cstore_impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ provide! { <'tcx> tcx, def_id, other, cdata,
141141
(cdata.mir_const_qualif(def_id.index), Rc::new(IdxSetBuf::new_empty(0)))
142142
}
143143
typeck_tables_of => { cdata.item_body_tables(def_id.index, tcx) }
144-
closure_kind => { cdata.closure_kind(def_id.index) }
145144
fn_sig => { cdata.fn_sig(def_id.index, tcx) }
146145
inherent_impls => { Rc::new(cdata.get_inherent_implementations_for_type(def_id.index)) }
147146
is_const_fn => { cdata.is_const_fn(def_id.index) }

src/librustc_metadata/decoder.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,13 +1020,6 @@ impl<'a, 'tcx> CrateMetadata {
10201020
}
10211021
}
10221022

1023-
pub fn closure_kind(&self, closure_id: DefIndex) -> ty::ClosureKind {
1024-
match self.entry(closure_id).kind {
1025-
EntryKind::Closure(data) => data.decode(self).kind,
1026-
_ => bug!(),
1027-
}
1028-
}
1029-
10301023
pub fn fn_sig(&self,
10311024
id: DefIndex,
10321025
tcx: TyCtxt<'a, 'tcx, 'tcx>)

src/librustc_metadata/encoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1214,7 +1214,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
12141214
EntryKind::Generator(self.lazy(&data))
12151215
} else {
12161216
let data = ClosureData {
1217-
kind: tcx.closure_kind(def_id),
12181217
sig: self.lazy(&tcx.fn_sig(def_id)),
12191218
};
12201219
EntryKind::Closure(self.lazy(&data))

src/librustc_metadata/schema.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,10 +512,9 @@ impl_stable_hash_for!(struct MethodData<'tcx> { fn_data, container, has_self });
512512

513513
#[derive(RustcEncodable, RustcDecodable)]
514514
pub struct ClosureData<'tcx> {
515-
pub kind: ty::ClosureKind,
516515
pub sig: Lazy<ty::PolyFnSig<'tcx>>,
517516
}
518-
impl_stable_hash_for!(struct ClosureData<'tcx> { kind, sig });
517+
impl_stable_hash_for!(struct ClosureData<'tcx> { sig });
519518

520519
#[derive(RustcEncodable, RustcDecodable)]
521520
pub struct GeneratorData<'tcx> {

src/librustc_mir/hair/cx/expr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,8 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
713713
});
714714
let region = cx.tcx.mk_region(region);
715715

716-
let self_expr = if let ty::TyClosure(..) = closure_ty.sty {
717-
match cx.tcx.closure_kind(closure_def_id) {
716+
let self_expr = if let ty::TyClosure(_, closure_substs) = closure_ty.sty {
717+
match cx.infcx.closure_kind(closure_def_id, closure_substs).unwrap() {
718718
ty::ClosureKind::Fn => {
719719
let ref_closure_ty = cx.tcx.mk_ref(region,
720720
ty::TypeAndMut {

src/librustc_typeck/check/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,6 @@ pub fn provide(providers: &mut Providers) {
722722
typeck_item_bodies,
723723
typeck_tables_of,
724724
has_typeck_tables,
725-
closure_kind,
726725
generator_sig,
727726
adt_destructor,
728727
used_trait_imports,
@@ -738,14 +737,6 @@ fn generator_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
738737
tcx.typeck_tables_of(def_id).generator_sigs()[hir_id].map(|s| ty::Binder(s))
739738
}
740739

741-
fn closure_kind<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
742-
def_id: DefId)
743-
-> ty::ClosureKind {
744-
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
745-
let hir_id = tcx.hir.node_to_hir_id(node_id);
746-
tcx.typeck_tables_of(def_id).closure_kinds()[hir_id].0
747-
}
748-
749740
fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
750741
def_id: DefId)
751742
-> Option<ty::Destructor> {

0 commit comments

Comments
 (0)