mirror of
https://gitee.com/openharmony/third_party_rust_cxx
synced 2025-02-22 17:41:10 +00:00
Move namespace rust::repr above namespace rust::detail
I'd like to use rust::repr::PtrLen in the implementation of a rust::detail::Fail functor.
This commit is contained in:
parent
41f662f02e
commit
202a02917b
@ -205,6 +205,26 @@ pub(super) fn write(out: &mut OutFile) {
|
||||
writeln!(out, "inline Slice<T>::Slice(uninit) noexcept {{}}");
|
||||
}
|
||||
|
||||
out.begin_block(Block::Namespace("repr"));
|
||||
|
||||
if builtin.repr_fat {
|
||||
include.array = true;
|
||||
include.cstdint = true;
|
||||
out.next_section();
|
||||
writeln!(out, "using Fat = ::std::array<::std::uintptr_t, 2>;");
|
||||
}
|
||||
|
||||
if builtin.ptr_len {
|
||||
include.cstddef = true;
|
||||
out.next_section();
|
||||
writeln!(out, "struct PtrLen final {{");
|
||||
writeln!(out, " void *ptr;");
|
||||
writeln!(out, " ::std::size_t len;");
|
||||
writeln!(out, "}};");
|
||||
}
|
||||
|
||||
out.end_block(Block::Namespace("repr"));
|
||||
|
||||
out.begin_block(Block::Namespace("detail"));
|
||||
|
||||
if builtin.maybe_uninit {
|
||||
@ -262,26 +282,6 @@ pub(super) fn write(out: &mut OutFile) {
|
||||
writeln!(out, "}};");
|
||||
}
|
||||
|
||||
out.begin_block(Block::Namespace("repr"));
|
||||
|
||||
if builtin.repr_fat {
|
||||
include.array = true;
|
||||
include.cstdint = true;
|
||||
out.next_section();
|
||||
writeln!(out, "using Fat = ::std::array<::std::uintptr_t, 2>;");
|
||||
}
|
||||
|
||||
if builtin.ptr_len {
|
||||
include.cstddef = true;
|
||||
out.next_section();
|
||||
writeln!(out, "struct PtrLen final {{");
|
||||
writeln!(out, " void *ptr;");
|
||||
writeln!(out, " ::std::size_t len;");
|
||||
writeln!(out, "}};");
|
||||
}
|
||||
|
||||
out.end_block(Block::Namespace("repr"));
|
||||
|
||||
out.begin_block(Block::AnonymousNamespace);
|
||||
|
||||
if builtin.rust_str_new_unchecked || builtin.rust_str_repr {
|
||||
|
Loading…
x
Reference in New Issue
Block a user