Skip to content

Commit 6dc4803

Browse files
rj00amyl7
authored andcommitted
Remove extra traits
1 parent 0185395 commit 6dc4803

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+137
-10984
lines changed

Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Raw FFI bindings to platform libraries like libc.
1717
rust-version = "1.71.0"
1818

1919
[package.metadata.docs.rs]
20-
features = ["const-extern-fn", "extra_traits"]
20+
features = ["const-extern-fn"]
2121
default-target = "x86_64-unknown-linux-gnu"
2222
targets = [
2323
"aarch64-apple-darwin",
@@ -138,7 +138,6 @@ default = ["std"]
138138
std = []
139139
align = []
140140
rustc-dep-of-std = ['align', 'rustc-std-workspace-core']
141-
extra_traits = []
142141
const-extern-fn = []
143142

144143
[workspace]

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ libc = "0.2"
4040
feature to remove this dependency and be able to use `libc` in `#![no_std]`
4141
crates.
4242

43-
* `extra_traits`: all `struct`s implemented in `libc` are `Copy` and `Clone`.
44-
This feature derives `Debug`, `Eq`, `Hash`, and `PartialEq`.
45-
4643
* `const-extern-fn`: Changes some `extern fn`s into `const extern fn`s.
4744
If you use Rust >= 1.62, this feature is implicitly enabled.
4845
Otherwise it requires a nightly rustc.

ci/build.sh

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,6 @@ test_target() {
5656
-Z build-std=core,alloc -vv --target "${TARGET}"
5757
fi
5858

59-
# Test that libc builds with the `extra_traits` feature
60-
if [ "${NO_STD}" != "1" ]; then
61-
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
62-
--features extra_traits
63-
else
64-
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
65-
-Z build-std=core,alloc -vv --no-default-features \
66-
--target "${TARGET}" --features extra_traits
67-
fi
68-
6959
# Test the 'const-extern-fn' feature on nightly
7060
if [ "${RUST}" = "nightly" ]; then
7161
if [ "${NO_STD}" != "1" ]; then
@@ -77,16 +67,6 @@ test_target() {
7767
--target "${TARGET}" --features const-extern-fn
7868
fi
7969
fi
80-
81-
# Also test that it builds with `extra_traits` and default features:
82-
if [ "$NO_STD" != "1" ]; then
83-
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \
84-
--features extra_traits
85-
else
86-
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
87-
-Z build-std=core,alloc -vv --target "${TARGET}" \
88-
--features extra_traits
89-
fi
9070
}
9171

9272
RUST_LINUX_TARGETS="\

ci/run.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ if [ "$TARGET" = "s390x-unknown-linux-gnu" ]; then
101101
continue
102102
fi
103103
elif [ "$passed" = "2" ]; then
104-
if cargo test --features extra_traits --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}; then
104+
if cargo test --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}; then
105105
break
106106
fi
107107
fi
@@ -114,6 +114,6 @@ else
114114

115115
cargo test --manifest-path libc-test/Cargo.toml --target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
116116

117-
RUST_BACKTRACE=1 cargo test --features extra_traits --manifest-path libc-test/Cargo.toml \
117+
RUST_BACKTRACE=1 cargo test --manifest-path libc-test/Cargo.toml \
118118
--target "${TARGET}" ${LIBC_CI_ZBUILD_STD+"-Zbuild-std"}
119119
fi

ci/style.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,6 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
142142
} else if line.starts_with("s! {") {
143143
s_macros += 1;
144144
State::Structs
145-
} else if line.starts_with("s_no_extra_traits! {") {
146-
// multiple macros of this type are allowed
147-
State::Structs
148145
} else if line.starts_with("s_paren! {") {
149146
// multiple macros of this type are allowed
150147
State::Structs

libc-test/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ ctest2 = "0.4.3"
2424
default = ["std"]
2525
std = ["libc/std"]
2626
align = ["libc/align"]
27-
extra_traits = ["libc/extra_traits"]
2827

2928
[[test]]
3029
name = "main"

src/fuchsia/align.rs

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ macro_rules! expand_align {
2929
pub struct pthread_condattr_t {
3030
size: [u8; ::__SIZEOF_PTHREAD_CONDATTR_T],
3131
}
32-
}
3332

34-
s_no_extra_traits! {
3533
#[cfg_attr(all(target_pointer_width = "32",
3634
any(target_arch = "arm",
3735
target_arch = "x86_64")),
@@ -68,75 +66,5 @@ macro_rules! expand_align {
6866
size: [u8; ::__SIZEOF_PTHREAD_COND_T],
6967
}
7068
}
71-
72-
cfg_if! {
73-
if #[cfg(feature = "extra_traits")] {
74-
impl PartialEq for pthread_cond_t {
75-
fn eq(&self, other: &pthread_cond_t) -> bool {
76-
self.size
77-
.iter()
78-
.zip(other.size.iter())
79-
.all(|(a,b)| a == b)
80-
}
81-
}
82-
impl Eq for pthread_cond_t {}
83-
impl ::fmt::Debug for pthread_cond_t {
84-
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
85-
f.debug_struct("pthread_cond_t")
86-
// FIXME: .field("size", &self.size)
87-
.finish()
88-
}
89-
}
90-
impl ::hash::Hash for pthread_cond_t {
91-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
92-
self.size.hash(state);
93-
}
94-
}
95-
96-
impl PartialEq for pthread_mutex_t {
97-
fn eq(&self, other: &pthread_mutex_t) -> bool {
98-
self.size
99-
.iter()
100-
.zip(other.size.iter())
101-
.all(|(a,b)| a == b)
102-
}
103-
}
104-
impl Eq for pthread_mutex_t {}
105-
impl ::fmt::Debug for pthread_mutex_t {
106-
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
107-
f.debug_struct("pthread_mutex_t")
108-
// FIXME: .field("size", &self.size)
109-
.finish()
110-
}
111-
}
112-
impl ::hash::Hash for pthread_mutex_t {
113-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
114-
self.size.hash(state);
115-
}
116-
}
117-
118-
impl PartialEq for pthread_rwlock_t {
119-
fn eq(&self, other: &pthread_rwlock_t) -> bool {
120-
self.size
121-
.iter()
122-
.zip(other.size.iter())
123-
.all(|(a,b)| a == b)
124-
}
125-
}
126-
impl Eq for pthread_rwlock_t {}
127-
impl ::fmt::Debug for pthread_rwlock_t {
128-
fn fmt(&self, f: &mut ::fmt::Formatter) -> ::fmt::Result {
129-
f.debug_struct("pthread_rwlock_t")
130-
// FIXME: .field("size", &self.size)
131-
.finish()
132-
}
133-
}
134-
impl ::hash::Hash for pthread_rwlock_t {
135-
fn hash<H: ::hash::Hasher>(&self, state: &mut H) {
136-
self.size.hash(state);
137-
}
138-
}
139-
}
140-
}
14169
};
14270
}

0 commit comments

Comments
 (0)