diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-08-28 13:36:10 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2025-08-29 08:39:34 +0000 |
| commit | fc7de9979e418b0ea467bb2833b07486d7c54940 (patch) | |
| tree | 4990a2b2096c4005b2f1b639b5101f1081bfd699 /tests/ui/linking | |
| parent | 41f2b6b39e7526a28d50ff6918dda6de48add5e4 (diff) | |
| download | rust-fc7de9979e418b0ea467bb2833b07486d7c54940.tar.gz rust-fc7de9979e418b0ea467bb2833b07486d7c54940.zip | |
Ensure we emit an allocator shim when only some crate types need one
Diffstat (limited to 'tests/ui/linking')
| -rw-r--r-- | tests/ui/linking/mixed-allocator-shim.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/ui/linking/mixed-allocator-shim.rs b/tests/ui/linking/mixed-allocator-shim.rs new file mode 100644 index 00000000000..b81fbdc5205 --- /dev/null +++ b/tests/ui/linking/mixed-allocator-shim.rs @@ -0,0 +1,15 @@ +//@ build-pass +//@ compile-flags: --crate-type staticlib,dylib -Zstaticlib-prefer-dynamic +//@ no-prefer-dynamic + +// Test that compiling for multiple crate types in a single compilation with +// mismatching allocator shim requirements doesn't result in the allocator shim +// missing entirely. +// In this particular test the dylib crate type will statically link libstd and +// thus need an allocator shim, while the staticlib crate type will dynamically +// link libstd and thus not need an allocator shim. +// The -Zstaticlib-prefer-dynamic flag could be avoided by doing it the other +// way around, but testing that the staticlib correctly has the allocator shim +// in that case would require a run-make test instead. + +pub fn foo() {} |
