diff --git a/parsers/Cargo.toml b/parsers/Cargo.toml index 97ff0180..a2e5d023 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 00000000..111b92c1 --- /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 1bdb7a0a..41df4f71 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 a78cc0be..f04a8726 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 e481f56f..5d8b4263 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 940db3f3..1187850a 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); }