about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorantoyo <antoyo@users.noreply.github.com>2025-04-25 10:41:04 -0400
committerGitHub <noreply@github.com>2025-04-25 10:41:04 -0400
commit4f83a4258deb99f3288a7122c0d5a78200931c61 (patch)
treece795fcd2476b2afc049347b0646dcfaeed1e4de /tests
parentdb1a31c243a649e1fe20f5466ba181da5be35c14 (diff)
parent9059f8cd7c312d55a78cbf32ddf0729032993a9d (diff)
downloadrust-4f83a4258deb99f3288a7122c0d5a78200931c61.tar.gz
rust-4f83a4258deb99f3288a7122c0d5a78200931c61.zip
Merge pull request #652 from rust-lang/sync_from_rust_2025_04_25_2
Sync from rust 2025/04/25
Diffstat (limited to 'tests')
-rw-r--r--tests/lang_tests_common.rs2
-rw-r--r--tests/run/ptr_cast.rs21
2 files changed, 18 insertions, 5 deletions
diff --git a/tests/lang_tests_common.rs b/tests/lang_tests_common.rs
index 64c932a2658..d5a0d71c4b2 100644
--- a/tests/lang_tests_common.rs
+++ b/tests/lang_tests_common.rs
@@ -1,5 +1,7 @@
 //! The common code for `tests/lang_tests_*.rs`
 
+#![allow(clippy::uninlined_format_args)]
+
 use std::env::{self, current_dir};
 use std::path::{Path, PathBuf};
 use std::process::Command;
diff --git a/tests/run/ptr_cast.rs b/tests/run/ptr_cast.rs
index 9551fea403c..e627886a9d5 100644
--- a/tests/run/ptr_cast.rs
+++ b/tests/run/ptr_cast.rs
@@ -2,7 +2,10 @@
 //
 // Run-time:
 //   status: 0
-//   stdout: 1
+//   stdout: 10
+//     10
+//     42
+//     1
 
 #![feature(no_core)]
 #![no_std]
@@ -12,15 +15,23 @@
 extern crate mini_core;
 use mini_core::*;
 
-static mut ONE: usize = 1;
-
-fn make_array() -> [u8; 3] {
-    [42, 10, 5]
+fn int_cast(a: u16, b: i16) -> (u8, u16, u32, usize, i8, i16, i32, isize, u8, u32) {
+    (
+        a as u8, a as u16, a as u32, a as usize, a as i8, a as i16, a as i32, a as isize, b as u8,
+        b as u32,
+    )
 }
 
+static mut ONE: usize = 1;
+
 #[no_mangle]
 extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
+    let (a, b, c, d, e, f, g, h, i, j) = int_cast(10, 42);
     unsafe {
+        libc::printf(b"%d\n\0" as *const u8 as *const i8, c);
+        libc::printf(b"%ld\n\0" as *const u8 as *const i8, d);
+        libc::printf(b"%ld\n\0" as *const u8 as *const i8, j);
+
         let ptr = ONE as *mut usize;
         let value = ptr as usize;
         libc::printf(b"%ld\n\0" as *const u8 as *const i8, value);