Skip to content

Commit 82d18e7

Browse files
authored
update to Rust 1.93 (#186)
* update to Rust 1.93 * sort test results * remove non-deterministic thread numbers from output
1 parent 5081b24 commit 82d18e7

File tree

3 files changed

+85
-26
lines changed

3 files changed

+85
-26
lines changed

Dockerfile

Lines changed: 51 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# always build this using the latest stable release
2-
FROM rust:1.88.0 AS build-base
2+
FROM rust:1.93.0 AS build-base
33

44
ARG JQ_VERSION=1.6
55
ARG JQ_URL=https://github.com/stedolan/jq/releases/download/jq-${JQ_VERSION}/jq-linux64
@@ -48,51 +48,84 @@ RUN cargo generate-lockfile && cargo local-registry --sync Cargo.lock .
4848
# version tag with a nightly one, pinned to a specific date.
4949

5050
# official Dockerfile source:
51-
# https://github.com/rust-lang/docker-rust/blob/master/stable/bookworm/slim/Dockerfile
51+
# https://github.com/rust-lang/docker-rust/blob/master/stable/trixie/slim/Dockerfile
5252

5353
################ start-copy-pasta ################
5454

55-
FROM debian:bookworm-slim
55+
FROM debian:trixie-slim
56+
57+
LABEL org.opencontainers.image.source=https://github.com/rust-lang/docker-rust
5658

5759
ENV RUSTUP_HOME=/usr/local/rustup \
5860
CARGO_HOME=/usr/local/cargo \
5961
PATH=/usr/local/cargo/bin:$PATH \
60-
RUST_VERSION=nightly-2025-06-28
62+
RUST_VERSION=nightly-2026-01-22
6163
# ~~~~~~~~^~~~~~~~~~
6264
# pin version here
6365

6466
RUN set -eux; \
67+
\
6568
apt-get update; \
6669
apt-get install -y --no-install-recommends \
6770
ca-certificates \
6871
gcc \
6972
libc6-dev \
7073
wget \
7174
; \
72-
dpkgArch="$(dpkg --print-architecture)"; \
73-
case "${dpkgArch##*-}" in \
74-
amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='20a06e644b0d9bd2fbdbfd52d42540bdde820ea7df86e92e533c073da0cdd43c' ;; \
75-
armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='3b8daab6cc3135f2cd4b12919559e6adaee73a2fbefb830fadf0405c20231d61' ;; \
76-
arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='e3853c5a252fca15252d07cb23a1bdd9377a8c6f3efa01531109281ae47f841c' ;; \
77-
i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='a5db2c4b29d23e9b318b955dd0337d6b52e93933608469085c924e0d05b1df1f' ;; \
78-
ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='acd89c42b47c93bd4266163a7b05d3f26287d5148413c0d47b2e8a7aa67c9dc0' ;; \
79-
s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='726b7fd5d8805e73eab4a024a2889f8859d5a44e36041abac0a2436a52d42572' ;; \
80-
*) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \
75+
\
76+
arch="$(dpkg --print-architecture)"; \
77+
case "$arch" in \
78+
'amd64') \
79+
rustArch='x86_64-unknown-linux-gnu'; \
80+
rustupSha256='20a06e644b0d9bd2fbdbfd52d42540bdde820ea7df86e92e533c073da0cdd43c'; \
81+
;; \
82+
'armhf') \
83+
rustArch='armv7-unknown-linux-gnueabihf'; \
84+
rustupSha256='3b8daab6cc3135f2cd4b12919559e6adaee73a2fbefb830fadf0405c20231d61'; \
85+
;; \
86+
'arm64') \
87+
rustArch='aarch64-unknown-linux-gnu'; \
88+
rustupSha256='e3853c5a252fca15252d07cb23a1bdd9377a8c6f3efa01531109281ae47f841c'; \
89+
;; \
90+
'i386') \
91+
rustArch='i686-unknown-linux-gnu'; \
92+
rustupSha256='a5db2c4b29d23e9b318b955dd0337d6b52e93933608469085c924e0d05b1df1f'; \
93+
;; \
94+
'ppc64el') \
95+
rustArch='powerpc64le-unknown-linux-gnu'; \
96+
rustupSha256='acd89c42b47c93bd4266163a7b05d3f26287d5148413c0d47b2e8a7aa67c9dc0'; \
97+
;; \
98+
's390x') \
99+
rustArch='s390x-unknown-linux-gnu'; \
100+
rustupSha256='726b7fd5d8805e73eab4a024a2889f8859d5a44e36041abac0a2436a52d42572'; \
101+
;; \
102+
'riscv64') \
103+
rustArch='riscv64gc-unknown-linux-gnu'; \
104+
rustupSha256='09e64cc1b7a3e99adaa15dd2d46a3aad9d44d71041e2a96100d165c98a8fd7a7'; \
105+
;; \
106+
*) \
107+
echo >&2 "unsupported architecture: $arch"; \
108+
exit 1; \
109+
;; \
81110
esac; \
111+
\
82112
url="https://static.rust-lang.org/rustup/archive/1.28.2/${rustArch}/rustup-init"; \
83-
wget "$url"; \
113+
wget --progress=dot:giga "$url"; \
84114
echo "${rustupSha256} *rustup-init" | sha256sum -c -; \
115+
\
85116
chmod +x rustup-init; \
86117
./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \
87118
rm rustup-init; \
88119
chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \
89-
rustup --version; \
90-
cargo --version; \
91-
rustc --version; \
120+
\
92121
apt-get remove -y --auto-remove \
93122
wget \
94123
; \
95-
rm -rf /var/lib/apt/lists/*;
124+
rm -rf /var/lib/apt/lists/*; \
125+
\
126+
rustup --version; \
127+
cargo --version; \
128+
rustc --version;
96129

97130
################ end-copy-pasta ################
98131

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ where
6969
}
7070
}
7171
}
72+
out.tests.sort();
7273
out
7374
}
7475

src/output.rs

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
use std::sync::LazyLock;
2+
13
use crate::test_name_formatter::format_test_name;
4+
use regex::Regex;
25
use serde::{Deserialize, Serialize};
36

47
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
@@ -19,6 +22,9 @@ pub struct TestResult {
1922
pub output: Option<String>,
2023
}
2124

25+
static THREAD_PANICKED_REGEX: LazyLock<Regex> =
26+
LazyLock::new(|| Regex::new(r"thread '(?<testname>.*)' \(.*\) panicked at").unwrap());
27+
2228
impl TestResult {
2329
pub fn ok(name: String, test_code: String) -> TestResult {
2430
TestResult {
@@ -40,16 +46,19 @@ impl TestResult {
4046
_ => (None, message.map(|m| m.trim_start().to_owned())),
4147
};
4248

43-
// This note is attached to the error message of only one test case that fails,
44-
// but not always the same one. To avoid CI failing unnecessarily, this note
45-
// is stripped from all messages.
46-
// It's also not useful to students reading the output of the test runner,
47-
// as they can't set this environment variable in the test runner themselves.
4849
let message = message.map(|m| {
49-
m.trim_end_matches(
50+
// This note is attached to the error message of only one test case that fails,
51+
// but not always the same one. To avoid CI failing unnecessarily, this note
52+
// is stripped from all messages.
53+
// It's also not useful to students reading the output of the test runner,
54+
// as they can't set this environment variable in the test runner themselves.
55+
let m = m.trim_end_matches(
5056
"note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace\n",
51-
)
52-
.to_owned()
57+
);
58+
// If the test panics, the message contains a thread number that's
59+
// not deterministic. Strip it to improve test reliability.
60+
let m = THREAD_PANICKED_REGEX.replace(m, "thread '$testname' panicked at");
61+
m.to_string()
5362
});
5463

5564
TestResult {
@@ -62,6 +71,22 @@ impl TestResult {
6271
}
6372
}
6473

74+
impl PartialOrd for TestResult {
75+
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
76+
Some(self.cmp(other))
77+
}
78+
}
79+
80+
impl Ord for TestResult {
81+
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
82+
match self.name.cmp(&other.name) {
83+
core::cmp::Ordering::Equal => {}
84+
ord => return ord,
85+
}
86+
self.test_code.cmp(&other.test_code)
87+
}
88+
}
89+
6590
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
6691
pub struct Output {
6792
pub version: u8,

0 commit comments

Comments
 (0)