Skip to content

RustString produces "Nonisolated deinitializer 'deinit'" error #350

@kshehata

Description

@kshehata

I'm trying to follow the instructions in the book to get started with swift-bridge. I'm not sure if this is a new thing in Swift, but I'm getting the following error:

[...]/ios-rust-analyzer/IosRustAnalyzer/SwiftBridgeCore.swift:874:5: Nonisolated deinitializer 'deinit' has different actor isolation from main actor-isolated overridden declaration

I've gotten past this error just by adding the "isolate" keyword to the deinit. I don't know if that's the right solution, since I'm new to all of this, but the result looks like:

public class RustString: RustStringRefMut {
    var isOwned: Bool = true

    public override init(ptr: UnsafeMutableRawPointer) {
        super.init(ptr: ptr)
    }

    isolated deinit {
        if isOwned {
            __swift_bridge__$RustString$_free(ptr)
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions