Produces 2 errors. One about sending self (Both this method and the method I'm calling are consuming), this one makes zero sense.
Another about passing in the ByteBufferWriter that is getting initialized here, which might make sense if the initializer escaped self (which is not the case here, also using final class or struct makes no difference) but I haven't found any ways of marking the initializer's return value sending Self
Also produces an error about sending self. This one I can understand.
All of the errors get resolved by adding some @concurrent annotations. Is this the intended way for migrating to NonisolatedNonsendingByDefault or am I missing something?
As for the first 2 errors, can someone enlighten me?
will fail because our nonisolated(nonsending) render is trying to call into the @concurrent local render function. I assume this is a bug and not intentional?
Just a few quick comments (I'm not familiar with the API in your example code).
A consuming method doens't invalidate self. It's ok to continue accessing the instance using the same variable after calling it, because an implicity copy is made in this case. To invalidate a binding, you need to use consume operator. But even that won't work in your example because there might be multiple variable holding the same reference to a HTML instance.
In general I think ownership and concurrency were designed as two orthogonal features in Swift (though I didn't see discussion about it).
EDIT: I later realized that my above description was inaccurate. In my new understanding consuming modifer is more about value than binding. In practice, however, my experiment showed that after running a consuming method, a class instance is still shared. So my conclusion still holds.
Are you trying to create an instance in isolation A and pass it to isolation B? If so, I think the idiomatic approach is to define its init as a nonisolated method (I haven't used it myself though).
Since all issues are introduced by NonisolatedNonsendingByDefault setting, they can be resolved by adding @concurrent annotations manually. I suppose what you really asked about was why the change caused the issues. Without understanding of your code, I suspect one possible reason is that nonisolated function's parameters are task isolated, they can be passed to global executors but not to actors (that's the difference caused by the setting).