Skip to content

Commit 8f47a06

Browse files
committed
Migrate testcrate and panic-handler to edition 2024
Includes `extern` -> `unsafe extern` blocks and formatting updates.
1 parent 56cfe97 commit 8f47a06

15 files changed

+20
-15
lines changed

crates/panic-handler/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "panic-handler"
33
version = "0.1.0"
44
authors = ["Alex Crichton <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

testcrate/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "testcrate"
33
version = "0.1.0"
44
authors = ["Alex Crichton <[email protected]>"]
5-
edition = "2021"
5+
edition = "2024"
66
publish = false
77

88
[lib]

testcrate/benches/float_add.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(f128_enabled, feature(f128))]
22

33
use compiler_builtins::float::add;
4-
use criterion::{criterion_main, Criterion};
4+
use criterion::{Criterion, criterion_main};
55
use testcrate::float_bench;
66

77
float_bench! {

testcrate/benches/float_cmp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![cfg_attr(f128_enabled, feature(f128))]
22

3-
use criterion::{criterion_main, Criterion};
3+
use criterion::{Criterion, criterion_main};
44
use testcrate::float_bench;
55

66
use compiler_builtins::float::cmp;

testcrate/benches/float_conv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![cfg_attr(f128_enabled, feature(f128))]
33

44
use compiler_builtins::float::conv;
5-
use criterion::{criterion_main, Criterion};
5+
use criterion::{Criterion, criterion_main};
66
use testcrate::float_bench;
77

88
/* unsigned int -> float */

testcrate/benches/float_div.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(f128_enabled, feature(f128))]
22

33
use compiler_builtins::float::div;
4-
use criterion::{criterion_main, Criterion};
4+
use criterion::{Criterion, criterion_main};
55
use testcrate::float_bench;
66

77
float_bench! {

testcrate/benches/float_extend.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#![cfg_attr(f16_enabled, feature(f16))]
44

55
use compiler_builtins::float::extend;
6-
use criterion::{criterion_main, Criterion};
6+
use criterion::{Criterion, criterion_main};
77
use testcrate::float_bench;
88

99
#[cfg(f16_enabled)]

testcrate/benches/float_mul.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(f128_enabled, feature(f128))]
22

33
use compiler_builtins::float::mul;
4-
use criterion::{criterion_main, Criterion};
4+
use criterion::{Criterion, criterion_main};
55
use testcrate::float_bench;
66

77
float_bench! {

testcrate/benches/float_pow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(f128_enabled, feature(f128))]
22

33
use compiler_builtins::float::pow;
4-
use criterion::{criterion_main, Criterion};
4+
use criterion::{Criterion, criterion_main};
55
use testcrate::float_bench;
66

77
float_bench! {

testcrate/benches/float_sub.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![cfg_attr(f128_enabled, feature(f128))]
22

33
use compiler_builtins::float::sub;
4-
use criterion::{criterion_main, Criterion};
4+
use criterion::{Criterion, criterion_main};
55
use testcrate::float_bench;
66

77
float_bench! {

testcrate/benches/float_trunc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![cfg_attr(f16_enabled, feature(f16))]
33

44
use compiler_builtins::float::trunc;
5-
use criterion::{criterion_main, Criterion};
5+
use criterion::{Criterion, criterion_main};
66
use testcrate::float_bench;
77

88
#[cfg(f16_enabled)]

testcrate/benches/mem.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#![feature(test)]
22

33
extern crate test;
4-
use test::{black_box, Bencher};
4+
use test::{Bencher, black_box};
55

66
extern crate compiler_builtins;
77
use compiler_builtins::mem::{memcmp, memcpy, memmove, memset};

testcrate/src/bench.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ pub fn skip_asm_checks(_test_name: &str) -> bool {
8989

9090
/// Create a comparison of the system symbol, compiler_builtins, and optionally handwritten
9191
/// assembly.
92+
///
93+
/// # Safety
94+
///
95+
/// The signature must be correct and any assembly must be sound.
9296
#[macro_export]
9397
macro_rules! float_bench {
9498
(
@@ -120,8 +124,9 @@ macro_rules! float_bench {
120124
]
121125
$(,)?
122126
) => {paste::paste! {
127+
// SAFETY: macro invocation must use the correct signature
123128
#[cfg($sys_available)]
124-
extern "C" {
129+
unsafe extern "C" {
125130
/// Binding for the system function
126131
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
127132
fn $sys_fn($($arg: $arg_ty),*) -> $ret_ty;

testcrate/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ extern crate alloc;
2222
use compiler_builtins::float::Float;
2323
use compiler_builtins::int::{Int, MinInt};
2424

25-
use rand_xoshiro::rand_core::{RngCore, SeedableRng};
2625
use rand_xoshiro::Xoshiro128StarStar;
26+
use rand_xoshiro::rand_core::{RngCore, SeedableRng};
2727

2828
/// Sets the number of fuzz iterations run for most tests. In practice, the vast majority of bugs
2929
/// are caught by the edge case testers. Most of the remaining bugs triggered by more complex

testcrate/tests/big.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use compiler_builtins::int::{i256, u256, HInt, MinInt};
1+
use compiler_builtins::int::{HInt, MinInt, i256, u256};
22

33
const LOHI_SPLIT: u128 = 0xaaaaaaaaaaaaaaaaffffffffffffffff;
44

0 commit comments

Comments
 (0)