Skip to content

CxxVector explicit shim impl fails: patterns aren't allowed in foreign function declarations #1709

Description

@DexterHill0
#[cxx::bridge]
mod ffi1 {
    unsafe extern "C++" {
        type A;
    }

    impl CxxVector<A> {}
}

This code will error with the following:

patterns aren't allowed in foreign function declarations

This is because the __vector_size and __vector_capacity extern functions generate with _ as an argument rather than a single-letter variable. For whatever reason, rust is considering this a pattern match and erroring. The solution, as per the other vector methods, is to just make the argument a single letter or something like _v.

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