Skip to content

Adjust proxy_wasm::main macro for changes in Rust v1.100. - #389

Draft
PiotrSikora wants to merge 3 commits into
proxy-wasm:mainfrom
PiotrSikora:wasi_call_ctors
Draft

PiotrSikora wants to merge 3 commits into
proxy-wasm:mainfrom
PiotrSikora:wasi_call_ctors

Conversation

@PiotrSikora

Copy link
Copy Markdown
Member

Since Rust v1.56.0 (2021-10-21), an explicit call to __wasm_call_ctors
was required to indicate that the Wasm module was a WASI reactor and not
a multi-entry WASI command.

This changed again in Rust v1.100.0 (2026-11-12), which assumes that all
libraries are WASI reactors, so we no longer need an explicit call.

See: rust-lang/rust#161421

Reported by Andrew Carlson.

Since Rust v1.56.0 (2021-10-21), an explicit call to `__wasm_call_ctors`
was required to indicate that the Wasm module was a WASI reactor and not
a multi-entry WASI command.

This changed again in Rust v1.100.0 (2026-11-12), which assumes that all
libraries are WASI reactors, so we no longer need an explicit call.

See: rust-lang/rust#161421

Reported by Andrew Carlson.

Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Signed-off-by: Piotr Sikora <code@piotrsikora.dev>
Comment thread build.rs
}

if version_check::is_min_version("1.100.0") == Some(false) {
println!("cargo:rustc-cfg=wasi_call_ctors");

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: add nightly build that first introduced this change.

Note that we didn't catch this issue earlier, because we test only examples with -Z wasi-exec-model=reactor on nightly, so ideally we'd also add examples without that flag.

Comment thread build.rs
}
}

if version_check::is_min_version("1.100.0") == Some(false) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: if we want to avoid extra dependency, then we could parse rustc --version output ourselves.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using version_check seems reasonable to me, FWIW.

Comment thread build.rs
}
}

if version_check::is_min_version("1.100.0") == Some(false) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using version_check seems reasonable to me, FWIW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants