about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAntoni Boucher <bouanto@zoho.com>2025-04-25 10:05:03 -0400
committerAntoni Boucher <bouanto@zoho.com>2025-04-25 10:05:03 -0400
commit5dbe271045ea57b55071d8f61733d31bf8056c69 (patch)
tree9eaa35dfbdfd4c72d4846e7669061e1935194278
parent338e7388ea078c8bf70600f0755701b490ec267b (diff)
parentdb1a31c243a649e1fe20f5466ba181da5be35c14 (diff)
downloadrust-5dbe271045ea57b55071d8f61733d31bf8056c69.tar.gz
rust-5dbe271045ea57b55071d8f61733d31bf8056c69.zip
Merge branch 'master' into sync_from_rust_2025_04_25_2
-rw-r--r--src/archive.rs24
-rw-r--r--tests/run/ptr_cast.rs6
2 files changed, 30 insertions, 0 deletions
diff --git a/src/archive.rs b/src/archive.rs
new file mode 100644
index 00000000000..0cee05f1cea
--- /dev/null
+++ b/src/archive.rs
@@ -0,0 +1,24 @@
+use std::path::Path;
+
+use rustc_codegen_ssa::back::archive::{
+    ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
+};
+use rustc_session::Session;
+
+pub(crate) struct ArArchiveBuilderBuilder;
+
+impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
+    fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box<dyn ArchiveBuilder + 'a> {
+        Box::new(ArArchiveBuilder::new(sess, &DEFAULT_OBJECT_READER))
+    }
+
+    fn create_dll_import_lib(
+        &self,
+        _sess: &Session,
+        _lib_name: &str,
+        _import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,
+        _output_path: &Path,
+    ) {
+        unimplemented!("creating dll imports is not yet supported");
+    }
+}
diff --git a/tests/run/ptr_cast.rs b/tests/run/ptr_cast.rs
index c1254c51ce9..03d998c14cc 100644
--- a/tests/run/ptr_cast.rs
+++ b/tests/run/ptr_cast.rs
@@ -21,6 +21,8 @@ fn int_cast(a: u16, b: i16) -> (u8, u16, u32, usize, i8, i16, i32, isize, u8, u3
     )
 }
 
+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);
@@ -28,6 +30,10 @@ extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
         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);
     }
     0
 }