File tree Expand file tree Collapse file tree 2 files changed +106
-149
lines changed
Expand file tree Collapse file tree 2 files changed +106
-149
lines changed Original file line number Diff line number Diff line change @@ -992,6 +992,13 @@ class LifetimeDependenceChecker {
992992 return ;
993993 }
994994 if (afd->getParameters ()->size () > 0 ) {
995+ if (useLazyInference ()) {
996+ // Assume that a mutating method does not depend on its parameters.
997+ // This is unsafe but needed because some MutableSpan APIs snuck into
998+ // the standard library interface without specifying dependencies.
999+ pushDeps (createDeps (selfIndex).add (selfIndex,
1000+ LifetimeDependenceKind::Inherit));
1001+ }
9951002 return ;
9961003 }
9971004 pushDeps (createDeps (selfIndex).add (selfIndex,
@@ -1037,6 +1044,17 @@ class LifetimeDependenceChecker {
10371044 .add (newValIdx, kind));
10381045 break ;
10391046 }
1047+ case AccessorKind::MutableAddress:
1048+ if (useLazyInference ()) {
1049+ // Assume that a mutating method does not depend on its parameters.
1050+ // Currently only for backward interface compatibility. Even though this
1051+ // is the only useful dependence (a borrow of self is possible but not
1052+ // useful), explicit annotation is required for now to confirm that the
1053+ // mutated self cannot depend on anything stored at this address.
1054+ pushDeps (createDeps (selfIndex).add (selfIndex,
1055+ LifetimeDependenceKind::Inherit));
1056+ }
1057+ break ;
10401058 default :
10411059 // Unknown mutating accessor.
10421060 break ;
You can’t perform that action at this time.
0 commit comments