diff options
| author | Eric Huss <eric@huss.org> | 2025-02-11 14:47:42 -0800 |
|---|---|---|
| committer | Eric Huss <eric@huss.org> | 2025-02-13 13:10:21 -0800 |
| commit | 0aa634e71a6c1b4d4866218bc3d543b3189615a6 (patch) | |
| tree | a7e3aec32b8a16b2e78314c1b5fcecb17c3d73bb | |
| parent | b7c975b22e557e41c5110006c371018ef310691a (diff) | |
| download | rust-0aa634e71a6c1b4d4866218bc3d543b3189615a6.tar.gz rust-0aa634e71a6c1b4d4866218bc3d543b3189615a6.zip | |
Migrate coretests to Rust 2024
| -rw-r--r-- | library/coretests/Cargo.toml | 2 | ||||
| -rw-r--r-- | library/coretests/benches/slice.rs | 8 | ||||
| -rw-r--r-- | library/coretests/tests/io/borrowed_buf.rs | 4 | ||||
| -rw-r--r-- | library/coretests/tests/pin.rs | 4 |
4 files changed, 10 insertions, 8 deletions
diff --git a/library/coretests/Cargo.toml b/library/coretests/Cargo.toml index 1ad29f5e51d..e44f01d347b 100644 --- a/library/coretests/Cargo.toml +++ b/library/coretests/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/rust-lang/rust.git" description = "Tests for the Rust Core Library" autotests = false autobenches = false -edition = "2021" +edition = "2024" [lib] path = "lib.rs" diff --git a/library/coretests/benches/slice.rs b/library/coretests/benches/slice.rs index 29a66b62199..71027981d94 100644 --- a/library/coretests/benches/slice.rs +++ b/library/coretests/benches/slice.rs @@ -94,7 +94,7 @@ fn binary_search_l3_worst_case(b: &mut Bencher) { struct Rgb(#[allow(dead_code)] u8, #[allow(dead_code)] u8, #[allow(dead_code)] u8); impl Rgb { - fn gen(i: usize) -> Self { + fn new(i: usize) -> Self { Rgb(i as u8, (i as u8).wrapping_add(7), (i as u8).wrapping_add(42)) } } @@ -115,7 +115,7 @@ macro_rules! rotate { } rotate!(rotate_u8, 32, |i| i as u8); -rotate!(rotate_rgb, 32, Rgb::gen); +rotate!(rotate_rgb, 32, Rgb::new); rotate!(rotate_usize, 32, |i| i); rotate!(rotate_16_usize_4, 16, |i| [i; 4]); rotate!(rotate_16_usize_5, 16, |i| [i; 5]); @@ -142,8 +142,8 @@ macro_rules! swap_with_slice { swap_with_slice!(swap_with_slice_u8_30, 30, |i| i as u8); swap_with_slice!(swap_with_slice_u8_3000, 3000, |i| i as u8); -swap_with_slice!(swap_with_slice_rgb_30, 30, Rgb::gen); -swap_with_slice!(swap_with_slice_rgb_3000, 3000, Rgb::gen); +swap_with_slice!(swap_with_slice_rgb_30, 30, Rgb::new); +swap_with_slice!(swap_with_slice_rgb_3000, 3000, Rgb::new); swap_with_slice!(swap_with_slice_usize_30, 30, |i| i); swap_with_slice!(swap_with_slice_usize_3000, 3000, |i| i); swap_with_slice!(swap_with_slice_4x_usize_30, 30, |i| [i; 4]); diff --git a/library/coretests/tests/io/borrowed_buf.rs b/library/coretests/tests/io/borrowed_buf.rs index a5dd4e52577..fbd3864dcac 100644 --- a/library/coretests/tests/io/borrowed_buf.rs +++ b/library/coretests/tests/io/borrowed_buf.rs @@ -145,7 +145,7 @@ fn cursor_set_init() { assert_eq!(rbuf.unfilled().init_ref().len(), 8); assert_eq!(rbuf.unfilled().init_mut().len(), 8); assert_eq!(rbuf.unfilled().uninit_mut().len(), 8); - assert_eq!(unsafe { rbuf.unfilled().as_mut() }.len(), 16); + assert_eq!(unsafe { rbuf.unfilled().as_mut().len() }, 16); rbuf.unfilled().advance(4); @@ -163,5 +163,5 @@ fn cursor_set_init() { assert_eq!(rbuf.unfilled().init_ref().len(), 8); assert_eq!(rbuf.unfilled().init_mut().len(), 8); assert_eq!(rbuf.unfilled().uninit_mut().len(), 4); - assert_eq!(unsafe { rbuf.unfilled().as_mut() }.len(), 12); + assert_eq!(unsafe { rbuf.unfilled().as_mut().len() }, 12); } diff --git a/library/coretests/tests/pin.rs b/library/coretests/tests/pin.rs index 026d2ca8de2..b3fb06e710d 100644 --- a/library/coretests/tests/pin.rs +++ b/library/coretests/tests/pin.rs @@ -28,7 +28,9 @@ fn pin_const() { const fn pin_mut_const() { let _ = Pin::new(&mut 2).into_ref(); let _ = Pin::new(&mut 2).get_mut(); - let _ = unsafe { Pin::new(&mut 2).get_unchecked_mut() }; + unsafe { + let _ = Pin::new(&mut 2).get_unchecked_mut(); + } } pin_mut_const(); |
