mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2024-11-23 07:10:29 +00:00
Add test of cxx_name which is Rust keyword
Currently fails with: error[cxxbridge]: expected identifier ┌─ lib.rs:46:22 │ 46 │ #[cxx_name = "type"] │ ^^^^^^ expected identifier
This commit is contained in:
parent
13e7e10414
commit
7d7c757e28
@ -43,6 +43,7 @@ pub mod ffi {
|
||||
#[namespace = "A"]
|
||||
#[derive(Copy, Clone, Default)]
|
||||
struct AShared {
|
||||
#[cxx_name = "type"]
|
||||
z: usize,
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,9 @@ std::unique_ptr<::H::H> c_return_ns_unique_ptr() {
|
||||
|
||||
const size_t &c_return_ref(const Shared &shared) { return shared.z; }
|
||||
|
||||
const size_t &c_return_ns_ref(const ::A::AShared &shared) { return shared.z; }
|
||||
const size_t &c_return_ns_ref(const ::A::AShared &shared) {
|
||||
return shared.type;
|
||||
}
|
||||
|
||||
const size_t &c_return_nested_ns_ref(const ::A::B::ABShared &shared) {
|
||||
return shared.z;
|
||||
@ -240,7 +242,7 @@ void c_take_shared(Shared shared) {
|
||||
}
|
||||
|
||||
void c_take_ns_shared(::A::AShared shared) {
|
||||
if (shared.z == 2020) {
|
||||
if (shared.type == 2020) {
|
||||
cxx_test_suite_set_correct();
|
||||
}
|
||||
}
|
||||
@ -397,7 +399,7 @@ void c_take_rust_vec_shared(rust::Vec<Shared> v) {
|
||||
void c_take_rust_vec_ns_shared(rust::Vec<::A::AShared> v) {
|
||||
uint32_t sum = 0;
|
||||
for (auto i : v) {
|
||||
sum += i.z;
|
||||
sum += i.type;
|
||||
}
|
||||
if (sum == 2021) {
|
||||
cxx_test_suite_set_correct();
|
||||
@ -916,7 +918,7 @@ void ns_c_take_trivial(::tests::D d) {
|
||||
}
|
||||
|
||||
void ns_c_take_ns_shared(::A::AShared shared) {
|
||||
if (shared.z == 2020) {
|
||||
if (shared.type == 2020) {
|
||||
cxx_test_suite_set_correct();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user