Skip to content

Commit 9487535

Browse files
authored
(c2rust-analyze/tests) Add a generic extern "rust-intrinsic" foreign fn` test (currently disabled as we crash on it) (#1001)
* A test for #996 and #999.
2 parents 0021ec9 + 3024135 commit 9487535

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

c2rust-analyze/tests/analyze.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ macro_rules! define_tests {
3131
define_tests! {
3232
macros,
3333
ptr_addr_of,
34+
rust_intrinsic,
3435
string_literals,
3536
string_casts,
3637
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/// Check that `extern "rust-intrinsic"` (which can be generic) foreign `fn`s
2+
/// like [`std::mem::transmute`] don't crash `c2rust-analyze`.
3+
///
4+
/// They currently do (in [`Instance::mono`] where there are generic args),
5+
/// which is why this is `#[cfg]`ed out for now.
6+
#[cfg(any())]
7+
pub unsafe fn f(x: *const u8) -> *const i8 {
8+
std::mem::transmute(x)
9+
}

0 commit comments

Comments
 (0)