Skip to content

Commit 92c652c

Browse files
committed
Remove Default on structs with pointer fields
These can't be derived in our current MSRV of 1.71, as the impl was only introduced later in 1.88. This partially reverts aa8ff85.
1 parent f113fdc commit 92c652c

File tree

8 files changed

+284
-150
lines changed

8 files changed

+284
-150
lines changed

crates/header-translator/src/rust_type.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2993,8 +2993,16 @@ impl Ty {
29932993
// less of a breaking change if we change the fields to be
29942994
// `NonNull` in the future.
29952995
nullability: Nullability::Nullable,
2996+
pointee,
29962997
..
2997-
} => true,
2998+
// TODO: Return `true` here always once MSRV is 1.88, that's
2999+
// when pointer types started implementing `Default` (which
3000+
// allows us to derive the `Default`).
3001+
//
3002+
// Alternatively, we could implement `Default` manually on
3003+
// these, but that's a bit of a hassle, so we won't bother for
3004+
// now.
3005+
} => matches!(&**pointee, Ty::Pointee(PointeeTy::Fn { .. })),
29983006
// Only arrays up to size 32 implement Default.
29993007
Self::Array {
30003008
element_type,

crates/test-assembly/crates/test_fast_enumeration/expected/apple-aarch64.s

Lines changed: 51 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/test-assembly/crates/test_fast_enumeration/expected/apple-x86_64.s

Lines changed: 122 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)