Skip to content

Commit cd108ab

Browse files
ehussgitbot
authored and
gitbot
committed
Migrate coretests to Rust 2024
1 parent bcf9e35 commit cd108ab

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

coretests/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ repository = "https://github.com/rust-lang/rust.git"
66
description = "Tests for the Rust Core Library"
77
autotests = false
88
autobenches = false
9-
edition = "2021"
9+
edition = "2024"
1010

1111
[lib]
1212
path = "lib.rs"

coretests/benches/slice.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn binary_search_l3_worst_case(b: &mut Bencher) {
9494
struct Rgb(#[allow(dead_code)] u8, #[allow(dead_code)] u8, #[allow(dead_code)] u8);
9595

9696
impl Rgb {
97-
fn gen(i: usize) -> Self {
97+
fn new(i: usize) -> Self {
9898
Rgb(i as u8, (i as u8).wrapping_add(7), (i as u8).wrapping_add(42))
9999
}
100100
}
@@ -115,7 +115,7 @@ macro_rules! rotate {
115115
}
116116

117117
rotate!(rotate_u8, 32, |i| i as u8);
118-
rotate!(rotate_rgb, 32, Rgb::gen);
118+
rotate!(rotate_rgb, 32, Rgb::new);
119119
rotate!(rotate_usize, 32, |i| i);
120120
rotate!(rotate_16_usize_4, 16, |i| [i; 4]);
121121
rotate!(rotate_16_usize_5, 16, |i| [i; 5]);
@@ -142,8 +142,8 @@ macro_rules! swap_with_slice {
142142

143143
swap_with_slice!(swap_with_slice_u8_30, 30, |i| i as u8);
144144
swap_with_slice!(swap_with_slice_u8_3000, 3000, |i| i as u8);
145-
swap_with_slice!(swap_with_slice_rgb_30, 30, Rgb::gen);
146-
swap_with_slice!(swap_with_slice_rgb_3000, 3000, Rgb::gen);
145+
swap_with_slice!(swap_with_slice_rgb_30, 30, Rgb::new);
146+
swap_with_slice!(swap_with_slice_rgb_3000, 3000, Rgb::new);
147147
swap_with_slice!(swap_with_slice_usize_30, 30, |i| i);
148148
swap_with_slice!(swap_with_slice_usize_3000, 3000, |i| i);
149149
swap_with_slice!(swap_with_slice_4x_usize_30, 30, |i| [i; 4]);

coretests/tests/io/borrowed_buf.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn cursor_set_init() {
145145
assert_eq!(rbuf.unfilled().init_ref().len(), 8);
146146
assert_eq!(rbuf.unfilled().init_mut().len(), 8);
147147
assert_eq!(rbuf.unfilled().uninit_mut().len(), 8);
148-
assert_eq!(unsafe { rbuf.unfilled().as_mut() }.len(), 16);
148+
assert_eq!(unsafe { rbuf.unfilled().as_mut().len() }, 16);
149149

150150
rbuf.unfilled().advance(4);
151151

@@ -163,5 +163,5 @@ fn cursor_set_init() {
163163
assert_eq!(rbuf.unfilled().init_ref().len(), 8);
164164
assert_eq!(rbuf.unfilled().init_mut().len(), 8);
165165
assert_eq!(rbuf.unfilled().uninit_mut().len(), 4);
166-
assert_eq!(unsafe { rbuf.unfilled().as_mut() }.len(), 12);
166+
assert_eq!(unsafe { rbuf.unfilled().as_mut().len() }, 12);
167167
}

coretests/tests/pin.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ fn pin_const() {
2828
const fn pin_mut_const() {
2929
let _ = Pin::new(&mut 2).into_ref();
3030
let _ = Pin::new(&mut 2).get_mut();
31-
let _ = unsafe { Pin::new(&mut 2).get_unchecked_mut() };
31+
unsafe {
32+
let _ = Pin::new(&mut 2).get_unchecked_mut();
33+
}
3234
}
3335

3436
pin_mut_const();

0 commit comments

Comments
 (0)