I guess MSVC finds this important enough to emit warnings about.
cxxbridge\sources\tests\ffi\lib.rs.cc(1220): warning C4624: 'tests::R': destructor was implicitly defined as deleted
cxxbridge\sources\tests\ffi\lib.rs.cc(1335): warning C4190: 'tests$cxxbridge1$c_return_str' has C-linkage specified, but returns UDT 'rust::cxxbridge1::Str' which is incompatible with C
cxxbridge\include\rust/cxx.h(93): note: see declaration of 'rust::cxxbridge1::Str'
cxxbridge\sources\tests\ffi\lib.rs.cc(1340): warning C4190: 'tests$cxxbridge1$c_return_slice_char' has C-linkage specified, but returns UDT 'rust::cxxbridge1::Slice<const char>' which is incompatible with C
cxxbridge\crate\tests/ffi/tests.h(93): note: see declaration of 'rust::cxxbridge1::Slice<const char>'
cxxbridge\sources\tests\ffi\lib.rs.cc(1345): warning C4190: 'tests$cxxbridge1$c_return_mutsliceu8' has C-linkage specified, but returns UDT 'rust::cxxbridge1::Slice<uint8_t>' which is incompatible with C
cxxbridge\crate\tests/ffi/tests.h(94): note: see declaration of 'rust::cxxbridge1::Slice<uint8_t>'
cxxbridge\sources\tests\ffi\lib.rs.cc(1976): warning C4190: 'tests$cxxbridge1$r_return_str' has C-linkage specified, but returns UDT 'rust::cxxbridge1::Str' which is incompatible with C
cxxbridge\include\rust/cxx.h(93): note: see declaration of 'rust::cxxbridge1::Str'
cxxbridge\sources\tests\ffi\lib.rs.cc(1978): warning C4190: 'tests$cxxbridge1$r_return_sliceu8' has C-linkage specified, but returns UDT 'rust::cxxbridge1::Slice<const uint8_t>' which is incompatible with C
cxxbridge\crate\tests/ffi/tests.h(163): note: see declaration of 'rust::cxxbridge1::Slice<const uint8_t>'
cxxbridge\sources\tests\ffi\lib.rs.cc(1980): warning C4190: 'tests$cxxbridge1$r_return_mutsliceu8' has C-linkage specified, but returns UDT 'rust::cxxbridge1::Slice<uint8_t>' which is incompatible with C
cxxbridge\crate\tests/ffi/tests.h(94): note: see declaration of 'rust::cxxbridge1::Slice<uint8_t>'
Fix for warning when running cargo test.
```
warning: /Users/pickett/Documents/GitHub/cxx/target/debug/build/cxx-test-suite-de711daed7f2e46d/out/cxxbridge/sources/tests/ffi/lib.rs.cc:1256:10: warning: struct template 'Slice' was previously declared as a class template; this is valid, but may result in linker errors under the Microsoft C++ ABI [-Wmismatched-tags]
warning: template struct ::rust::Slice<const char>;
warning: ^
warning: /Users/pickett/Documents/GitHub/cxx/target/debug/build/cxx-test-suite-de711daed7f2e46d/out/cxxbridge/include/rust/cxx.h:146:7: note: previous use is here
warning: class Slice final
warning: ^
warning: /Users/pickett/Documents/GitHub/cxx/target/debug/build/cxx-test-suite-de711daed7f2e46d/out/cxxbridge/sources/tests/ffi/lib.rs.cc:1256:10: note: did you mean class here?
warning: template struct ::rust::Slice<const char>;
warning: ^~~~~~
warning: class
```
MSVC fails to compile code like the following unless there is an
explicit instantiation of the class template:
template <typename T>
class slice {};
//template class slice<int>;
extern "C" slice<int> repro() { return {}; }
Error:
<source>(6): error C2526: 'repro': C linkage function cannot return C++ class 'slice<int>'
<source>(6): note: see declaration of 'slice<int>'
<source>(6): error C2562: 'repro': 'void' function returning a value
<source>(6): note: see declaration of 'repro'
Compiler returned: 2
This results in slightly less noise when code generation produces an
error during a Cargo build.
Before:
process didn't exit successfully: `/git/example-cxx/target/debug/build/example-f20ef12178a95a23/build-script-build` (exit code: 1)
--- stdout
cargo:CXXBRIDGE_PREFIX=example
cargo:CXXBRIDGE_DIR0=/git/example-cxx/target/debug/build/example-188c8410ffc8bb7d/out/cxxbridge/include
cargo:CXXBRIDGE_DIR1=/git/example-cxx/target/debug/build/example-188c8410ffc8bb7d/out/cxxbridge/crate
--- stderr
error[cxxbridge]: extern type with lifetimes is not supported yet
┌─ src/main.rs:9:21
│
9 │ type Object<'a>;
│ ^^ extern type with lifetimes is not supported yet
After:
process didn't exit successfully: `/git/example-cxx/target/debug/build/example-f20ef12178a95a23/build-script-build` (exit code: 1)
--- stderr
error[cxxbridge]: extern type with lifetimes is not supported yet
┌─ src/main.rs:9:21
│
9 │ type Object<'a>;
│ ^^ extern type with lifetimes is not supported yet