Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,34 @@ life-before-main, see the [`linkme`] crate.

<br>

### Illumos Compatibility

This crate requires Rust nightly when compiling for illumos targets due to its
dependency on the unstable `used_with_arg` feature.

To use this crate on illumos, you must enable the required feature in all
crates that use `inventory`. Add one of the following to the top of your crate's
entry point (typically `main.rs` or `lib.rs`):

**For illumos-only applications:**
```rust
#![feature(used_with_arg)]
```

**For cross-platform applications:**
```rust
#[cfg_attr(target_os = "illumos", feature(used_with_arg))]
```

The conditional approach allows your application to compile on stable Rust for
other platforms while only requiring nightly on illumos.

This is because the illumos linker does not properly handle the multiple
`.init_array` sections created when using `#[used]`. You can find more
information [here](https://system-illumination.org/01-rustler.html).

<br>

#### License

<sup>
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,8 @@ macro_rules! __do_submit {

({ $($value:tt)* } { $($dup:tt)* }) => {
$crate::__do_submit! {
used={ #[used] }
used={ #[cfg_attr(target_os = "illumos", used(compiler))]
#[cfg_attr(not(target_os = "illumos"), used)] }
$($value)*
}
};
Expand Down
Loading