From e0d33dae2f2ab70b936467590284030d759f9db7 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 20 Feb 2019 11:47:25 +0000 Subject: Add static assertions for Request and Response size The Request and Response types have to have a size of 64 bytes. Previously, we only verified this property by visual inspection. Accidental changes to the size could lead to runtime errors. This patch adds static assertions using the static_assertions crate to enforce this property at compile time. --- Cargo.lock | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Cargo.lock') diff --git a/Cargo.lock b/Cargo.lock index bb5177b..76dc8ef 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,6 +80,7 @@ dependencies = [ "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", "serde-big-array 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "ssmarshal 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "static_assertions 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "stm32f103xx-usb 0.1.0 (git+https://github.com/mvirkkunen/stm32f103xx-usb?rev=57d23751367461bec5f39322727bdd65e5c2aa30)", "stm32f1xx-hal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "usb-device 0.2.0 (git+https://github.com/mvirkkunen/usb-device?rev=e58e30f3b9c9bf4aab00ea039d129b964a3fd2d3)", @@ -189,6 +190,11 @@ dependencies = [ "serde 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "static_assertions" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "stm32f1" version = "0.5.0" @@ -288,6 +294,7 @@ dependencies = [ "checksum serde-big-array 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "dbd629249ae3007dac9632aa92334c5ba9c8a4dbe0a6263e546121dd1c57394a" "checksum serde_derive 1.0.88 (registry+https://github.com/rust-lang/crates.io-index)" = "beed18e6f5175aef3ba670e57c60ef3b1b74d250d962a26604bff4c80e970dd4" "checksum ssmarshal 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f3e6ad23b128192ed337dfa4f1b8099ced0c2bf30d61e551b65fda5916dbb850" +"checksum static_assertions 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "389ce475f424f267dbed6479cbd8f126c5e1afb053b0acdaa019c74305fc65d1" "checksum stm32f1 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48763f6f093674476399efbd8d2e52349dc32c3bbf57657234cbb15d309cd8a3" "checksum stm32f103xx-usb 0.1.0 (git+https://github.com/mvirkkunen/stm32f103xx-usb?rev=57d23751367461bec5f39322727bdd65e5c2aa30)" = "" "checksum stm32f1xx-hal 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f410543fc282d51e181e3cf5c8adff303d9e5ae8b9eb731e6a07f58a4cec4265" -- cgit v1.2.1