Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
42d7884
add p3 feature
adamrk Sep 1, 2026
4a6e65c
add p3 test CI job
adamrk Sep 2, 2026
ea32edf
use cfg alias
adamrk Sep 3, 2026
0487755
Require `&mut` for Streams
adamrk Sep 2, 2026
443ef72
remove &self stream methods
adamrk Sep 2, 2026
cabda1f
Add `wstd::main` and `wstd::test` macros for WASIp3
adamrk Sep 2, 2026
adb35fc
switch from feature to target
adamrk Sep 9, 2026
7e37d58
Merge branch 'main' into abk/p3-feature-base
adamrk Sep 9, 2026
26bea8b
merge fixes
adamrk Sep 9, 2026
6435d57
add job printing rust version
adamrk Sep 9, 2026
663c532
try override instead of default
adamrk Sep 9, 2026
d306e06
explicitly add wasi targets
adamrk Sep 9, 2026
2f8c1c2
bump msrv to latest version with p3 target_env
adamrk Sep 9, 2026
5841233
include target_os in directives
adamrk Sep 9, 2026
d880934
Merge branch 'abk/p3-feature-base' into abk/shared-ref-changes
adamrk Sep 9, 2026
47b889b
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk Sep 9, 2026
114abd0
fixes from merge
adamrk Sep 9, 2026
9d58000
use wit_bindgen::block_on in macros
adamrk Sep 9, 2026
14e1bce
remove build-std
adamrk Sep 9, 2026
2adec58
remove dead code
adamrk Sep 9, 2026
6150b98
no main for non-wasi targets
adamrk Sep 9, 2026
d8994a6
Merge branch 'abk/p3-feature-base' into abk/shared-ref-changes
adamrk Sep 9, 2026
2c7a618
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk Sep 9, 2026
64f20f5
change block_on static requirement
adamrk Sep 9, 2026
c3a377c
cleanup Cargo.tomls after feature removal
adamrk Sep 10, 2026
fb62b45
cleanup Cargo.tomls after feature removal
adamrk Sep 10, 2026
d3826e3
Merge branch 'abk/p3-feature-base' into abk/shared-ref-changes
adamrk Sep 10, 2026
d4fd717
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk Sep 10, 2026
fdb266c
keep http macro only in p2
adamrk Sep 10, 2026
1572e34
Merge branch 'main' into abk/shared-ref-changes
adamrk Sep 11, 2026
059432a
Merge branch 'abk/shared-ref-changes' into abk/main-macro-for-wasip3
adamrk Sep 11, 2026
cf4ffae
Merge branch 'main' into abk/main-macro-for-wasip3
adamrk Sep 15, 2026
66b1834
remove old no_main
adamrk Sep 15, 2026
ed8b70b
Revert "remove old no_main"
adamrk Sep 15, 2026
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
9 changes: 9 additions & 0 deletions examples/macro_main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![cfg_attr(not(target_os = "wasi"), no_main)]
#![cfg(target_os = "wasi")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just curious why there is the cfg_attr that is then contradicted by the cfg below?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oops I think that's just left over from using features. There are some other cases which I'll also fix in a separate PR.


//! Verifies that the `main` macro is compiling.

#[wstd::main]
async fn main() {
println!("Hello world");
}
16 changes: 13 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,25 @@ pub mod net;
pub mod rand;
#[cfg(all(target_os = "wasi", target_env = "p2"))]
pub mod runtime;
#[cfg(all(target_os = "wasi", target_env = "p3"))]
pub mod runtime {
pub fn block_on<F, T>(fut: F) -> F::Output
where
F: Future<Output = T>,
T: 'static,
{
wasip3::wit_bindgen::block_on(fut)
}
}
#[cfg(all(target_os = "wasi", target_env = "p2"))]
pub mod task;
#[cfg(all(target_os = "wasi", target_env = "p2"))]
pub mod time;

#[cfg(all(target_os = "wasi", target_env = "p2"))]
pub use wstd_macro::{
attr_macro_http_server as http_server, attr_macro_main as main, attr_macro_test as test,
};
pub use wstd_macro::attr_macro_http_server as http_server;

pub use wstd_macro::{attr_macro_main as main, attr_macro_test as test};

// Re-export the active WASI backend crate for use only by `wstd-macro` macros.
// The proc macros need to generate code that uses these definitions, but we
Expand Down
2 changes: 1 addition & 1 deletion tests/http_first_byte_timeout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use wstd::http::{Body, Client, Request, error::ErrorCode};

#[wstd::main]
#[wstd::test]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

A drive-by fix. This test wasn't actually running under cargo test because it used the main macro.

async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Set first byte timeout to 1/2 second.
let mut client = Client::new();
Expand Down
12 changes: 12 additions & 0 deletions tests/macro_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Verify that the test macro is acutally running.

#[wstd::test]
async fn computation() -> Result<(), String> {
assert_eq!(1 + 1, 2);
Ok(())
}

#[wstd::test]
async fn second_computation() {
assert_eq!(1 + 1, 2);
}
Loading