# \[Pitch #2\] Lifetime dependencies for non-\`Escapable\` values

**URL:** <https://forums.swift.org/t/pitch-2-lifetime-dependencies-for-non-escapable-values/78821>\
**Category:** Pitches\
**Created:** [March 25, 2025, 8:19pm UTC](https://forums.swift.org/t/pitch-2-lifetime-dependencies-for-non-escapable-values/78821 "2025-03-25T20:19:27Z")\
**Posts on this page:** 1\
**Showing post:** 34

<div class="post-metadata">

**Author:** ![CrystDragon](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/crystdragon/32/10461_2.png) [@CrystDragon](https://forums.swift.org/u/CrystDragon)\
**Post date:** [June 13, 2025, 10:40am UTC](https://forums.swift.org/t/pitch-2-lifetime-dependencies-for-non-escapable-values/78821/34 "2025-06-13T10:40:11Z")

</div>

Should we disallow copying the dependency of a `inout` parameter?

After reading the "Allowed Lifetime Dependencies" section of the proposal, I was pretty clear about the constraints "if the `ArgType` is `Escapable`". However, when discussing "If the `ArgType` is non-`Escapable`", the proposal simple says

> in addition to `borrow` or `&` , a `copy` dependency-kind is allowed, to indicate that the returned value has the same dependency as the argument.

I think it left out a case where an `inout` scoped dependency is copied. And it is actually legal to write the following code using the nightly compiler build:

```swift
struct A: ~Escapable {
    @lifetime(immortal)
    init() {}

    mutating func mutate() {}
}

@lifetime(&a)
func create_scoped(_ a: inout A) -> A {
    return a
}

@lifetime(copy a)
func create_copy(_ a: inout A) -> A {
    return a
}

func bar() {
    var a = A()
    var b = create_scoped(&a)
    var c = create_copy(&b)

    b.mutate()
    c.mutate()
}

```

Here both `b` and `c` have `inout` dependencies on `a`, and they can be mutated overlappingly. Shouldn't this be an error?

---

_[View the full topic](https://forums.swift.org/t/pitch-2-lifetime-dependencies-for-non-escapable-values/78821)._
