Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 5cdae2e

Browse files
authored
Merge pull request #113 from alexcrichton/update-wit-bindgen
Update wit-bindgen dependency
2 parents aa801ba + f78e748 commit 5cdae2e

11 files changed

Lines changed: 46 additions & 33 deletions

Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/misc/component-async-tests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ wasi-http-draft = { path = "http" }
2424
wasm-compose = { workspace = true }
2525
wasmparser = { workspace = true }
2626
wasmtime = { workspace = true, features = [
27+
"default",
2728
"cranelift",
2829
"component-model-async",
2930
] }

crates/test-programs/src/bin/async_post_return_caller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct Component;
2626
impl Guest for Component {
2727
async fn run() {
2828
let s = "All mimsy were the borogoves";
29-
assert_eq!(s, &foo(s).await);
29+
assert_eq!(s, foo(s.to_string()).await);
3030
assert_eq!(s, &get_post_return_value());
3131
}
3232
}

crates/test-programs/src/bin/async_round_trip_direct_stackless.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl bindings::Guest for Component {
1515
async fn foo(s: String) -> String {
1616
format!(
1717
"{} - exited guest",
18-
bindings::foo(&format!("{s} - entered guest")).await
18+
bindings::foo(format!("{s} - entered guest")).await
1919
)
2020
}
2121
}

crates/test-programs/src/bin/async_round_trip_many_stackless.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ impl Guest for Component {
4545
c: v.c,
4646
};
4747
let (a, b, c, d, e, f, g) = many::foo(
48-
&format!("{a} - entered guest"),
48+
format!("{a} - entered guest"),
4949
b,
50-
&c,
50+
c,
5151
d,
52-
&into(e),
53-
f.map(into).as_ref(),
54-
g.map(into).as_ref().map_err(drop),
52+
into(e),
53+
f.map(into),
54+
g.map(into).map_err(drop),
5555
)
5656
.await;
5757
(

crates/test-programs/src/bin/async_round_trip_many_wait.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ impl Guest for Component {
5353
};
5454
async_support::block_on(async move {
5555
let (a, b, c, d, e, f, g) = many::foo(
56-
&format!("{a} - entered guest"),
56+
format!("{a} - entered guest"),
5757
b,
58-
&c,
58+
c,
5959
d,
60-
&into(e),
61-
f.map(into).as_ref(),
62-
g.map(into).as_ref().map_err(drop),
60+
into(e),
61+
f.map(into),
62+
g.map(into).map_err(drop),
6363
)
6464
.await;
6565
(

crates/test-programs/src/bin/async_round_trip_stackless.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ impl Baz for Component {
1717
async fn foo(s: String) -> String {
1818
format!(
1919
"{} - exited guest",
20-
baz::foo(&format!("{s} - entered guest")).await
20+
baz::foo(format!("{s} - entered guest")).await
2121
)
2222
}
2323
}

crates/test-programs/src/bin/async_round_trip_wait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl Baz for Component {
2525
async_support::block_on(async move {
2626
format!(
2727
"{} - exited guest",
28-
baz::foo(&format!("{s} - entered guest")).await
28+
baz::foo(format!("{s} - entered guest")).await
2929
)
3030
})
3131
}

crates/test-programs/src/bin/p3_sockets_ip_name_lookup.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,25 @@ struct Component;
77
test_programs::p3::export!(Component);
88

99
async fn resolve_one(name: &str) -> Result<IpAddress, ErrorCode> {
10-
Ok(resolve_addresses(name).await?.first().unwrap().to_owned())
10+
Ok(resolve_addresses(name.into())
11+
.await?
12+
.first()
13+
.unwrap()
14+
.to_owned())
1115
}
1216

1317
impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
1418
async fn run() -> Result<(), ()> {
1519
// Valid domains
1620
try_join!(
17-
resolve_addresses("localhost"),
18-
resolve_addresses("example.com")
21+
resolve_addresses("localhost".into()),
22+
resolve_addresses("example.com".into())
1923
)
2024
.unwrap();
2125

2226
// NB: this is an actual real resolution, so it might time out, might cause
2327
// issues, etc. This result is ignored to prevent flaky failures in CI.
24-
let _ = resolve_addresses("münchen.de").await;
28+
let _ = resolve_addresses("münchen.de".into()).await;
2529

2630
// Valid IP addresses
2731
assert_eq!(
@@ -64,27 +68,29 @@ impl test_programs::p3::exports::wasi::cli::run::Guest for Component {
6468

6569
// Invalid inputs
6670
assert_eq!(
67-
resolve_addresses("").await.unwrap_err(),
71+
resolve_addresses("".into()).await.unwrap_err(),
6872
ErrorCode::InvalidArgument
6973
);
7074
assert_eq!(
71-
resolve_addresses(" ").await.unwrap_err(),
75+
resolve_addresses(" ".into()).await.unwrap_err(),
7276
ErrorCode::InvalidArgument
7377
);
7478
assert_eq!(
75-
resolve_addresses("a.b<&>").await.unwrap_err(),
79+
resolve_addresses("a.b<&>".into()).await.unwrap_err(),
7680
ErrorCode::InvalidArgument
7781
);
7882
assert_eq!(
79-
resolve_addresses("127.0.0.1:80").await.unwrap_err(),
83+
resolve_addresses("127.0.0.1:80".into()).await.unwrap_err(),
8084
ErrorCode::InvalidArgument
8185
);
8286
assert_eq!(
83-
resolve_addresses("[::]:80").await.unwrap_err(),
87+
resolve_addresses("[::]:80".into()).await.unwrap_err(),
8488
ErrorCode::InvalidArgument
8589
);
8690
assert_eq!(
87-
resolve_addresses("http://example.com/").await.unwrap_err(),
91+
resolve_addresses("http://example.com/".into())
92+
.await
93+
.unwrap_err(),
8894
ErrorCode::InvalidArgument
8995
);
9096
Ok(())

crates/test-programs/src/bin/p3_sockets_udp_sample_application.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ async fn test_udp_sample_application(family: IpAddressFamily, bind_address: IpSo
2525
let client_addr = client.local_address().unwrap();
2626
join!(
2727
async {
28-
client.send(first_message, None).await.unwrap();
29-
client.send(second_message, Some(addr)).await.unwrap();
28+
client.send(first_message.to_vec(), None).await.unwrap();
29+
client
30+
.send(second_message.to_vec(), Some(addr))
31+
.await
32+
.unwrap();
3033
},
3134
async {
3235
// Check that we've received our sent messages.
@@ -44,7 +47,10 @@ async fn test_udp_sample_application(family: IpAddressFamily, bind_address: IpSo
4447
// Another client
4548
let client = UdpSocket::new(family);
4649
client.bind(unspecified_addr).unwrap();
47-
client.send(third_message, Some(addr)).await.unwrap();
50+
client
51+
.send(third_message.to_vec(), Some(addr))
52+
.await
53+
.unwrap();
4854
},
4955
async {
5056
// Check that we sent and received our message!

0 commit comments

Comments
 (0)