Skip to content

Releases: dtolnay/cxx

1.0.4

25 Nov 21:11
1.0.4
216fed4
Compare
Choose a tag to compare
  • Implement translation between Rust [T; N] and C std::array<T, N> (#503)

1.0.3

24 Nov 22:18
1.0.3
0c6417f
Compare
Choose a tag to compare
  • Support &mut [u8] (spelled rust::Slice<uint8_t> in C ) in extern function arguments and returns (#502)

1.0.2

22 Nov 20:13
1.0.2
9754daf
Compare
Choose a tag to compare
  • Support shared enums without any explicitly declared variants as long as they are provided a defined repr (#494)

    #[cxx::bridge]
    mod ffi {
        #[repr(i32)]
        enum SharedEnum {}
    }

1.0.1

20 Nov 04:44
1.0.1
ecd8193
Compare
Choose a tag to compare
  • Fix ability to use an extern enum (https://cxx.rs/shared.html#extern-enums) as a field of a shared struct (#490)
  • Allow shared enums to contain multiple discriminants with the same integer value, relaxing a restriction that C does not have (#492)
  • Add impl DerefMut for UniquePtr<T> as long as T is a shared struct, not an opaque C type (#493)

1.0.0

17 Nov 16:40
1.0.0
bf1000f
Compare
Choose a tag to compare

Breaking changes

  • extern "C" extern block in the FFI module is no longer accepted, write extern "C " instead
  • extern "C " block must be written unsafe extern "C " if it contains at least one safe-to-call function
  • rust::Slice<T> in C has been renamed to rust::Slice<const T>; support for &mut [T] post-1.0 will use the rust::Slice<T> name
  • &mut T where T is an opaque C type is no longer ever exposed to Rust, only Pin<&mut T>
  • Related to the previous: UniquePtr binding no longer implements DerefMut for opaque C types
  • If a function's implementation is unsafe in Rust, extern "Rust" block will enforce that it's listed as unsafe fn in the extern block too
  • Opaque Rust types are required to be Unpin in addition to Sized
  • Opaque Rust types are required to be local to the current crate (for now; this may soon be lifted again)
  • Handwritten Unpin impl for opaque C types are ruled out
  • Minimum supported rustc version is raised from 1.43 to 1.48

0.5.10

17 Nov 16:39
0.5.10
b675ca3
Compare
Choose a tag to compare
  • Fix missing cstdint import when generating enums (#477)

0.5.9

11 Nov 17:41
0.5.9
a91ac38
Compare
Choose a tag to compare
  • Add the following member functions on rust::Vec<T> in C , matching the API of std::vector:

    void reserve(size_t new_cap); 
    
    void push_back(const T &value); 
    void push_back(T &&value); 
    
    template <typename... Args> 
    void emplace_back(Args &&... args); 

0.5.8

11 Nov 03:20
0.5.8
5c830f0
Compare
Choose a tag to compare
  • Support #[namespace = "..."] attribute on extern blocks (#444)

    An item will inherit the namespace specified on its surrounding extern block if any, otherwise the namespace specified with the top level cxx::bridge attribute.

    #[cxx::bridge(namespace = "third_priority")]
    mod ffi {
        #[namespace = "second_priority"]
        extern "Rust" {
            fn f();
    
            #[namespace = "first_priority"]
            fn g();
        }
    
        extern "Rust" {
            fn h();
        }
    }

    The above would result in functions ::second_priority::f, ::first_priority::g, ::third_priority::h.

0.5.7

11 Nov 03:18
0.5.7
07c5141
Compare
Choose a tag to compare
  • Fix non-compilable C code generated when a no-argument method returns String (#442)

0.5.6

09 Nov 03:29
0.5.6
22f5ff7
Compare
Choose a tag to compare
  • Support methods/member functions on shared structs (#376)