dtolnay/linkme

Consider producing empty slices under cfg(miri)

dtolnay opened this issue · 0 comments

Currently accessing a distributed slice under Miri makes the interpreter abort.

test readme ... error: unsupported operation: `extern` static `BENCHMARKS::LINKME_START` from crate `example` is not supported by Miri
  --> tests/example.rs:22:19
   |
22 |     for _bench in BENCHMARKS { /* ... */ }
   |                   ^^^^^^^^^^ `extern` static `BENCHMARKS::LINKME_START` from crate `example` is not supported by Miri
   |
   = help: this is likely not a bug in the program; it indicates that the program performed an operation that the interpreter does not support
   = note: BACKTRACE:
   = note: inside `readme` at tests/example.rs:22:19: 22:29

It would be reasonable to use cfg(miri) to produce a Miri-compatible stub implementation that always contains no elements.