Skip to content

Commit 0acb8d6

Browse files
authored
Merge pull request #4166 from tgross35/backport-crate-prelude
[0.2] Backports
2 parents 7f0c8c5 + b52375d commit 0acb8d6

File tree

161 files changed

+1991
-1926
lines changed

Some content is hidden

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

161 files changed

+1991
-1926
lines changed

.git-blame-ignore-revs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Format macro bodies
22
50f26e08e146b7e9c7d1af9614486eba327d1e31
33

4-
# Automated changes to upgrade to the 2021 edition
4+
# Automated changes related to the 2021 edition upgrade
55
643182f7da26cedb09349b8bb3735c2e58ba24e6
6+
108310db03e7db35ef48a902d9ce9a88ab8f9b77

.github/workflows/ci.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
style_check:
1919
name: Style check
2020
runs-on: ubuntu-24.04
21+
timeout-minutes: 10
2122
steps:
2223
- uses: actions/checkout@v4
2324
- name: Setup Rust toolchain
@@ -36,6 +37,7 @@ jobs:
3637
- toolchain: beta
3738
os: ubuntu-24.04
3839
runs-on: ${{ matrix.os }}
40+
timeout-minutes: 25
3941
env:
4042
TOOLCHAIN: ${{ matrix.toolchain }}
4143
steps:
@@ -73,6 +75,7 @@ jobs:
7375
- target: i686-pc-windows-msvc
7476
os: windows-2022
7577
runs-on: ${{ matrix.os }}
78+
timeout-minutes: 25
7679
env:
7780
TARGET: ${{ matrix.target }}
7881
steps:
@@ -123,6 +126,7 @@ jobs:
123126
# FIXME: It seems some items in `src/unix/mod.rs`
124127
# aren't defined on redox actually.
125128
# - x86_64-unknown-redox
129+
timeout-minutes: 25
126130
env:
127131
TARGET: ${{ matrix.target }}
128132
steps:
@@ -141,6 +145,7 @@ jobs:
141145
matrix:
142146
target:
143147
- x86_64-pc-solaris
148+
timeout-minutes: 25
144149
steps:
145150
- uses: actions/checkout@v4
146151
- name: test on Solaris
@@ -164,6 +169,7 @@ jobs:
164169
runs-on: ubuntu-24.04
165170
env:
166171
TOOLCHAIN: nightly
172+
timeout-minutes: 10
167173
steps:
168174
- uses: actions/checkout@v4
169175
- name: Setup Rust toolchain

