not sure if this makes sense, but is there a way to mark a non-mutating instance method in swift 5.8 so that it passes self
__owned
by default?
public
struct S
{
let x:[Int]
}
extension S
{
public
func y() -> [Int]
{
var x:[Int] = self.x
x.append(0)
return x
}
}
import struct S.S
func test(_ s:__owned S)
{
// how to prevent this from copying?
let y:[Int] = s.y()
}
i would really rather not have to @inlinable
the S.y
method, and turning it into a static function that takes an instance of S
__owned
just feels awkward.