Skip to content
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

[0.2] Backports #4166

Merged
merged 9 commits into from
Nov 28, 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
3 changes: 2 additions & 1 deletion .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Format macro bodies
50f26e08e146b7e9c7d1af9614486eba327d1e31

# Automated changes to upgrade to the 2021 edition
# Automated changes related to the 2021 edition upgrade
643182f7da26cedb09349b8bb3735c2e58ba24e6
108310db03e7db35ef48a902d9ce9a88ab8f9b77
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
style_check:
name: Style check
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
Expand All @@ -36,6 +37,7 @@ jobs:
- toolchain: beta
os: ubuntu-24.04
runs-on: ${{ matrix.os }}
timeout-minutes: 25
env:
TOOLCHAIN: ${{ matrix.toolchain }}
steps:
Expand Down Expand Up @@ -73,6 +75,7 @@ jobs:
- target: i686-pc-windows-msvc
os: windows-2022
runs-on: ${{ matrix.os }}
timeout-minutes: 25
env:
TARGET: ${{ matrix.target }}
steps:
Expand Down Expand Up @@ -123,6 +126,7 @@ jobs:
# FIXME: It seems some items in `src/unix/mod.rs`
# aren't defined on redox actually.
# - x86_64-unknown-redox
timeout-minutes: 25
env:
TARGET: ${{ matrix.target }}
steps:
Expand All @@ -141,6 +145,7 @@ jobs:
matrix:
target:
- x86_64-pc-solaris
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- name: test on Solaris
Expand All @@ -164,6 +169,7 @@ jobs:
runs-on: ubuntu-24.04
env:
TOOLCHAIN: nightly
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Rust toolchain
Expand Down
9 changes: 8 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,20 @@ fn main() {
//
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
// running tests to ensure that the ABI is correct.
let which_freebsd = if libc_ci {
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_FREEBSD_VERSION");
// Allow overriding the default version for testing
let which_freebsd = if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
let vers = version.parse().unwrap();
println!("cargo:warning=setting FreeBSD version to {vers}");
vers
} else if libc_ci {
which_freebsd().unwrap_or(11)
} else if rustc_dep_of_std {
12
} else {
11
};

match which_freebsd {
x if x < 10 => panic!("FreeBSD older than 10 is not supported"),
10 => set_cfg("freebsd10"),
Expand Down
2 changes: 1 addition & 1 deletion ci/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
}
}
if line.contains("#[derive(") && (line.contains("Copy") || line.contains("Clone")) {
err.error(path, i, "impl ::Copy and ::Clone manually");
err.error(path, i, "impl Copy and Clone manually");
}
if line.contains("impl") {
in_impl = true;
Expand Down
50 changes: 35 additions & 15 deletions ci/verify-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then
rustup component add rust-src
fi

# Run the tests for a specific target
test_target() {
target="${1}"
no_dist="${2:-0}"
Expand Down Expand Up @@ -68,8 +69,31 @@ test_target() {
# Test again without default features, i.e. without "std"
$cmd --no-default-features
$cmd --no-default-features --features extra_traits

# For tier 2 freebsd targets, check with the different versions we support
# if on nightly or stable
case "$rust-$target" in
stable-x86_64-*freebsd*) do_freebsd_checks=1 ;;
nightly-i686*freebsd*) do_freebsd_checks=1 ;;
esac

if [ -n "${do_freebsd_checks:-}" ]; then
for version in $freebsd_versions; do
export RUST_LIBC_UNSTABLE_FREEBSD_VERSION="$version"
$cmd
$cmd --no-default-features
done
fi
}

freebsd_versions="\
11 \
12 \
13 \
14 \
15 \
"

rust_linux_targets="\
aarch64-linux-android \
aarch64-unknown-linux-gnu \
Expand Down Expand Up @@ -244,21 +268,19 @@ for target in $targets; do
if echo "$target" | grep -q "$filter"; then
if [ "$os" = "windows" ]; then
TARGET="$target" ./ci/install-rust.sh
test_target "$target"
else
# `wasm32-wasip1` was renamed from `wasm32-wasi`
if [ "$target" = "wasm32-wasip1" ] && [ "$supports_wasi_pn" = "0" ]; then
target="wasm32-wasi"
fi
fi

# `wasm32-wasip2` only exists in recent versions of Rust
if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then
continue
fi

test_target "$target"
# `wasm32-wasip1` was renamed from `wasm32-wasi`
if [ "$target" = "wasm32-wasip1" ] && [ "$supports_wasi_pn" = "0" ]; then
target="wasm32-wasi"
fi

# `wasm32-wasip2` only exists in recent versions of Rust
if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then
continue
fi

test_target "$target"
test_run=1
fi
done
Expand All @@ -267,11 +289,9 @@ for target in ${no_dist_targets:-}; do
if echo "$target" | grep -q "$filter"; then
if [ "$os" = "windows" ]; then
TARGET="$target" ./ci/install-rust.sh
test_target "$target" 1
else
test_target "$target" 1
fi

test_target "$target" 1
test_run=1
fi
done
Expand Down
7 changes: 7 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4734,9 +4734,16 @@ fn test_linux_like_apis(target: &str) {
}

fn which_freebsd() -> Option<i32> {
if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
let vers = version.parse().unwrap();
println!("cargo:warning=setting FreeBSD version to {vers}");
return Some(vers);
}

let output = std::process::Command::new("freebsd-version")
.output()
.ok()?;

if !output.status.success() {
return None;
}
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/solarish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ LIO_WRITE
PIPE_BUF
SIGEV_PORT
_POSIX_VDISABLE
_ST_FSTYPSZ
aio_cancel
aio_error
aio_fsync
Expand Down
3 changes: 2 additions & 1 deletion src/fuchsia/aarch64.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::{c_int, c_long, c_uint, c_ulong, c_ulonglong, c_ushort, off_t, size_t};
use crate::off_t;
use crate::prelude::*;

pub type c_char = u8;
pub type __u64 = c_ulonglong;
Expand Down
Loading