Skip to content

Commit 6248a2a

Browse files
authored
Merge pull request #77645 from meg-gupta/deleteinference
Delete lifetime dependence inference on mutating self
2 parents 4f32598 + daba1cb commit 6248a2a

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

lib/AST/LifetimeDependence.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -513,16 +513,6 @@ LifetimeDependenceInfo::infer(AbstractFunctionDecl *afd) {
513513
if (accessor->getAccessorKind() == AccessorKind::Set) {
514514
return inferSetter(accessor);
515515
}
516-
} else if (auto *fd = dyn_cast<FuncDecl>(afd)) {
517-
// Infer self dependence for a mutating function with no result.
518-
//
519-
// FIXME: temporary hack until we have dependsOn(self: param) syntax.
520-
// Do not apply this to accessors (_modify). _modify is handled below like
521-
// a mutating method.
522-
if (fd->isMutating() && fd->getResultInterfaceType()->isVoid() &&
523-
!dc->getSelfTypeInContext()->isEscapable()) {
524-
return inferMutatingSelf(afd);
525-
}
526516
}
527517

528518
if (hasEscapableResultOrYield(afd)) {

test/SIL/implicit_lifetime_dependence.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,8 @@ public struct OuterNE: ~Escapable {
196196
self.inner1 = InnerNE(owner: owner)
197197
}
198198

199-
// Infer a dependence from 'self' on 'value'. We might revoke this rule once we have syntax.
200-
//
201199
// CHECK-LABEL: sil hidden @$s28implicit_lifetime_dependence7OuterNEV8setInner5valueyAC0gE0V_tF : $@convention(method) (@guaranteed OuterNE.InnerNE, @lifetime(copy 0) @inout OuterNE) -> () {
200+
@lifetime(self: value)
202201
mutating func setInner(value: InnerNE) {
203202
self.inner1 = value
204203
}

0 commit comments

Comments
 (0)