Fix expected struct sizes for nightly optimizations (no more CI warnings)

This commit is contained in:
xmppftw 2023-06-06 11:28:29 +02:00 committed by xmpp ftw
parent 099b7356a6
commit c8dcf5e7a7
6 changed files with 27 additions and 0 deletions

View file

@ -24,6 +24,9 @@ sha3 = "0.10"
blake2 = "0.10.4"
chrono = { version = "0.4.5", default-features = false, features = ["std"] }
[build-dependencies]
rustc_version = "0.4"
[features]
# Build xmpp-parsers to make components instead of clients.
component = []

12
parsers/build.rs Normal file
View file

@ -0,0 +1,12 @@
use rustc_version::{version_meta, Channel};
fn main() {
let version = version_meta().unwrap();
match version.channel {
Channel::Nightly => {
println!("cargo:rustc-cfg=rustc_nightly");
}
_ => {}
}
}

View file

@ -254,6 +254,9 @@ mod tests {
assert_size!(DiscoInfoQuery, 24);
assert_size!(DiscoInfoResult, 96);
#[cfg(rustc_nightly)]
assert_size!(Item, 120);
#[cfg(not(rustc_nightly))]
assert_size!(Item, 128);
assert_size!(DiscoItemsQuery, 24);
assert_size!(DiscoItemsResult, 48);

View file

@ -55,6 +55,9 @@ mod tests {
#[test]
fn test_size() {
assert_size!(JidPrepQuery, 24);
#[cfg(rustc_nightly)]
assert_size!(JidPrepResponse, 72);
#[cfg(not(rustc_nightly))]
assert_size!(JidPrepResponse, 80);
}

View file

@ -298,6 +298,9 @@ mod tests {
assert_size!(Mode, 1);
assert_size!(CandidateId, 24);
assert_size!(StreamId, 24);
#[cfg(rustc_nightly)]
assert_size!(Candidate, 128);
#[cfg(not(rustc_nightly))]
assert_size!(Candidate, 136);
assert_size!(TransportPayload, 32);
assert_size!(Transport, 88);

View file

@ -52,6 +52,9 @@ mod tests {
#[cfg(target_pointer_width = "64")]
#[test]
fn test_size() {
#[cfg(rustc_nightly)]
assert_size!(StanzaId, 96);
#[cfg(not(rustc_nightly))]
assert_size!(StanzaId, 104);
assert_size!(OriginId, 24);
}