Skip to content

Commit 6a9c02d

Browse files
cjdbdanakj
authored andcommitted
updates Subspace to work with Clang 21
1. Updates submodules to near-ToT * third_party/buildtools: edbefce..efa06a1 * third_party/fmt: 757564f5..c7925241 * third_party/googletest: ec25eea8..155b337c * third_party/nanobench: a5a50c2..e432789 2. Clang seems to have tightened up where lifetimebound annotations go: it looks like they need to go after the name is declared, rather than after the declaration is complete. 3. Suppresses some new errors (see comments for why). Fixes #464
1 parent 391f238 commit 6a9c02d

File tree

7 files changed

+14
-9
lines changed

7 files changed

+14
-9
lines changed

sus/collections/slice.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class [[_sus_trivial_abi]] Slice final {
164164
/// #[doc.overloads=from.array]
165165
template <size_t N>
166166
requires(N <= ::sus::cast<usize>(isize::MAX))
167-
_sus_pure static constexpr Slice from(const T (&data)[N] sus_lifetimebound) {
167+
_sus_pure static constexpr Slice from(const T (&data sus_lifetimebound)[N]) {
168168
// We strip the `const` off `data`, however only const access is provided
169169
// through this class. This is done so that mutable types can compose Slice
170170
// and store a mutable pointer.
@@ -383,7 +383,7 @@ class [[_sus_trivial_abi]] SliceMut final {
383383
/// #[doc.overloads=from.array]
384384
template <size_t N>
385385
requires(N <= ::sus::cast<usize>(isize::MAX_PRIMITIVE))
386-
_sus_pure static constexpr SliceMut from(T (&data)[N] sus_lifetimebound) {
386+
_sus_pure static constexpr SliceMut from(T (&data sus_lifetimebound)[N]) {
387387
return SliceMut(::sus::iter::IterRefCounter::empty_for_view(), data, N);
388388
}
389389

sus/ptr/copy.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ void copy_nonoverlapping(::sus::marker::UnsafeFnMarker, const T* src, T* dst,
7979
(dst < src && dst <= src - count.primitive_value));
8080
if constexpr (::sus::mem::size_of<T>() > 1) {
8181
auto bytes = count.checked_mul(::sus::mem::size_of<T>()).expect("overflow");
82-
memcpy(dst, src, bytes);
82+
// Clang isn't able to detect that `T` is trivially relocatable, and errors
83+
// out when it's not trivially copyable. We cast to `void*` since we are
84+
// certain that it's trivially relocatable.
85+
memcpy(static_cast<void*>(dst), src, bytes);
8386
} else {
84-
memcpy(dst, src, count);
87+
memcpy(static_cast<void*>(dst), src, count);
8588
}
8689
}
8790

sus/ptr/nonnull.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ struct fmt::formatter<::sus::ptr::NonNull<T>, Char> {
197197
template <class FormatContext>
198198
constexpr auto format(const ::sus::ptr::NonNull<T>& t,
199199
FormatContext& ctx) const {
200-
return underlying_.format(t.as_ptr(), ctx);
200+
// t.as_ptr() returns `const T*`, so we need to cast its constness away in
201+
// order to format it.
202+
return underlying_.format(const_cast<T*>(t.as_ptr()), ctx);
201203
}
202204

203205
private:

third_party/buildtools

Submodule buildtools updated from edbefce to efa06a1

third_party/fmt

Submodule fmt updated 193 files

third_party/googletest

Submodule googletest updated 162 files

0 commit comments

Comments
 (0)