Fix assert_next_token on old rustc

This commit is contained in:
David Tolnay 2017-04-10 19:41:32 -07:00
parent f54d597b2e
commit aed5a77540
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 12 additions and 8 deletions

View File

@ -28,17 +28,17 @@ impl<'a> Serializer<'a> {
}
macro_rules! assert_next_token {
($self:ident, $expected:ident($a:expr)) => {
assert_next_token!($self, $expected { a: $a });
($ser:ident, $expected:ident($a:expr)) => {
assert_next_token!($ser, $expected { a: $a });
};
($self:ident, $expected:ident($a:expr, $b:expr)) => {
assert_next_token!($self, $expected { a: $a, b: $b });
($ser:ident, $expected:ident($a:expr, $b:expr)) => {
assert_next_token!($ser, $expected { a: $a, b: $b });
};
($self:ident, $expected:ident($a:expr, $b:expr, $c:expr)) => {
assert_next_token!($self, $expected { a: $a, b: $b, c: $c });
($ser:ident, $expected:ident($a:expr, $b:expr, $c:expr)) => {
assert_next_token!($ser, $expected { a: $a, b: $b, c: $c });
};
($self:ident, $expected:ident $({ $($n:ident: $v:expr),* })*) => {
match $self.next_token() {
($ser:ident, $expected:ident $({ $($n:ident: $v:expr),* })*) => {
match $ser.next_token() {
Some(Token::$expected $(($($n),*))*) $(if $($n == $v)&&*)* => {}
Some(other) => {
panic!("expected Token::{} but serialized as {:?}",

View File

@ -67,10 +67,14 @@ else
cd "$DIR/serde"
channel build --features rc
channel build --no-default-features
cd "$DIR/serde_test"
channel build
CHANNEL=1.13.0
cargo clean
cd "$DIR/serde"
channel build --features rc
channel build --no-default-features
cd "$DIR/serde_test"
channel build
fi