From 03c2872648e7fd43878ab5ae6657edfc8f42a801 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Thu, 29 Jul 2021 18:02:14 +0800 Subject: [PATCH 1/3] ci: lock the rust toolchain in the ci script --- .github/workflows/ci.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 23035332..c3bfd694 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.52.1 override: true components: rustfmt - name: Run @@ -35,7 +35,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: 1.52.1 override: true components: clippy - name: Run @@ -47,7 +47,7 @@ jobs: matrix: os: [ ubuntu-latest ] rust: - - stable + - 1.52.1 - 1.41.0 # MSRV fail-fast: true max-parallel: 2 @@ -69,7 +69,7 @@ jobs: matrix: os: [ ubuntu-latest ] rust: - - stable + - 1.52.1 - 1.41.0 # MSRV fail-fast: true max-parallel: 2 From 86354da6f5ea3af009c42331dc20c9a717fe9801 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Thu, 29 Jul 2021 23:08:20 +0800 Subject: [PATCH 2/3] fix: an API for partial read FixVec is incorrect --- examples/tests-loader/src/generators/rust.rs | 9 +++++++++ tools/codegen/src/generator/languages/rust/properties.rs | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/tests-loader/src/generators/rust.rs b/examples/tests-loader/src/generators/rust.rs index 75b75441..1dd32182 100644 --- a/examples/tests-loader/src/generators/rust.rs +++ b/examples/tests-loader/src/generators/rust.rs @@ -220,6 +220,15 @@ impl GenTest for types::Vector { .build(); let expected = #name::from_slice(#expected).unwrap(); #assert_stmt + assert_eq!( + result.total_size(), + result.as_slice().len(), + "\nstruct: {}:\n data: {:#x}\n partial read total_size: {}, actual: {}\n", + #name::NAME, + result, + result.total_size(), + result.as_slice().len() + ); } ); vec![test] diff --git a/tools/codegen/src/generator/languages/rust/properties.rs b/tools/codegen/src/generator/languages/rust/properties.rs index fab8cea6..2aec807c 100644 --- a/tools/codegen/src/generator/languages/rust/properties.rs +++ b/tools/codegen/src/generator/languages/rust/properties.rs @@ -47,7 +47,7 @@ impl DefProperties for ast::FixVec { fn def_properties(&self) -> m4::TokenStream { quote!( pub fn total_size(&self) -> usize { - molecule::NUMBER_SIZE * (self.item_count() + 1) + molecule::NUMBER_SIZE + Self::ITEM_SIZE * self.item_count() } pub fn item_count(&self) -> usize { molecule::unpack_number(self.as_slice()) as usize From 5b4b4816e8c00285be798d0a17c4324ce8145009 Mon Sep 17 00:00:00 2001 From: Boyu Yang Date: Thu, 29 Jul 2021 23:43:23 +0800 Subject: [PATCH 3/3] chore: bump version to v0.7.2 --- bindings/rust/Cargo.toml | 2 +- examples/ci-tests/Cargo.toml | 2 +- examples/tests-loader/Cargo.toml | 2 +- examples/tests-utils-c/Cargo.toml | 2 +- examples/tests-utils-rust/Cargo.toml | 2 +- tools/codegen/Cargo.toml | 4 ++-- tools/compiler/Cargo.lock | 6 +++--- tools/compiler/Cargo.toml | 4 ++-- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/bindings/rust/Cargo.toml b/bindings/rust/Cargo.toml index ecd12320..db884306 100644 --- a/bindings/rust/Cargo.toml +++ b/bindings/rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "molecule" -version = "0.7.1" +version = "0.7.2" authors = ["Nervos Core Dev "] edition = "2018" description = "Rust bindings for molecule." diff --git a/examples/ci-tests/Cargo.toml b/examples/ci-tests/Cargo.toml index f6acb0d1..4147a62d 100644 --- a/examples/ci-tests/Cargo.toml +++ b/examples/ci-tests/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "molecule-ci-tests" -version = "0.7.1" +version = "0.7.2" authors = ["Nervos Core Dev "] edition = "2018" diff --git a/examples/tests-loader/Cargo.toml b/examples/tests-loader/Cargo.toml index a75045a8..6b23533d 100644 --- a/examples/tests-loader/Cargo.toml +++ b/examples/tests-loader/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "molecule-tests-loader" -version = "0.7.1" +version = "0.7.2" authors = ["Nervos Core Dev "] edition = "2018" diff --git a/examples/tests-utils-c/Cargo.toml b/examples/tests-utils-c/Cargo.toml index 598cfbd1..4aa33917 100644 --- a/examples/tests-utils-c/Cargo.toml +++ b/examples/tests-utils-c/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "molecule-tests-utils-c" -version = "0.7.1" +version = "0.7.2" authors = ["Nervos Core Dev "] edition = "2018" diff --git a/examples/tests-utils-rust/Cargo.toml b/examples/tests-utils-rust/Cargo.toml index 692e7869..3d4b2a12 100644 --- a/examples/tests-utils-rust/Cargo.toml +++ b/examples/tests-utils-rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "molecule-tests-utils-rust" -version = "0.7.1" +version = "0.7.2" authors = ["Nervos Core Dev "] edition = "2018" diff --git a/tools/codegen/Cargo.toml b/tools/codegen/Cargo.toml index 8e5a23f2..2252e045 100644 --- a/tools/codegen/Cargo.toml +++ b/tools/codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "molecule-codegen" -version = "0.7.1" +version = "0.7.2" authors = ["Nervos Core Dev "] edition = "2018" description = "Code generator for molecule." @@ -16,7 +16,7 @@ categories = [ license = "MIT" [dependencies] -molecule = { version = "=0.7.1", path = "../../bindings/rust", default-features = false } +molecule = { version = "=0.7.2", path = "../../bindings/rust", default-features = false } property = "0.3.3" pest = "2.1.3" pest_derive = "2.1.0" diff --git a/tools/compiler/Cargo.lock b/tools/compiler/Cargo.lock index fcfb5e89..7e0d3cdf 100644 --- a/tools/compiler/Cargo.lock +++ b/tools/compiler/Cargo.lock @@ -142,14 +142,14 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "molecule" -version = "0.7.1" +version = "0.7.2" dependencies = [ "cfg-if", ] [[package]] name = "molecule-codegen" -version = "0.7.1" +version = "0.7.2" dependencies = [ "case", "molecule", @@ -167,7 +167,7 @@ dependencies = [ [[package]] name = "moleculec" -version = "0.7.1" +version = "0.7.2" dependencies = [ "clap", "molecule-codegen", diff --git a/tools/compiler/Cargo.toml b/tools/compiler/Cargo.toml index ecb419c9..3d001f3c 100644 --- a/tools/compiler/Cargo.toml +++ b/tools/compiler/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "moleculec" -version = "0.7.1" +version = "0.7.2" authors = ["Nervos Core Dev "] edition = "2018" description = "Schema compiler for molecule." @@ -30,7 +30,7 @@ path = "src/compiler-rust.rs" [dependencies] clap = { version = "2.33.3", features = ["yaml"] } which = "4.0.2" -molecule-codegen = { version = "=0.7.1", path = "../codegen", features = ["compiler-plugin"] } +molecule-codegen = { version = "=0.7.2", path = "../codegen", features = ["compiler-plugin"] } [badges] maintenance = { status = "experimental" }