Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e3645b5

Browse files
committedNov 13, 2017
Auto merge of #45879 - nikomatsakis:nll-kill-cyclic-closures, r=<try>
[WIP] move closure kind, signature into `ClosureSubsts` Instead of using side-tables, store the closure-kind and signature in the substitutions themselves. This has two key effects: - It means that the closure's type changes as inference finds out more things, which is very nice. - As a result, it avoids the need for the `freshen_closure_like` code (though we still use it for generators). - It avoids cyclic closures calls. - These were never meant to be supported, precisely because they make a lot of the fancy inference that we do much more complicated. However, due to an oversight, it was previously possible -- if challenging -- to create a setup where a closure *directly* called itself (see e.g. #21410). We have to see what the effect of this change is, though. Needs a crater run. Marking as [WIP] until that has been assessed. r? @arielb1
2 parents b7ccb0a + 0f6bd17 commit e3645b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+729
-647
lines changed
 

‎src/librustc/dep_graph/dep_node.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,7 @@ define_dep_nodes!( <'tcx>
498498
[] IsAutoImpl(DefId),
499499
[] ImplTraitRef(DefId),
500500
[] ImplPolarity(DefId),
501-
[] ClosureKind(DefId),
502501
[] FnSignature(DefId),
503-
[] GenSignature(DefId),
504502
[] CoerceUnsizedInfo(DefId),
505503

506504
[] ItemVarianceConstraints(DefId),

‎src/librustc/ich/impls_ty.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,9 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for ty::Predicate<'gcx> {
236236
ty::Predicate::ObjectSafe(def_id) => {
237237
def_id.hash_stable(hcx, hasher);
238238
}
239-
ty::Predicate::ClosureKind(def_id, closure_kind) => {
239+
ty::Predicate::ClosureKind(def_id, closure_substs, closure_kind) => {
240240
def_id.hash_stable(hcx, hasher);
241+
closure_substs.hash_stable(hcx, hasher);
241242
closure_kind.hash_stable(hcx, hasher);
242243
}
243244
ty::Predicate::ConstEvaluatable(def_id, substs) => {

0 commit comments

Comments
 (0)
Please sign in to comment.