Skip to content

Commit 75d61f7

Browse files
committed
kill the closure_kind query
1 parent 3544d88 commit 75d61f7

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
@@ -762,7 +762,6 @@ pub fn force_from_dep_node<'a, 'gcx, 'lcx>(tcx: TyCtxt<'a, 'gcx, 'lcx>,
762762
DepKind::IsAutoImpl => { force!(is_auto_impl, def_id!()); }
763763
DepKind::ImplTraitRef => { force!(impl_trait_ref, def_id!()); }
764764
DepKind::ImplPolarity => { force!(impl_polarity, def_id!()); }
765-
DepKind::ClosureKind => { force!(closure_kind, def_id!()); }
766765
DepKind::FnSignature => { force!(fn_sig, def_id!()); }
767766
DepKind::GenSignature => { force!(generator_sig, def_id!()); }
768767
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
@@ -1108,13 +1108,6 @@ impl<'a, 'tcx> CrateMetadata {
11081108
}
11091109
}
11101110

1111-
pub fn closure_kind(&self, closure_id: DefIndex) -> ty::ClosureKind {
1112-
match self.entry(closure_id).kind {
1113-
EntryKind::Closure(data) => data.decode(self).kind,
1114-
_ => bug!(),
1115-
}
1116-
}
1117-
11181111
pub fn fn_sig(&self,
11191112
id: DefIndex,
11201113
tcx: TyCtxt<'a, 'tcx, 'tcx>)

src/librustc_metadata/encoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,6 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
11871187
EntryKind::Generator(self.lazy(&data))
11881188
} else {
11891189
let data = ClosureData {
1190-
kind: tcx.closure_kind(def_id),
11911190
sig: self.lazy(&tcx.fn_sig(def_id)),
11921191
};
11931192
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
@@ -712,8 +712,8 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>,
712712
});
713713
let region = cx.tcx.mk_region(region);
714714

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

src/librustc_typeck/check/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,6 @@ pub fn provide(providers: &mut Providers) {
740740
typeck_item_bodies,
741741
typeck_tables_of,
742742
has_typeck_tables,
743-
closure_kind,
744743
generator_sig,
745744
adt_destructor,
746745
used_trait_imports,
@@ -756,14 +755,6 @@ fn generator_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
756755
tcx.typeck_tables_of(def_id).generator_sigs()[hir_id].map(|s| ty::Binder(s))
757756
}
758757

759-
fn closure_kind<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
760-
def_id: DefId)
761-
-> ty::ClosureKind {
762-
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
763-
let hir_id = tcx.hir.node_to_hir_id(node_id);
764-
tcx.typeck_tables_of(def_id).closure_kinds()[hir_id].0
765-
}
766-
767758
fn adt_destructor<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
768759
def_id: DefId)
769760
-> Option<ty::Destructor> {

0 commit comments

Comments
 (0)