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 @@ -1074,6 +1074,13 @@ class LifetimeDependenceChecker {
10741074 return ;
10751075 }
10761076 if (afd->getParameters ()->size () > 0 ) {
1077+ if (useLazyInference ()) {
1078+ // Assume that a mutating method does not depend on its parameters.
1079+ // This is unsafe but needed because some MutableSpan APIs snuck into
1080+ // the standard library interface without specifying dependencies.
1081+ pushDeps (createDeps (selfIndex).add (selfIndex,
1082+ LifetimeDependenceKind::Inherit));
1083+ }
10771084 return ;
10781085 }
10791086 pushDeps (createDeps (selfIndex).add (selfIndex,
@@ -1120,6 +1127,17 @@ class LifetimeDependenceChecker {
11201127 .add (newValIdx, *kind));
11211128 break ;
11221129 }
1130+ case AccessorKind::MutableAddress:
1131+ if (useLazyInference ()) {
1132+ // Assume that a mutating method does not depend on its parameters.
1133+ // Currently only for backward interface compatibility. Even though this
1134+ // is the only useful dependence (a borrow of self is possible but not
1135+ // useful), explicit annotation is required for now to confirm that the
1136+ // mutated self cannot depend on anything stored at this address.
1137+ pushDeps (createDeps (selfIndex).add (selfIndex,
1138+ LifetimeDependenceKind::Inherit));
1139+ }
1140+ break ;
11231141 default :
11241142 // Unknown mutating accessor.
11251143 break ;
You can’t perform that action at this time.
0 commit comments