Skip to content

Commit 5dbe271

Browse files
committed
Merge branch 'master' into sync_from_rust_2025_04_25_2
2 parents 338e738 + db1a31c commit 5dbe271

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

src/archive.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
use std::path::Path;
2+
3+
use rustc_codegen_ssa::back::archive::{
4+
ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
5+
};
6+
use rustc_session::Session;
7+
8+
pub(crate) struct ArArchiveBuilderBuilder;
9+
10+
impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder {
11+
fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box<dyn ArchiveBuilder + 'a> {
12+
Box::new(ArArchiveBuilder::new(sess, &DEFAULT_OBJECT_READER))
13+
}
14+
15+
fn create_dll_import_lib(
16+
&self,
17+
_sess: &Session,
18+
_lib_name: &str,
19+
_import_name_and_ordinal_vector: Vec<(String, Option<u16>)>,
20+
_output_path: &Path,
21+
) {
22+
unimplemented!("creating dll imports is not yet supported");
23+
}
24+
}

tests/run/ptr_cast.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,19 @@ fn int_cast(a: u16, b: i16) -> (u8, u16, u32, usize, i8, i16, i32, isize, u8, u3
2121
)
2222
}
2323

24+
static mut ONE: usize = 1;
25+
2426
#[no_mangle]
2527
extern "C" fn main(argc: i32, _argv: *const *const u8) -> i32 {
2628
let (a, b, c, d, e, f, g, h, i, j) = int_cast(10, 42);
2729
unsafe {
2830
libc::printf(b"%d\n\0" as *const u8 as *const i8, c);
2931
libc::printf(b"%ld\n\0" as *const u8 as *const i8, d);
3032
libc::printf(b"%ld\n\0" as *const u8 as *const i8, j);
33+
34+
let ptr = ONE as *mut usize;
35+
let value = ptr as usize;
36+
libc::printf(b"%ld\n\0" as *const u8 as *const i8, value);
3137
}
3238
0
3339
}

0 commit comments

Comments
 (0)