Skip to content

[main] Apply three pull requests to main #3878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set -ex
: "${OS?The OS environment variable must be set.}"

RUST=${TOOLCHAIN}
VERBOSE=-v

echo "Testing Rust ${RUST} on ${OS}"

Expand Down Expand Up @@ -41,50 +42,50 @@ test_target() {

# Test that libc builds without any default features (no std)
if [ "${NO_STD}" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}"
cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}"
else
# FIXME: With `build-std` feature, `compiler_builtins` emits a lof of lint warnings.
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --no-default-features --target "${TARGET}"
-Z build-std=core,alloc "$VERBOSE" --no-default-features --target "${TARGET}"
fi
# Test that libc builds with default features (e.g. std)
# if the target supports std
if [ "$NO_STD" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}"
cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}"
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --target "${TARGET}"
-Z build-std=core,alloc "$VERBOSE" --target "${TARGET}"
fi

# Test that libc builds with the `extra_traits` feature
if [ "${NO_STD}" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \
--features extra_traits
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --no-default-features \
-Z build-std=core,alloc "$VERBOSE" --no-default-features \
--target "${TARGET}" --features extra_traits
fi

# Test the 'const-extern-fn' feature on nightly
if [ "${RUST}" = "nightly" ]; then
if [ "${NO_STD}" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --no-default-features --target "${TARGET}" \
cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --no-default-features --target "${TARGET}" \
--features const-extern-fn
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --no-default-features \
-Z build-std=core,alloc "$VERBOSE" --no-default-features \
--target "${TARGET}" --features const-extern-fn
fi
fi

# Also test that it builds with `extra_traits` and default features:
if [ "$NO_STD" != "1" ]; then
cargo "+${RUST}" "${BUILD_CMD}" -vv --target "${TARGET}" \
cargo "+${RUST}" "${BUILD_CMD}" "$VERBOSE" --target "${TARGET}" \
--features extra_traits
else
RUSTFLAGS="-A improper_ctypes_definitions" cargo "+${RUST}" "${BUILD_CMD}" \
-Z build-std=core,alloc -vv --target "${TARGET}" \
-Z build-std=core,alloc "$VERBOSE" --target "${TARGET}" \
--features extra_traits
fi
}
Expand Down
1 change: 1 addition & 0 deletions libc-test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[package]
name = "libc-test"
version = "0.2.151"
edition = "2018"
authors = ["The Rust Project Developers"]
license = "MIT OR Apache-2.0"
build = "build.rs"
Expand Down
11 changes: 8 additions & 3 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ fn do_semver() {
let target_env = env::var("CARGO_CFG_TARGET_ENV").unwrap();

// `libc-test/semver` dir.
let mut semver_root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
semver_root.push("semver");
let mut semver_root = PathBuf::from("semver");

// NOTE: Windows has the same `family` as `os`, no point in including it
// twice.
Expand All @@ -93,7 +92,10 @@ fn do_semver() {
if family != os && os != "android" {
process_semver_file(&mut output, &mut semver_root, &family);
}
process_semver_file(&mut output, &mut semver_root, &vendor);
// We don't do semver for unknown targets.
if vendor != "unknown" {
process_semver_file(&mut output, &mut semver_root, &vendor);
}
process_semver_file(&mut output, &mut semver_root, &os);
let os_arch = format!("{}-{}", os, arch);
process_semver_file(&mut output, &mut semver_root, &os_arch);
Expand Down Expand Up @@ -141,6 +143,9 @@ fn process_semver_file<W: Write, P: AsRef<Path>>(output: &mut W, path: &mut Path
}

fn main() {
// Avoid unnecessary re-building.
println!("cargo:rerun-if-changed=build.rs");

do_cc();
do_ctest();
do_semver();
Expand Down
1 change: 1 addition & 0 deletions src/unix/linux_like/linux/uclibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ extern "C" {
pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
pub fn getpriority(which: ::__priority_which_t, who: ::id_t) -> ::c_int;
pub fn setpriority(which: ::__priority_which_t, who: ::id_t, prio: ::c_int) -> ::c_int;
pub fn getauxval(type_: ::c_ulong) -> ::c_ulong;
}

cfg_if! {
Expand Down