Skip to content

Commit 72315cb

Browse files
committed
rustc: rename closure_type to fn_sig.
1 parent c94a9ac commit 72315cb

File tree

14 files changed

+24
-25
lines changed

14 files changed

+24
-25
lines changed

src/librustc/infer/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
15461546
Some(self.tcx.closure_kind(def_id))
15471547
}
15481548

1549-
pub fn closure_type(&self, def_id: DefId) -> ty::PolyFnSig<'tcx> {
1549+
pub fn fn_sig(&self, def_id: DefId) -> ty::PolyFnSig<'tcx> {
15501550
if let InferTables::InProgress(tables) = self.tables {
15511551
if let Some(id) = self.tcx.hir.as_local_node_id(def_id) {
15521552
if let Some(&ty) = tables.borrow().closure_tys.get(&id) {
@@ -1555,7 +1555,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
15551555
}
15561556
}
15571557

1558-
self.tcx.closure_type(def_id)
1558+
self.tcx.fn_sig(def_id)
15591559
}
15601560
}
15611561

src/librustc/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,7 +1149,7 @@ fn confirm_closure_candidate<'cx, 'gcx, 'tcx>(
11491149
-> Progress<'tcx>
11501150
{
11511151
let closure_typer = selcx.closure_typer();
1152-
let closure_type = closure_typer.closure_type(vtable.closure_def_id)
1152+
let closure_type = closure_typer.fn_sig(vtable.closure_def_id)
11531153
.subst(selcx.tcx(), vtable.substs.substs);
11541154
let Normalized {
11551155
value: closure_type,

src/librustc/traits/select.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2797,7 +2797,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
27972797
substs: ty::ClosureSubsts<'tcx>)
27982798
-> ty::PolyTraitRef<'tcx>
27992799
{
2800-
let closure_type = self.infcx.closure_type(closure_def_id)
2800+
let closure_type = self.infcx.fn_sig(closure_def_id)
28012801
.subst(self.tcx(), substs.substs);
28022802
let ty::Binder((trait_ref, _)) =
28032803
self.tcx().closure_trait_ref_and_return_type(obligation.predicate.def_id(),

src/librustc/ty/maps.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -845,9 +845,8 @@ define_maps! { <'tcx>
845845
/// expression defining the closure.
846846
[] closure_kind: ItemSignature(DefId) -> ty::ClosureKind,
847847

848-
/// Records the type of each closure. The def ID is the ID of the
849-
/// expression defining the closure.
850-
[] closure_type: ItemSignature(DefId) -> ty::PolyFnSig<'tcx>,
848+
/// Records the signature of functions and closures.
849+
[] fn_sig: ItemSignature(DefId) -> ty::PolyFnSig<'tcx>,
851850

852851
/// Caches CoerceUnsized kinds for impls on custom types.
853852
[] coerce_unsized_info: ItemSignature(DefId)

src/librustc_metadata/cstore_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ provide! { <'tcx> tcx, def_id, cdata
103103
mir_const_qualif => { cdata.mir_const_qualif(def_id.index) }
104104
typeck_tables_of => { cdata.item_body_tables(def_id.index, tcx) }
105105
closure_kind => { cdata.closure_kind(def_id.index) }
106-
closure_type => { cdata.closure_ty(def_id.index, tcx) }
106+
fn_sig => { cdata.fn_sig(def_id.index, tcx) }
107107
inherent_impls => { Rc::new(cdata.get_inherent_implementations_for_type(def_id.index)) }
108108
is_foreign_item => { cdata.is_foreign_item(def_id.index) }
109109
is_default_impl => { cdata.is_default_impl(def_id.index) }

src/librustc_metadata/decoder.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,12 +1086,12 @@ impl<'a, 'tcx> CrateMetadata {
10861086
}
10871087
}
10881088

1089-
pub fn closure_ty(&self,
1090-
closure_id: DefIndex,
1091-
tcx: TyCtxt<'a, 'tcx, 'tcx>)
1092-
-> ty::PolyFnSig<'tcx> {
1089+
pub fn fn_sig(&self,
1090+
closure_id: DefIndex,
1091+
tcx: TyCtxt<'a, 'tcx, 'tcx>)
1092+
-> ty::PolyFnSig<'tcx> {
10931093
match self.entry(closure_id).kind {
1094-
EntryKind::Closure(data) => data.decode(self).ty.decode((self, tcx)),
1094+
EntryKind::Closure(data) => data.decode(self).sig.decode((self, tcx)),
10951095
_ => bug!(),
10961096
}
10971097
}

src/librustc_metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> {
11671167

11681168
let data = ClosureData {
11691169
kind: tcx.closure_kind(def_id),
1170-
ty: self.lazy(&tcx.closure_type(def_id)),
1170+
sig: self.lazy(&tcx.fn_sig(def_id)),
11711171
};
11721172

11731173
Entry {

src/librustc_metadata/schema.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,6 @@ impl_stable_hash_for!(struct MethodData { fn_data, container, has_self });
553553
#[derive(RustcEncodable, RustcDecodable)]
554554
pub struct ClosureData<'tcx> {
555555
pub kind: ty::ClosureKind,
556-
pub ty: Lazy<ty::PolyFnSig<'tcx>>,
556+
pub sig: Lazy<ty::PolyFnSig<'tcx>>,
557557
}
558-
impl_stable_hash_for!(struct ClosureData<'tcx> { kind, ty });
558+
impl_stable_hash_for!(struct ClosureData<'tcx> { kind, sig });

src/librustc_trans/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ pub fn ty_fn_sig<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
500500
ty::TyFnPtr(sig) => sig,
501501
ty::TyClosure(def_id, substs) => {
502502
let tcx = ccx.tcx();
503-
let sig = tcx.closure_type(def_id).subst(tcx, substs.substs);
503+
let sig = tcx.fn_sig(def_id).subst(tcx, substs.substs);
504504

505505
let env_region = ty::ReLateBound(ty::DebruijnIndex::new(1), ty::BrEnv);
506506
let env_ty = match tcx.closure_kind(def_id) {

src/librustc_trans/mir/constant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ impl<'a, 'tcx> MirConstContext<'a, 'tcx> {
578578
.find(|it| it.kind == ty::AssociatedKind::Method)
579579
.unwrap().def_id;
580580
// Now create its substs [Closure, Tuple]
581-
let input = tcx.closure_type(def_id)
581+
let input = tcx.fn_sig(def_id)
582582
.subst(tcx, substs.substs).input(0);
583583
let input = tcx.erase_late_bound_regions_and_normalize(&input);
584584
let substs = tcx.mk_substs([operand.ty, input]

src/librustc_trans/monomorphize.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn fn_once_adapter_instance<'a, 'tcx>(
4040
let self_ty = tcx.mk_closure_from_closure_substs(
4141
closure_did, substs);
4242

43-
let sig = tcx.closure_type(closure_did).subst(tcx, substs.substs);
43+
let sig = tcx.fn_sig(closure_did).subst(tcx, substs.substs);
4444
let sig = tcx.erase_late_bound_regions_and_normalize(&sig);
4545
assert_eq!(sig.inputs().len(), 1);
4646
let substs = tcx.mk_substs([

src/librustc_typeck/check/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
108108
// haven't yet decided on whether the closure is fn vs
109109
// fnmut vs fnonce. If so, we have to defer further processing.
110110
if self.closure_kind(def_id).is_none() {
111-
let closure_ty = self.closure_type(def_id).subst(self.tcx, substs.substs);
111+
let closure_ty = self.fn_sig(def_id).subst(self.tcx, substs.substs);
112112
let fn_sig = self.replace_late_bound_regions_with_fresh_var(call_expr.span,
113113
infer::FnCall,
114114
&closure_ty)

src/librustc_typeck/check/coercion.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> {
639639
// `extern "rust-call" fn((arg0,arg1,...)) -> _`
640640
// to
641641
// `fn(arg0,arg1,...) -> _`
642-
let sig = self.closure_type(def_id_a).subst(self.tcx, substs_a.substs);
642+
let sig = self.fn_sig(def_id_a).subst(self.tcx, substs_a.substs);
643643
let converted_sig = sig.map_bound(|s| {
644644
let params_iter = match s.inputs()[0].sty {
645645
ty::TyTuple(params, _) => {

src/librustc_typeck/check/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -682,16 +682,16 @@ pub fn provide(providers: &mut Providers) {
682682
typeck_item_bodies,
683683
typeck_tables_of,
684684
has_typeck_tables,
685-
closure_type,
685+
fn_sig,
686686
closure_kind,
687687
adt_destructor,
688688
..*providers
689689
};
690690
}
691691

692-
fn closure_type<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
693-
def_id: DefId)
694-
-> ty::PolyFnSig<'tcx> {
692+
fn fn_sig<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
693+
def_id: DefId)
694+
-> ty::PolyFnSig<'tcx> {
695695
let node_id = tcx.hir.as_local_node_id(def_id).unwrap();
696696
tcx.typeck_tables_of(def_id).closure_tys[&node_id]
697697
}

0 commit comments

Comments
 (0)