diff --git a/parsers/Cargo.toml b/parsers/Cargo.toml index 97ff018..a2e5d02 100644 --- a/parsers/Cargo.toml +++ b/parsers/Cargo.toml @@ -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 = [] diff --git a/parsers/build.rs b/parsers/build.rs new file mode 100644 index 0000000..111b92c --- /dev/null +++ b/parsers/build.rs @@ -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"); + } + _ => {} + } +} diff --git a/parsers/src/disco.rs b/parsers/src/disco.rs index 1bdb7a0..41df4f7 100644 --- a/parsers/src/disco.rs +++ b/parsers/src/disco.rs @@ -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); diff --git a/parsers/src/jid_prep.rs b/parsers/src/jid_prep.rs index a78cc0b..f04a872 100644 --- a/parsers/src/jid_prep.rs +++ b/parsers/src/jid_prep.rs @@ -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); } diff --git a/parsers/src/jingle_s5b.rs b/parsers/src/jingle_s5b.rs index e481f56..5d8b426 100644 --- a/parsers/src/jingle_s5b.rs +++ b/parsers/src/jingle_s5b.rs @@ -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); diff --git a/parsers/src/stanza_id.rs b/parsers/src/stanza_id.rs index 940db3f..1187850 100644 --- a/parsers/src/stanza_id.rs +++ b/parsers/src/stanza_id.rs @@ -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); }