Skip to content

Commit 15018f7

Browse files
committed
chore: use rust-toolchain.toml for default toolchain
1 parent 664369c commit 15018f7

File tree

10 files changed

+297
-309
lines changed

10 files changed

+297
-309
lines changed

Makefile

Lines changed: 259 additions & 281 deletions
Large diffs are not rendered by default.
File renamed without changes.

rust-toolchain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[toolchain]
2+
channel = "stable"

scripts/check_memory_errors.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ if [[ "${RUN_VALGRIND}" == "0" && "${RUN_COMPUTE_SANITIZER}" == "0" ]]; then
2828
fi
2929

3030
# List the tests into a temporary file
31-
RUSTFLAGS="$RUSTFLAGS" cargo "${CARGO_RS_BUILD_TOOLCHAIN}" nextest list --cargo-profile "${CARGO_PROFILE}" \
31+
RUSTFLAGS="$RUSTFLAGS" cargo nextest list --cargo-profile "${CARGO_PROFILE}" \
3232
--features=integer,internal-keycache,gpu-debug,zk-pok -p "${TFHE_SPEC}" &> /tmp/test_list.txt
3333

3434
# Filter the tests to get only the HL ones
3535
TESTS_HL=$(sed -e $'s/\x1b\[[0-9;]*m//g' < /tmp/test_list.txt | grep 'high_level_api::.*gpu.*' )
3636

3737
if [[ "${RUN_VALGRIND}" == "1" ]]; then
3838
# Build the tests but don't run them
39-
RUSTFLAGS="$RUSTFLAGS" cargo "${CARGO_RS_BUILD_TOOLCHAIN}" test --no-run --profile "${CARGO_PROFILE}" \
39+
RUSTFLAGS="$RUSTFLAGS" cargo test --no-run --profile "${CARGO_PROFILE}" \
4040
--features=integer,internal-keycache,gpu-debug,zk-pok -p "${TFHE_SPEC}"
4141

