Skip to content

Commit b6c51d8

Browse files
authored
Merge pull request #5 from atrick/lifetime-dependency
Fix a grammar typo.
2 parents 226d635 + 0ed7906 commit b6c51d8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

proposals/NNNN-lifetime-dependency.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ We expect these implicit inferences to cover most cases, with the explicit form
307307
Normally, lifetime dependence is required when a nonescapable function result depends on an argument to that function. In some rare cases, however, a nonescapable function parameter may depend on another argument to that function. Consider a function with an `inout` parameter. The function body may reassign that parameter to a value that depends on another parameter. This is similar in principle to a result dependence.
308308

309309
```swift
310-
func mayReassign(span: dependsOn(a) inout [Int], to a: [Int]) {
310+
func mayReassign(span: dependsOn(a) inout Span<Int>, to a: ContiguousArray<Int>) {
311311
span = a.span()
312312
}
313313
```
@@ -599,7 +599,7 @@ This new syntax adds an optional `dependsOn(...)` lifetime modifier just before
599599
> *function-result***`->`** *attributes?* *lifetime-modifiers?* *type* \
600600
> *lifetime-modifiers**lifetime-modifier* *lifetime-modifiers?* \
601601
> *lifetime-modifier***`dependsOn`** **`(`** *lifetime-dependent-list* **`)`** \
602-
> *lifetime-dependence-list**lifetime-dependent* | *lifetime-dependence-source* **`,`** *lifetime-dependent-list*
602+
> *lifetime-dependence-list**lifetime-dependence-source* **`,`** *lifetime-dependent-list*
603603
> *lifetime-dependence-source***`self`** | *local-parameter-name* | **`scoped self`** | **`scoped`** *local-parameter-name* | **`immortal`**
604604
>
605605
> *parameter-type-annotation* → : *attributes?* *lifetime-modifiers?* *parameter-modifier*? *type*
@@ -795,7 +795,7 @@ func reassign(_ span: inout Span<Int>) {
795795
If a function takes a nonescapable 'inout' argument, it may only reassign that argument if it is marked dependent on another function argument that provies the source of the dependence.
796796

797797
```swift
798-
func reassignWithArgDependence(_ span: dependsOn(arg) inout [Int], _ arg: [Int]) {
798+
func reassignWithArgDependence(_ span: dependsOn(arg) inout ContiguousArray<Int>, _ arg: ContiguousArray<Int>) {
799799
span = arg.span() // ✅ OK: 'span' already depends on 'arg' in the caller's scope.
800800
}
801801
```

0 commit comments

Comments
 (0)