diff options
| author | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-05 09:13:28 +0100 |
|---|---|---|
| committer | Albert Larsan <74931857+albertlarsan68@users.noreply.github.com> | 2023-01-11 09:32:08 +0000 |
| commit | cf2dff2b1e3fa55fa5415d524200070d0d7aacfe (patch) | |
| tree | 40a88d9a46aaf3e8870676eb2538378b75a263eb /tests/run-make/wasm-stringify-ints-small/foo.rs | |
| parent | ca855e6e42787ecd062d81d53336fe6788ef51a9 (diff) | |
| download | rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.tar.gz rust-cf2dff2b1e3fa55fa5415d524200070d0d7aacfe.zip | |
Move /src/test to /tests
Diffstat (limited to 'tests/run-make/wasm-stringify-ints-small/foo.rs')
| -rw-r--r-- | tests/run-make/wasm-stringify-ints-small/foo.rs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/run-make/wasm-stringify-ints-small/foo.rs b/tests/run-make/wasm-stringify-ints-small/foo.rs new file mode 100644 index 00000000000..7a947f013ad --- /dev/null +++ b/tests/run-make/wasm-stringify-ints-small/foo.rs @@ -0,0 +1,33 @@ +#![crate_type = "cdylib"] + +extern "C" { + fn observe(ptr: *const u8, len: usize); +} + +macro_rules! s { + ( $( $f:ident -> $t:ty );* $(;)* ) => { + $( + extern "C" { + fn $f() -> $t; + } + let s = $f().to_string(); + observe(s.as_ptr(), s.len()); + )* + }; +} + +#[no_mangle] +pub unsafe extern "C" fn foo() { + s! { + get_u8 -> u8; + get_i8 -> i8; + get_u16 -> u16; + get_i16 -> i16; + get_u32 -> u32; + get_i32 -> i32; + get_u64 -> u64; + get_i64 -> i64; + get_usize -> usize; + get_isize -> isize; + } +} |
