Skip to content

Commit 0affe2a

Browse files
committed
add bootstrap and cleanup
1 parent b15c620 commit 0affe2a

File tree

14 files changed

+224
-180
lines changed

14 files changed

+224
-180
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ members = [
1212
# testing and examples
1313
"async-byte-channel",
1414
"benchmark",
15+
"bootstrap",
1516
"capnpc/test",
1617
"capnpc/test/external-crate",
1718
"capnpc/test-edition-2018",

bootstrap/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
3+
name = "bootstrap"
4+
version = "0.0.0"
5+
authors = ["Erik McClure"]
6+
edition.workspace = true
7+
license.workspace = true
8+
9+
[[bin]]
10+
name = "bootstrap"
11+
path = "main.rs"
12+
13+
[dependencies]
14+
capstone-gen.workspace = true
15+
capnp-sys.workspace = true

bootstrap/main.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
pub fn main() {
2+
let root = std::path::Path::new(std::env!("CARGO_MANIFEST_DIR"))
3+
.parent()
4+
.unwrap();
5+
6+
std::env::set_current_dir(root).unwrap();
7+
let output = capnp_sys::call(
8+
["capnp/schema.capnp"].iter(),
9+
[root.to_str().unwrap()].iter(),
10+
["capnp/".to_string()].iter(),
11+
false,
12+
)
13+
.expect("Failed to run capnp command");
14+
15+
::capnpc::codegen::CodeGenerationCommand::new()
16+
.output_directory(root.join("capnp/src"))
17+
.capnp_root("crate")
18+
.run(output.as_slice())
19+
.expect("failed to bootstrap schema");
20+
21+
let output = capnp_sys::call(
22+
[
23+
"capnp-rpc/schema/rpc.capnp",
24+
"capnp-rpc/schema/rpc-twoparty.capnp",
25+
]
26+
.iter(),
27+
[root.to_str().unwrap()].iter(),
28+
["capnp-rpc/schema/".to_string()].iter(),
29+
false,
30+
)
31+
.expect("Failed to run capnp command");
32+
33+
::capnpc::codegen::CodeGenerationCommand::new()
34+
.output_directory(root.join("capnp-rpc/src"))
35+
.run(output.as_slice())
36+
.expect("failed to bootstrap RPC schema");
37+
}

capnp-rpc/src/rpc.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,8 +1995,7 @@ where
19951995
fn resolve(state: &Rc<RefCell<Self>>, response: Result<Response<VatId>, Error>) {
19961996
let to_resolve = {
19971997
let tmp = state.borrow();
1998-
let r = tmp.promise_clients_to_resolve.borrow_mut().drain();
1999-
r
1998+
tmp.promise_clients_to_resolve.borrow_mut().drain()
20001999
};
20012000
for ((c, ops), _) in to_resolve {
20022001
let resolved = match response.clone() {

0 commit comments

Comments
 (0)