4242
# Find the test executable -> last one to have been modified
@@ -61,7 +61,7 @@ TESTS_HL=$(sed -e $'s/\x1b\[[0-9;]*m//g' < /tmp/test_list.txt | grep 'high_leve
6161

6262
if [[ "${RUN_COMPUTE_SANITIZER}" == "1" ]]; then
6363
# Build the tests but don't run them
64-
RUSTFLAGS="$RUSTFLAGS" cargo "${CARGO_RS_BUILD_TOOLCHAIN}" test --no-run --profile "${CARGO_PROFILE}" \
64+
RUSTFLAGS="$RUSTFLAGS" cargo test --no-run --profile "${CARGO_PROFILE}" \
6565
--features=integer,internal-keycache,gpu,zk-pok -p "${TFHE_SPEC}"
6666

6767
# Find the test executable -> last one to have been modified

scripts/install_typos.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
rust_toolchain=""
5+
rust_toolchain=
66
required_typos_version=""
77

88
function usage() {
@@ -35,12 +35,14 @@ do
3535
shift
3636
done
3737

38-
if [[ "${rust_toolchain::1}" != "+" ]]; then
39-
rust_toolchain="+${rust_toolchain}"
38+
if [ -n "${rust_toolchain}" ]; then
39+
if [[ "${rust_toolchain::1}" != "+" ]]; then
40+
rust_toolchain="+${rust_toolchain}"
41+
fi
4042
fi
4143

4244
if ! which typos ; then
43-
cargo "${rust_toolchain}" install --locked typos-cli --version ~"${required_typos_version}" || \
45+
eval cargo "${rust_toolchain}" install --locked typos-cli --version ~"${required_typos_version}" || \
4446
( echo "Unable to install typos-cli, unknown error." && exit 1 )
4547

4648
exit 0
@@ -59,6 +61,6 @@ if [[ "${ver_major}" -gt "${min_ver_major}" ]]; then
5961
elif [[ "${ver_major}" -eq "${min_ver_major}" ]] && [[ "${ver_minor}" -ge "${min_ver_minor}" ]]; then
6062
exit 0
6163
else
62-
cargo "${rust_toolchain}" install --locked typos-cli --version ~"${required_typos_version}" || \
64+
eval cargo "${rust_toolchain}" install --locked typos-cli --version ~"${required_typos_version}" || \
6365
( echo "Unable to install typos-cli, unknown error." && exit 1 )
6466
fi

scripts/install_zizmor.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ do
3535
shift
3636
done
3737

38-
if [[ "${rust_toolchain::1}" != "+" ]]; then
39-
rust_toolchain="+${rust_toolchain}"
38+
if [ -n "${rust_toolchain}" ]; then
39+
if [[ "${rust_toolchain::1}" != "+" ]]; then
40+
rust_toolchain="+${rust_toolchain}"
41+
fi
4042
fi
4143

4244
if ! which zizmor ; then
43-
cargo "${rust_toolchain}" install --locked zizmor --version ~"${required_zizmor_version}" || \
45+
eval cargo "${rust_toolchain}" install --locked zizmor --version ~"${required_zizmor_version}" || \
4446
( echo "Unable to install zizmor, unknown error." && exit 1 )
4547

4648
exit 0
@@ -59,6 +61,6 @@ if [[ "${ver_major}" -gt "${min_ver_major}" ]]; then
5961
elif [[ "${ver_major}" -eq "${min_ver_major}" ]] && [[ "${ver_minor}" -ge "${min_ver_minor}" ]]; then
6062
exit 0
6163
else
62-
cargo "${rust_toolchain}" install --locked zizmor --version ~"${required_zizmor_version}" || \
64+
eval cargo "${rust_toolchain}" install --locked zizmor --version ~"${required_zizmor_version}" || \
6365
( echo "Unable to install zizmor, unknown error." && exit 1 )
6466
fi

scripts/integer-tests.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/usr/bin/env bash
22

33
set -e
4+
set -x
45

56
function usage() {
67
echo "$0: integer test runner"
@@ -20,7 +21,7 @@ function usage() {
2021
echo
2122
}
2223

23-
RUST_TOOLCHAIN="+stable"
24+
RUST_TOOLCHAIN=""
2425
multi_bit_argument=
2526
sign_argument=
2627
fast_tests_argument=
@@ -88,8 +89,10 @@ do
8889
shift
8990
done
9091

91-
if [[ "${RUST_TOOLCHAIN::1}" != "+" ]]; then
92-
RUST_TOOLCHAIN="+${RUST_TOOLCHAIN}"
92+
if [ -n "${RUST_TOOLCHAIN}" ]; then
93+
if [[ "${RUST_TOOLCHAIN::1}" != "+" ]]; then
94+
RUST_TOOLCHAIN="+${RUST_TOOLCHAIN}"
95+
fi
9396
fi
9497

9598
if [[ "${FAST_TESTS}" == TRUE ]]; then
@@ -168,7 +171,7 @@ fi
168171

169172
echo "${filter_expression}"
170173

171-
cargo "${RUST_TOOLCHAIN}" nextest run \
174+
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest run \
172175
--tests \
173176
--cargo-profile "${cargo_profile}" \
174177
--package "${tfhe_package}" \
@@ -179,7 +182,7 @@ cargo "${RUST_TOOLCHAIN}" nextest run \
179182
-E "$filter_expression"
180183

181184
if [[ -z ${multi_bit_argument} && -z ${long_tests_argument} ]]; then
182-
cargo "${RUST_TOOLCHAIN}" test \
185+
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} test \
183186
--profile "${cargo_profile}" \
184187
--package "${tfhe_package}" \
185188
--no-default-features \

scripts/shortint-tests.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ function usage() {
1313
echo
1414
}
1515

16-
RUST_TOOLCHAIN="+stable"
16+
RUST_TOOLCHAIN=""
1717
multi_bit=""
1818
multi_bit_argument=
1919
fast_tests_argument=
@@ -56,8 +56,10 @@ do
5656
shift
5757
done
5858

59-
if [[ "${RUST_TOOLCHAIN::1}" != "+" ]]; then
60-
RUST_TOOLCHAIN="+${RUST_TOOLCHAIN}"
59+
if [ -n "${RUST_TOOLCHAIN}" ]; then
60+
if [[ "${RUST_TOOLCHAIN::1}" != "+" ]]; then
61+
RUST_TOOLCHAIN="+${RUST_TOOLCHAIN}"
62+
fi
6163
fi
6264

6365
if [[ "${FAST_TESTS}" == TRUE ]]; then
@@ -88,7 +90,7 @@ if [[ "${BIG_TESTS_INSTANCE}" != TRUE ]]; then
8890
filter_expression_small_params=$(/usr/bin/python3 scripts/test_filtering.py --layer shortint ${fast_tests_argument} ${multi_bit_argument})
8991

9092
# Run tests only no examples or benches with small params and more threads
91-
cargo "${RUST_TOOLCHAIN}" nextest run \
93+
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest run \
9294
--tests \
9395
--cargo-profile "${cargo_profile}" \
9496
--package "${tfhe_package}" \
@@ -105,7 +107,7 @@ if [[ "${BIG_TESTS_INSTANCE}" != TRUE ]]; then
105107
and not test(~smart_add_and_mul)"""
106108

107109
# Run tests only no examples or benches with big params and less threads
108-
cargo "${RUST_TOOLCHAIN}" nextest run \
110+
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest run \
109111
--tests \
110112
--cargo-profile "${cargo_profile}" \
111113
--package "${tfhe_package}" \
@@ -116,7 +118,7 @@ and not test(~smart_add_and_mul)"""
116118
-E "${filter_expression_big_params}"
117119

118120
if [[ "${multi_bit}" == "" ]]; then
119-
cargo "${RUST_TOOLCHAIN}" test \
121+
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} test \
120122
--profile "${cargo_profile}" \
121123
--package "${tfhe_package}" \
122124
--features=shortint,internal-keycache,zk-pok,experimental \
@@ -128,17 +130,17 @@ else
128130
filter_expression=$(/usr/bin/python3 scripts/test_filtering.py --layer shortint --big-instance ${fast_tests_argument} ${multi_bit_argument})
129131

130132
# Run tests only no examples or benches with small params and more threads
131-
cargo "${RUST_TOOLCHAIN}" nextest run \
133+
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} nextest run \
132134
--tests \
133135
--cargo-profile "${cargo_profile}" \
134136
--package "${tfhe_package}" \
135137
--profile ci \
136138
--features=shortint,internal-keycache,experimental \
137139
--test-threads "${n_threads_big}" \
138-
-E "${filter_expression}"
140+
-E "$filter_expression"
139141

140142
if [[ "${multi_bit}" == "" ]]; then
141-
cargo "${RUST_TOOLCHAIN}" test \
143+
cargo ${RUST_TOOLCHAIN:+"$RUST_TOOLCHAIN"} test \
142144
--profile "${cargo_profile}" \
143145
--package "${tfhe_package}" \
144146
--features=shortint,internal-keycache,experimental \

tfhe/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
#![allow(clippy::iter_with_drain)] // 2
6868
#![allow(clippy::large_stack_frames)] // 1
6969
#![cfg_attr(feature = "__wasm_api", allow(dead_code))]
70-
#![cfg_attr(all(doc, not(doctest)), feature(doc_cfg))]
7170
// Weird clippy lint triggering without any code location
7271
#![cfg_attr(test, allow(clippy::large_stack_arrays))]
7372

utils/param_dedup/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn main() {
330330
);
331331

332332
let formatting_toolchain = {
333-
let tmp = fs::read_to_string("toolchain.txt").unwrap();
333+
let tmp = fs::read_to_string("nightly-toolchain.txt").unwrap();
334334
let tmp = tmp.trim();
335335
format!("+{tmp}")
336336
};

0 commit comments

Comments
 (0)