mirror of
https://gitee.com/openharmony/third_party_rust_bindgen
synced 2024-12-14 02:31:55 +00:00
Fixed const-ness of multidimensional arrays
This commit is contained in:
parent
7f7809f779
commit
87b2bc033f
@ -1209,7 +1209,10 @@ impl Type {
|
||||
|
||||
let name = if name.is_empty() { None } else { Some(name) };
|
||||
|
||||
let is_const = ty.is_const();
|
||||
let is_const = ty.is_const() ||
|
||||
(ty.kind() == CXType_ConstantArray &&
|
||||
ty.elem_type()
|
||||
.map_or(false, |element| element.is_const()));
|
||||
|
||||
let ty = Type::new(name, layout, kind, is_const);
|
||||
// TODO: maybe declaration.canonical()?
|
||||
|
10
tests/expectations/tests/const_multidim_array_fn_arg.rs
Normal file
10
tests/expectations/tests/const_multidim_array_fn_arg.rs
Normal file
@ -0,0 +1,10 @@
|
||||
#![allow(
|
||||
dead_code,
|
||||
non_snake_case,
|
||||
non_camel_case_types,
|
||||
non_upper_case_globals
|
||||
)]
|
||||
|
||||
extern "C" {
|
||||
pub fn f(a: *const [::std::os::raw::c_int; 1usize]);
|
||||
}
|
1
tests/headers/const_multidim_array_fn_arg.h
Normal file
1
tests/headers/const_multidim_array_fn_arg.h
Normal file
@ -0,0 +1 @@
|
||||
void f(const int a[1][1]);
|
Loading…
Reference in New Issue
Block a user