Skip to content

linkme crate not supported by Miri #4171

Open
@nazar-pc

Description

@nazar-pc

This is probably related to #2757, but I'm less interested in suppressing it and more in being able to use it.

Specifically, I'm using linkme crate and would like to be able to run tests under Miri. Right now I'm getting this instead:

test basic ... error: unsupported operation: extern static `__start_linkme_CONTRACTS_METHODS_FN_POINTERS` is not supported by Miri
   --> /web/github/abundance/crates/contracts/ab-contracts-executor/src/lib.rs:803:13
    |
803 |             CONTRACTS_METHODS_FN_POINTERS
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ extern static `__start_linkme_CONTRACTS_METHODS_FN_POINTERS` is not supported by Miri
    |
    = help: this is likely not a bug in the program; it indicates that the program performed an operation that Miri does not support
    = note: BACKTRACE on thread `basic`:
    = note: inside `ab_contracts_executor::NativeExecutor::in_memory` at /web/github/abundance/crates/contracts/ab-contracts-executor/src/lib.rs:803:13: 803:42
note: inside `basic`
   --> crates/contracts/ab-contract-example/tests/basic.rs:13:24
    |
13  |     let mut executor = NativeExecutor::in_memory(shard_index).unwrap();
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside closure
   --> crates/contracts/ab-contract-example/tests/basic.rs:9:11
    |
8   | #[test]
    | ------- in this procedural macro expansion
9   | fn basic() {
    |           ^
    = note: inside `<{closure@crates/contracts/ab-contract-example/tests/basic.rs:9:1: 27:2} as std::ops::FnOnce<()>>::call_once - shim` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5: 250:71
    = note: inside `<fn() -> std::result::Result<(), std::string::String> as std::ops::FnOnce<()>>::call_once - shim(fn() -> std::result::Result<(), std::string::String>)` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5: 250:71
    = note: inside `test::__rust_begin_short_backtrace::<std::result::Result<(), std::string::String>, fn() -> std::result::Result<(), std::string::String>>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:632:18: 632:21
    = note: inside `test::types::RunnableTest::run` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/types.rs:145:40: 145:71
    = note: inside closure at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:655:60: 655:79
    = note: inside `<std::panic::AssertUnwindSafe<{closure@test::run_test_in_process::{closure#0}}> as std::ops::FnOnce<()>>::call_once` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9: 272:19
    = note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<{closure@test::run_test_in_process::{closure#0}}>, std::result::Result<(), std::string::String>>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:568:40: 568:43
    = note: inside `std::panicking::r#try::<std::result::Result<(), std::string::String>, std::panic::AssertUnwindSafe<{closure@test::run_test_in_process::{closure#0}}>>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:531:19: 531:88
    = note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<{closure@test::run_test_in_process::{closure#0}}>, std::result::Result<(), std::string::String>>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14: 358:33
    = note: inside `test::run_test_in_process` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:655:27: 655:81
    = note: inside closure at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:576:43: 584:18
    = note: inside closure at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/test/src/lib.rs:606:41: 606:83
    = note: inside `std::sys::backtrace::__rust_begin_short_backtrace::<{closure@test::run_test::{closure#1}}, ()>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/backtrace.rs:152:18: 152:21
    = note: inside closure at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:564:17: 564:71
    = note: inside `<std::panic::AssertUnwindSafe<{closure@std::thread::Builder::spawn_unchecked_<'_, {closure@test::run_test::{closure#1}}, ()>::{closure#1}::{closure#0}}> as std::ops::FnOnce<()>>::call_once` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panic/unwind_safe.rs:272:9: 272:19
    = note: inside `std::panicking::r#try::do_call::<std::panic::AssertUnwindSafe<{closure@std::thread::Builder::spawn_unchecked_<'_, {closure@test::run_test::{closure#1}}, ()>::{closure#1}::{closure#0}}>, ()>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:568:40: 568:43
    = note: inside `std::panicking::r#try::<(), std::panic::AssertUnwindSafe<{closure@std::thread::Builder::spawn_unchecked_<'_, {closure@test::run_test::{closure#1}}, ()>::{closure#1}::{closure#0}}>>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:531:19: 531:88
    = note: inside `std::panic::catch_unwind::<std::panic::AssertUnwindSafe<{closure@std::thread::Builder::spawn_unchecked_<'_, {closure@test::run_test::{closure#1}}, ()>::{closure#1}::{closure#0}}>, ()>` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panic.rs:358:14: 358:33
    = note: inside closure at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/thread/mod.rs:562:30: 565:16
    = note: inside `<{closure@std::thread::Builder::spawn_unchecked_<'_, {closure@test::run_test::{closure#1}}, ()>::{closure#1}} as std::ops::FnOnce<()>>::call_once - shim(vtable)` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:250:5: 250:71
    = note: inside `<std::boxed::Box<dyn std::ops::FnOnce()> as std::ops::FnOnce<()>>::call_once` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1970:9: 1970:52
    = note: inside `<std::boxed::Box<std::boxed::Box<dyn std::ops::FnOnce()>> as std::ops::FnOnce<()>>::call_once` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc/src/boxed.rs:1970:9: 1970:52
    = note: inside `std::sys::pal::unix::thread::Thread::new::thread_start` at /home/nazar-pc/.rustup/toolchains/nightly-2024-12-24-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/pal/unix/thread.rs:106:17: 106:64
    = note: this error originates in the attribute macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)
$ cargo miri --version
miri 0.1.0 (bdc6b3de48 2024-12-23)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-shimsArea: This affects the external function shimsC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions