Skip to content

Commit

Permalink
fix(rs-bindgen): always use named lifetime for lists
Browse files Browse the repository at this point in the history
Signed-off-by: Roman Volosatovs <[email protected]>
  • Loading branch information
rvolosatovs committed Jul 5, 2024
1 parent fe22718 commit 760c8d0
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ wasmtime = { version = "22", default-features = false }
wasmtime-wasi = { version = "22", default-features = false }
wit-bindgen = { version = "0.27", default-features = false }
wit-bindgen-core = { version = "0.27", default-features = false }
wit-bindgen-wrpc = { version = "0.4.3", default-features = false, path = "./crates/wit-bindgen" }
wit-bindgen-wrpc = { version = "0.4.4", default-features = false, path = "./crates/wit-bindgen" }
wit-bindgen-wrpc-go = { version = "0.2", default-features = false, path = "./crates/wit-bindgen-go" }
wit-bindgen-wrpc-rust = { version = "0.4.3", default-features = false, path = "./crates/wit-bindgen-rust" }
wit-bindgen-wrpc-rust-macro = { version = "0.4.3", default-features = false, path = "./crates/wit-bindgen-rust-macro" }
wit-bindgen-wrpc-rust = { version = "0.4.4", default-features = false, path = "./crates/wit-bindgen-rust" }
wit-bindgen-wrpc-rust-macro = { version = "0.4.4", default-features = false, path = "./crates/wit-bindgen-rust-macro" }
wit-component = { version = "0.212", default-features = false }
wit-parser = { version = "0.212", default-features = false }
wrpc-cli = { version = "0.2", path = "./crates/cli", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen-rust-macro/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wit-bindgen-wrpc-rust-macro"
version = "0.4.3"
version = "0.4.4"
description = """
Procedural macro paired with the `wit-bindgen-wrpc` crate.
"""
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wit-bindgen-wrpc-rust"
version = "0.4.3"
version = "0.4.4"
description = """
Rust bindings generator for wRPC, typically used through
the `wit-bindgen-wrpc` crate's `generate!` macro.
Expand Down
10 changes: 7 additions & 3 deletions crates/wit-bindgen-rust/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@ pub async fn serve_interface<T: {wrpc_transport}::Serve, U>(
if owned {
self.push_str("String");
} else {
self.push_str("&str");
self.push_str("&'a str");
}
}
}
Expand Down Expand Up @@ -916,9 +916,13 @@ pub async fn serve_interface<T: {wrpc_transport}::Serve, U>(
self.push_str(">");
}
} else if is_ty(self.resolve, Type::U8, ty) {
uwrite!(self.src, "&{bytes}::Bytes", bytes = self.gen.bytes_path());
uwrite!(
self.src,
"&'a {bytes}::Bytes",
bytes = self.gen.bytes_path()
);
} else {
self.push_str("&[");
self.push_str("&'a [");
self.print_ty(ty, false, submodule);
self.push_str("]");
}
Expand Down
2 changes: 1 addition & 1 deletion crates/wit-bindgen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wit-bindgen-wrpc"
version = "0.4.3"
version = "0.4.4"
description = """
Rust bindings generator for wRPC.
"""
Expand Down
2 changes: 1 addition & 1 deletion src/bin/wit-bindgen-wrpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn gen_world(
files: &mut Files,
) -> Result<()> {
let mut resolve = Resolve::default();
for features in opts.features.iter() {
for features in &opts.features {
for feature in features
.split(',')
.flat_map(|s| s.split_whitespace())
Expand Down
2 changes: 1 addition & 1 deletion tests/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ where
join!(
async {
info!("receiving `a`");
assert_eq!(a.collect::<Vec<_>>().await.concat(), [0xc0, 0xff, 0xee])
assert_eq!(a.collect::<Vec<_>>().await.concat(), [0xc0, 0xff, 0xee]);
},
async {
info!("receiving `b`");
Expand Down

0 comments on commit 760c8d0

Please sign in to comment.