build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,20 @@ fn main() {
4949
//
5050
// On CI, we detect the actual FreeBSD version and match its ABI exactly,
5151
// running tests to ensure that the ABI is correct.
52-
let which_freebsd = if libc_ci {
52+
println!("cargo:rerun-if-env-changed=RUST_LIBC_UNSTABLE_FREEBSD_VERSION");
53+
// Allow overriding the default version for testing
54+
let which_freebsd = if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
55+
let vers = version.parse().unwrap();
56+
println!("cargo:warning=setting FreeBSD version to {vers}");
57+
vers
58+
} else if libc_ci {
5359
which_freebsd().unwrap_or(11)
5460
} else if rustc_dep_of_std {
5561
12
5662
} else {
5763
11
5864
};
65+
5966
match which_freebsd {
6067
x if x < 10 => panic!("FreeBSD older than 10 is not supported"),
6168
10 => set_cfg("freebsd10"),

ci/style.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn check_style(file: &str, path: &Path, err: &mut Errors) {
115115
}
116116
}
117117
if line.contains("#[derive(") && (line.contains("Copy") || line.contains("Clone")) {
118-
err.error(path, i, "impl ::Copy and ::Clone manually");
118+
err.error(path, i, "impl Copy and Clone manually");
119119
}
120120
if line.contains("impl") {
121121
in_impl = true;

ci/verify-build.sh

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if [ "$TOOLCHAIN" = "nightly" ] ; then
2828
rustup component add rust-src
2929
fi
3030

31+
# Run the tests for a specific target
3132
test_target() {
3233
target="${1}"
3334
no_dist="${2:-0}"
@@ -68,8 +69,31 @@ test_target() {
6869
# Test again without default features, i.e. without "std"
6970
$cmd --no-default-features
7071
$cmd --no-default-features --features extra_traits
72+
73+
# For tier 2 freebsd targets, check with the different versions we support
74+
# if on nightly or stable
75+
case "$rust-$target" in
76+
stable-x86_64-*freebsd*) do_freebsd_checks=1 ;;
77+
nightly-i686*freebsd*) do_freebsd_checks=1 ;;
78+
esac
79+
80+
if [ -n "${do_freebsd_checks:-}" ]; then
81+
for version in $freebsd_versions; do
82+
export RUST_LIBC_UNSTABLE_FREEBSD_VERSION="$version"
83+
$cmd
84+
$cmd --no-default-features
85+
done
86+
fi
7187
}
7288

89+
freebsd_versions="\
90+
11 \
91+
12 \
92+
13 \
93+
14 \
94+
15 \
95+
"
96+
7397
rust_linux_targets="\
7498
aarch64-linux-android \
7599
aarch64-unknown-linux-gnu \
@@ -244,21 +268,19 @@ for target in $targets; do
244268
if echo "$target" | grep -q "$filter"; then
245269
if [ "$os" = "windows" ]; then
246270
TARGET="$target" ./ci/install-rust.sh
247-
test_target "$target"
248-
else
249-
# `wasm32-wasip1` was renamed from `wasm32-wasi`
250-
if [ "$target" = "wasm32-wasip1" ] && [ "$supports_wasi_pn" = "0" ]; then
251-
target="wasm32-wasi"
252-
fi
271+
fi
253272

254-
# `wasm32-wasip2` only exists in recent versions of Rust
255-
if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then
256-
continue
257-
fi
258-
259-
test_target "$target"
273+
# `wasm32-wasip1` was renamed from `wasm32-wasi`
274+
if [ "$target" = "wasm32-wasip1" ] && [ "$supports_wasi_pn" = "0" ]; then
275+
target="wasm32-wasi"
260276
fi
261277

278+
# `wasm32-wasip2` only exists in recent versions of Rust
279+
if [ "$target" = "wasm32-wasip2" ] && [ "$supports_wasi_pn" = "0" ]; then
280+
continue
281+
fi
282+
283+
test_target "$target"
262284
test_run=1
263285
fi
264286
done
@@ -267,11 +289,9 @@ for target in ${no_dist_targets:-}; do
267289
if echo "$target" | grep -q "$filter"; then
268290
if [ "$os" = "windows" ]; then
269291
TARGET="$target" ./ci/install-rust.sh
270-
test_target "$target" 1
271-
else
272-
test_target "$target" 1
273292
fi
274293

294+
test_target "$target" 1
275295
test_run=1
276296
fi
277297
done

libc-test/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4734,9 +4734,16 @@ fn test_linux_like_apis(target: &str) {
47344734
}
47354735

47364736
fn which_freebsd() -> Option<i32> {
4737+
if let Ok(version) = env::var("RUST_LIBC_UNSTABLE_FREEBSD_VERSION") {
4738+
let vers = version.parse().unwrap();
4739+
println!("cargo:warning=setting FreeBSD version to {vers}");
4740+
return Some(vers);
4741+
}
4742+
47374743
let output = std::process::Command::new("freebsd-version")
47384744
.output()
47394745
.ok()?;
4746+
47404747
if !output.status.success() {
47414748
return None;
47424749
}

libc-test/semver/solarish.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ LIO_WRITE
1717
PIPE_BUF
1818
SIGEV_PORT
1919
_POSIX_VDISABLE
20+
_ST_FSTYPSZ
2021
aio_cancel
2122
aio_error
2223
aio_fsync

src/fuchsia/aarch64.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use crate::{c_int, c_long, c_uint, c_ulong, c_ulonglong, c_ushort, off_t, size_t};
1+
use crate::off_t;
2+
use crate::prelude::*;
23

34
pub type c_char = u8;
45
pub type __u64 = c_ulonglong;

0 commit comments

Comments
 (0)