Touch up PR 951

This commit is contained in:
David Tolnay 2021-12-08 17:02:13 -08:00
parent aa3e828402
commit 8bb18c37ff
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
5 changed files with 10 additions and 13 deletions

View File

@ -45,9 +45,9 @@ public:
void reserve(size_t new_cap);
void push_back(const T &value);
void push_back(T &&value);
void clear();
template <typename... Args>
void emplace_back(Args &&...args);
void clear();
class iterator;
iterator begin() noexcept;

View File

@ -1590,13 +1590,10 @@ fn write_rust_vec_impl(out: &mut OutFile, key: NamedImplKey) {
instance,
);
writeln!(out, "}}");
writeln!(out, "template <>");
begin_function_definition(out);
writeln!(
out,
"void Vec<{}>::clear() noexcept {{",
inner,
);
writeln!(out, "void Vec<{}>::clear() {{", inner);
writeln!(
out,
" return cxxbridge1$rust_vec${}$clear(this);",

View File

@ -318,13 +318,13 @@ public:
T &at(std::size_t n);
T &front() noexcept;
T &back() noexcept;
void clear() noexcept;
void reserve(std::size_t new_cap);
void push_back(const T &value);
void push_back(T &&value);
template <typename... Args>
void emplace_back(Args &&...args);
void clear();
using iterator = typename Slice<T>::iterator;
iterator begin() noexcept;

View File

@ -567,10 +567,10 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *),
const rust::Vec<CXX_TYPE> *ptr) noexcept; \
void cxxbridge1$rust_vec$##RUST_TYPE##$reserve_total( \
rust::Vec<CXX_TYPE> *ptr, std::size_t new_cap) noexcept; \
void cxxbridge1$rust_vec$##RUST_TYPE##$clear( \
rust::Vec<CXX_TYPE> *ptr) noexcept; \
void cxxbridge1$rust_vec$##RUST_TYPE##$set_len(rust::Vec<CXX_TYPE> *ptr, \
std::size_t len) noexcept;
std::size_t len) noexcept; \
void cxxbridge1$rust_vec$##RUST_TYPE##$clear( \
rust::Vec<CXX_TYPE> *ptr) noexcept;
#define RUST_VEC_OPS(RUST_TYPE, CXX_TYPE) \
template <> \
@ -602,9 +602,9 @@ static_assert(sizeof(std::string) <= kMaxExpectedWordsInString * sizeof(void *),
cxxbridge1$rust_vec$##RUST_TYPE##$set_len(this, len); \
} \
template <> \
void Vec<CXX_TYPE>::clear() noexcept { \
void Vec<CXX_TYPE>::clear() { \
cxxbridge1$rust_vec$##RUST_TYPE##$clear(this); \
}
}
#define SHARED_PTR_OPS(RUST_TYPE, CXX_TYPE) \
static_assert(sizeof(std::shared_ptr<CXX_TYPE>) == 2 * sizeof(void *), ""); \

View File

@ -70,7 +70,7 @@ impl<T> RustVec<T> {
}
pub fn clear(&mut self) {
self.as_mut_vec().clear()
self.as_mut_vec().clear();
}
}