Skip to content

Commit

Permalink
(c2rust-analyze/tests) Add a generic `extern "rust-intrinsic" forei…
Browse files Browse the repository at this point in the history
…gn `fn` test (currently disabled as we crash on it) (#1001)

* A test for #996 and #999.
  • Loading branch information
kkysen authored Jul 21, 2023
2 parents 0021ec9 + 3024135 commit 9487535
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions c2rust-analyze/tests/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ macro_rules! define_tests {
define_tests! {
macros,
ptr_addr_of,
rust_intrinsic,
string_literals,
string_casts,
}
Expand Down
9 changes: 9 additions & 0 deletions c2rust-analyze/tests/analyze/rust_intrinsic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/// Check that `extern "rust-intrinsic"` (which can be generic) foreign `fn`s
/// like [`std::mem::transmute`] don't crash `c2rust-analyze`.
///
/// They currently do (in [`Instance::mono`] where there are generic args),
/// which is why this is `#[cfg]`ed out for now.
#[cfg(any())]
pub unsafe fn f(x: *const u8) -> *const i8 {
std::mem::transmute(x)
}

0 comments on commit 9487535

Please sign in to comment.