mirror of
https://github.com/pezkuwichain/serde.git
synced 2026-04-23 03:38:00 +00:00
Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 108cca687c | |||
| bca8c115c7 | |||
| b49bd52a53 | |||
| 27bd640812 | |||
| 8d5cda8464 | |||
| 389b9b5fe7 | |||
| 27478b6f71 | |||
| 480f858fc3 | |||
| 7d752c5a60 | |||
| 33b7841300 | |||
| 2244b92eb0 | |||
| d0464fbff7 | |||
| 98eddf9b29 | |||
| d23a40c1bb | |||
| 55cecace29 | |||
| 3da0deaa50 | |||
| 585550a5be | |||
| 5b7b8abf9f | |||
| 2aab0ce2f6 | |||
| a157c56d7d | |||
| 6c45593ee4 | |||
| 1175d54fb7 | |||
| cfdbbee845 | |||
| c1583bf2b8 | |||
| 7385b50249 | |||
| db6aaf5110 | |||
| c4a4501d71 | |||
| a3ae14d090 | |||
| dc4bb0bf08 | |||
| c69a3e083f | |||
| c790bd2a69 |
@@ -18,5 +18,8 @@ matrix:
|
||||
include:
|
||||
- rust: nightly
|
||||
env: CLIPPY=true
|
||||
- rust: nightly
|
||||
env: EMSCRIPTEN=true
|
||||
script: nvm install 9 && ./travis.sh
|
||||
|
||||
script: ./travis.sh
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde"
|
||||
version = "1.0.72" # remember to update html_root_url
|
||||
version = "1.0.77" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "A generic serialization/deserialization framework"
|
||||
|
||||
+7
-1
@@ -11,6 +11,9 @@ fn main() {
|
||||
None => return,
|
||||
};
|
||||
|
||||
let target = env::var("TARGET").unwrap();
|
||||
let emscripten = target == "asmjs-unknown-emscripten" || target == "wasm32-unknown-emscripten";
|
||||
|
||||
// CString::into_boxed_c_str stabilized in Rust 1.20:
|
||||
// https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str
|
||||
if minor >= 20 {
|
||||
@@ -32,7 +35,10 @@ fn main() {
|
||||
|
||||
// 128-bit integers stabilized in Rust 1.26:
|
||||
// https://blog.rust-lang.org/2018/05/10/Rust-1.26.html
|
||||
if minor >= 26 {
|
||||
//
|
||||
// Disabled on Emscripten targets as Emscripten doesn't
|
||||
// currently support integers larger than 64 bits.
|
||||
if minor >= 26 && !emscripten {
|
||||
println!("cargo:rustc-cfg=integer128");
|
||||
}
|
||||
|
||||
|
||||
@@ -2242,10 +2242,17 @@ nonzero_integers! {
|
||||
NonZeroU16,
|
||||
NonZeroU32,
|
||||
NonZeroU64,
|
||||
// FIXME: https://github.com/serde-rs/serde/issues/1136 NonZeroU128,
|
||||
NonZeroUsize,
|
||||
}
|
||||
|
||||
// Currently 128-bit integers do not work on Emscripten targets so we need an
|
||||
// additional `#[cfg]`
|
||||
serde_if_integer128! {
|
||||
nonzero_integers! {
|
||||
NonZeroU128,
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
impl<'de, T, E> Deserialize<'de> for Result<T, E>
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Serde types in rustdoc of other crates get linked to here.
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.72")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde/1.0.77")]
|
||||
// Support using Serde without the standard library!
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
// Unstable functionality only if the user asks for it. For tracking and
|
||||
|
||||
@@ -231,8 +231,8 @@ mod content {
|
||||
|
||||
use super::size_hint;
|
||||
use de::{
|
||||
self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, MapAccess,
|
||||
SeqAccess, Unexpected, Visitor,
|
||||
self, Deserialize, DeserializeSeed, Deserializer, EnumAccess, Expected, IgnoredAny,
|
||||
MapAccess, SeqAccess, Unexpected, Visitor,
|
||||
};
|
||||
|
||||
/// Used from generated code to buffer the contents of the Deserializer when
|
||||
@@ -2470,10 +2470,11 @@ mod content {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn visit_map<M>(self, _: M) -> Result<(), M::Error>
|
||||
fn visit_map<M>(self, mut access: M) -> Result<(), M::Error>
|
||||
where
|
||||
M: MapAccess<'de>,
|
||||
{
|
||||
while let Some(_) = try!(access.next_entry::<IgnoredAny, IgnoredAny>()) {}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,10 +469,17 @@ nonzero_integers! {
|
||||
NonZeroU16,
|
||||
NonZeroU32,
|
||||
NonZeroU64,
|
||||
// FIXME: https://github.com/serde-rs/serde/issues/1136 NonZeroU128,
|
||||
NonZeroUsize,
|
||||
}
|
||||
|
||||
// Currently 128-bit integers do not work on Emscripten targets so we need an
|
||||
// additional `#[cfg]`
|
||||
serde_if_integer128! {
|
||||
nonzero_integers! {
|
||||
NonZeroU128,
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Serialize for Cell<T>
|
||||
where
|
||||
T: Serialize + Copy,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_derive"
|
||||
version = "1.0.72" # remember to update html_root_url
|
||||
version = "1.0.77" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "Macros 1.1 implementation of #[derive(Serialize, Deserialize)]"
|
||||
@@ -25,8 +25,8 @@ proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "0.4"
|
||||
quote = "0.6"
|
||||
syn = { version = "0.14", features = ["visit"] }
|
||||
quote = "0.6.3"
|
||||
syn = { version = "0.15", features = ["visit"] }
|
||||
|
||||
[dev-dependencies]
|
||||
serde = { version = "1.0", path = "../serde" }
|
||||
|
||||
@@ -30,8 +30,9 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result<TokenStream
|
||||
let ident = &cont.ident;
|
||||
let params = Parameters::new(&cont);
|
||||
let (de_impl_generics, _, ty_generics, where_clause) = split_with_de_lifetime(¶ms);
|
||||
let suffix = ident.to_string().trim_left_matches("r#").to_owned();
|
||||
let dummy_const = Ident::new(
|
||||
&format!("_IMPL_DESERIALIZE_FOR_{}", ident),
|
||||
&format!("_IMPL_DESERIALIZE_FOR_{}", suffix),
|
||||
Span::call_site(),
|
||||
);
|
||||
let body = Stmts(deserialize_body(&cont, ¶ms));
|
||||
|
||||
@@ -11,8 +11,8 @@ use proc_macro2::{Group, Span, TokenStream, TokenTree};
|
||||
use std::collections::BTreeSet;
|
||||
use std::str::FromStr;
|
||||
use syn;
|
||||
use syn::parse::{self, Parse, ParseStream};
|
||||
use syn::punctuated::Punctuated;
|
||||
use syn::synom::{ParseError, Synom};
|
||||
use syn::Ident;
|
||||
use syn::Meta::{List, NameValue, Word};
|
||||
use syn::NestedMeta::{Literal, Meta};
|
||||
@@ -90,6 +90,10 @@ pub struct Name {
|
||||
deserialize: String,
|
||||
}
|
||||
|
||||
fn unraw(ident: &Ident) -> String {
|
||||
ident.to_string().trim_left_matches("r#").to_owned()
|
||||
}
|
||||
|
||||
impl Name {
|
||||
/// Return the container name for the container when serializing.
|
||||
pub fn serialize_name(&self) -> String {
|
||||
@@ -380,8 +384,8 @@ impl Container {
|
||||
|
||||
Container {
|
||||
name: Name {
|
||||
serialize: ser_name.get().unwrap_or_else(|| item.ident.to_string()),
|
||||
deserialize: de_name.get().unwrap_or_else(|| item.ident.to_string()),
|
||||
serialize: ser_name.get().unwrap_or_else(|| unraw(&item.ident)),
|
||||
deserialize: de_name.get().unwrap_or_else(|| unraw(&item.ident)),
|
||||
},
|
||||
transparent: transparent.get(),
|
||||
deny_unknown_fields: deny_unknown_fields.get(),
|
||||
@@ -697,8 +701,8 @@ impl Variant {
|
||||
let de_renamed = de_name.is_some();
|
||||
Variant {
|
||||
name: Name {
|
||||
serialize: ser_name.unwrap_or_else(|| variant.ident.to_string()),
|
||||
deserialize: de_name.unwrap_or_else(|| variant.ident.to_string()),
|
||||
serialize: ser_name.unwrap_or_else(|| unraw(&variant.ident)),
|
||||
deserialize: de_name.unwrap_or_else(|| unraw(&variant.ident)),
|
||||
},
|
||||
ser_renamed: ser_renamed,
|
||||
de_renamed: de_renamed,
|
||||
@@ -822,7 +826,7 @@ impl Field {
|
||||
let mut flatten = BoolAttr::none(cx, "flatten");
|
||||
|
||||
let ident = match field.ident {
|
||||
Some(ref ident) => ident.to_string(),
|
||||
Some(ref ident) => unraw(ident),
|
||||
None => index.to_string(),
|
||||
};
|
||||
|
||||
@@ -1296,11 +1300,10 @@ fn parse_lit_into_lifetimes(
|
||||
|
||||
struct BorrowedLifetimes(Punctuated<syn::Lifetime, Token![+]>);
|
||||
|
||||
impl Synom for BorrowedLifetimes {
|
||||
named!(parse -> Self, map!(
|
||||
call!(Punctuated::parse_separated_nonempty),
|
||||
BorrowedLifetimes
|
||||
));
|
||||
impl Parse for BorrowedLifetimes {
|
||||
fn parse(input: ParseStream) -> parse::Result<Self> {
|
||||
Punctuated::parse_separated_nonempty(input).map(BorrowedLifetimes)
|
||||
}
|
||||
}
|
||||
|
||||
if let Ok(BorrowedLifetimes(lifetimes)) = parse_lit_str(string) {
|
||||
@@ -1509,7 +1512,8 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
|
||||
syn::GenericArgument::Binding(ref binding) => {
|
||||
collect_lifetimes(&binding.ty, out);
|
||||
}
|
||||
syn::GenericArgument::Const(_) => {}
|
||||
syn::GenericArgument::Constraint(_)
|
||||
| syn::GenericArgument::Const(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1531,15 +1535,15 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_lit_str<T>(s: &syn::LitStr) -> Result<T, ParseError>
|
||||
fn parse_lit_str<T>(s: &syn::LitStr) -> parse::Result<T>
|
||||
where
|
||||
T: Synom,
|
||||
T: Parse,
|
||||
{
|
||||
let tokens = try!(spanned_tokens(s));
|
||||
syn::parse2(tokens)
|
||||
}
|
||||
|
||||
fn spanned_tokens(s: &syn::LitStr) -> Result<TokenStream, ParseError> {
|
||||
fn spanned_tokens(s: &syn::LitStr) -> parse::Result<TokenStream> {
|
||||
let stream = try!(syn::parse_str(&s.value()));
|
||||
Ok(respan_token_stream(stream, s.span()))
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
//!
|
||||
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.72")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.77")]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||
// Whitelisted clippy lints
|
||||
#![cfg_attr(
|
||||
@@ -81,7 +81,7 @@ mod try;
|
||||
|
||||
#[proc_macro_derive(Serialize, attributes(serde))]
|
||||
pub fn derive_serialize(input: TokenStream) -> TokenStream {
|
||||
let input: DeriveInput = syn::parse(input).unwrap();
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
ser::expand_derive_serialize(&input)
|
||||
.unwrap_or_else(compile_error)
|
||||
.into()
|
||||
@@ -89,7 +89,7 @@ pub fn derive_serialize(input: TokenStream) -> TokenStream {
|
||||
|
||||
#[proc_macro_derive(Deserialize, attributes(serde))]
|
||||
pub fn derive_deserialize(input: TokenStream) -> TokenStream {
|
||||
let input: DeriveInput = syn::parse(input).unwrap();
|
||||
let input = parse_macro_input!(input as DeriveInput);
|
||||
de::expand_derive_deserialize(&input)
|
||||
.unwrap_or_else(compile_error)
|
||||
.into()
|
||||
|
||||
@@ -26,7 +26,11 @@ pub fn expand_derive_serialize(input: &syn::DeriveInput) -> Result<TokenStream,
|
||||
let ident = &cont.ident;
|
||||
let params = Parameters::new(&cont);
|
||||
let (impl_generics, ty_generics, where_clause) = params.generics.split_for_impl();
|
||||
let dummy_const = Ident::new(&format!("_IMPL_SERIALIZE_FOR_{}", ident), Span::call_site());
|
||||
let suffix = ident.to_string().trim_left_matches("r#").to_owned();
|
||||
let dummy_const = Ident::new(
|
||||
&format!("_IMPL_SERIALIZE_FOR_{}", suffix),
|
||||
Span::call_site(),
|
||||
);
|
||||
let body = Stmts(serialize_body(&cont, ¶ms));
|
||||
|
||||
let impl_block = if let Some(remote) = cont.attrs.remote() {
|
||||
|
||||
@@ -16,7 +16,7 @@ path = "lib.rs"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "0.4"
|
||||
syn = { version = "0.14", default-features = false, features = ["derive", "parsing", "clone-impls"] }
|
||||
syn = { version = "0.15", default-features = false, features = ["derive", "parsing", "clone-impls"] }
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "serde-rs/serde" }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "serde_test"
|
||||
version = "1.0.72" # remember to update html_root_url
|
||||
version = "1.0.77" # remember to update html_root_url
|
||||
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
description = "Token De/Serializer for testing De/Serialize implementations"
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
//! # }
|
||||
//! ```
|
||||
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.72")]
|
||||
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.77")]
|
||||
#![cfg_attr(feature = "cargo-clippy", deny(clippy, clippy_pedantic))]
|
||||
// Whitelisted clippy lints
|
||||
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(lang_items, start, panic_implementation)]
|
||||
#![feature(lang_items, start, panic_handler)]
|
||||
#![no_std]
|
||||
|
||||
extern crate libc;
|
||||
@@ -20,7 +20,7 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rust_eh_personality() {}
|
||||
|
||||
#[panic_implementation]
|
||||
#[panic_handler]
|
||||
fn panic(_info: &core::panic::PanicInfo) -> ! {
|
||||
unsafe {
|
||||
libc::abort();
|
||||
|
||||
@@ -20,7 +20,7 @@ mod remote {
|
||||
#[serde(remote = "remote::S")]
|
||||
struct S {
|
||||
a: u8,
|
||||
//~^^^^ ERROR: missing field `b` in initializer of `remote::S`
|
||||
//~^^^ ERROR: missing field `b` in initializer of `remote::S`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -18,9 +18,9 @@ mod remote {
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(remote = "remote::S")]
|
||||
struct S {
|
||||
//~^^^ ERROR: struct `remote::S` has no field named `b`
|
||||
b: u8,
|
||||
//~^^^^^ ERROR: no field `b` on type `&remote::S`
|
||||
//~^ ERROR: struct `remote::S` has no field named `b`
|
||||
//~^^ ERROR: no field `b` on type `&remote::S`
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
||||
@@ -2246,3 +2246,68 @@ fn test_transparent_tuple_struct() {
|
||||
|
||||
assert_tokens(&Transparent(false, 1, false, PhantomData), &[Token::U32(1)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_internally_tagged_unit_enum_with_unknown_fields() {
|
||||
#[derive(Deserialize, PartialEq, Debug)]
|
||||
#[serde(tag = "t")]
|
||||
enum Data {
|
||||
A,
|
||||
}
|
||||
|
||||
let data = Data::A;
|
||||
|
||||
assert_de_tokens(
|
||||
&data,
|
||||
&[
|
||||
Token::Map { len: None },
|
||||
Token::Str("t"),
|
||||
Token::Str("A"),
|
||||
Token::Str("b"),
|
||||
Token::I32(0),
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_flattened_internally_tagged_unit_enum_with_unknown_fields() {
|
||||
#[derive(Deserialize, PartialEq, Debug)]
|
||||
struct S {
|
||||
#[serde(flatten)]
|
||||
x: X,
|
||||
#[serde(flatten)]
|
||||
y: Y,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, PartialEq, Debug)]
|
||||
#[serde(tag = "typeX")]
|
||||
enum X {
|
||||
A,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, PartialEq, Debug)]
|
||||
#[serde(tag = "typeY")]
|
||||
enum Y {
|
||||
B { c: u32 },
|
||||
}
|
||||
|
||||
let s = S {
|
||||
x: X::A,
|
||||
y: Y::B { c: 0 },
|
||||
};
|
||||
|
||||
assert_de_tokens(
|
||||
&s,
|
||||
&[
|
||||
Token::Map { len: None },
|
||||
Token::Str("typeX"),
|
||||
Token::Str("A"),
|
||||
Token::Str("typeY"),
|
||||
Token::Str("B"),
|
||||
Token::Str("c"),
|
||||
Token::I32(0),
|
||||
Token::MapEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -156,8 +156,12 @@ macro_rules! declare_tests {
|
||||
)+
|
||||
};
|
||||
|
||||
($($name:ident { $($value:expr => $tokens:expr,)+ })+) => {
|
||||
($(
|
||||
$(#[$cfg:meta])*
|
||||
$name:ident { $($value:expr => $tokens:expr,)+ }
|
||||
)+) => {
|
||||
$(
|
||||
$(#[$cfg])*
|
||||
#[test]
|
||||
fn $name() {
|
||||
$(
|
||||
@@ -260,6 +264,7 @@ declare_tests! {
|
||||
0f32 => &[Token::F32(0.)],
|
||||
0f64 => &[Token::F64(0.)],
|
||||
}
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
test_small_int_to_128 {
|
||||
1i128 => &[Token::I8(1)],
|
||||
1i128 => &[Token::I16(1)],
|
||||
|
||||
@@ -618,6 +618,7 @@ fn test_enum_skipped() {
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[test]
|
||||
fn test_integer128() {
|
||||
assert_ser_tokens_error(&1i128, &[], "i128 is not supported");
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2018 Serde Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![deny(warnings)]
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
|
||||
#[cfg(feature = "unstable")]
|
||||
extern crate serde;
|
||||
#[cfg(feature = "unstable")]
|
||||
extern crate serde_test;
|
||||
|
||||
// This test target is convoluted with the actual #[test] in a separate file to
|
||||
// get it so that the stable compiler does not need to parse the code of the
|
||||
// test. If the test were written with #[cfg(feature = "unstable")] #[test]
|
||||
// right here, the stable compiler would fail to parse those raw identifiers
|
||||
// even if the cfg were not enabled.
|
||||
#[cfg(feature = "unstable")]
|
||||
mod unstable;
|
||||
@@ -26,6 +26,7 @@ fn test_u32_to_enum() {
|
||||
assert_eq!(E::B, e);
|
||||
}
|
||||
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
#[test]
|
||||
fn test_integer128() {
|
||||
let de_u128 = IntoDeserializer::<value::Error>::into_deserializer(1u128);
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
// Copyright 2018 Serde Developers
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use serde_test::{assert_tokens, Token};
|
||||
|
||||
#[test]
|
||||
fn test_raw_identifiers() {
|
||||
#[derive(Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[allow(non_camel_case_types)]
|
||||
enum r#type {
|
||||
r#type { r#type: () },
|
||||
}
|
||||
|
||||
assert_tokens(
|
||||
&r#type::r#type { r#type: () },
|
||||
&[
|
||||
Token::StructVariant {
|
||||
name: "type",
|
||||
variant: "type",
|
||||
len: 1,
|
||||
},
|
||||
Token::Str("type"),
|
||||
Token::Unit,
|
||||
Token::StructVariantEnd,
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -42,6 +42,18 @@ if [ -n "${CLIPPY}" ]; then
|
||||
|
||||
cd "$DIR/test_suite/no_std"
|
||||
cargo clippy -- -Dclippy
|
||||
elif [ -n "${EMSCRIPTEN}" ]; then
|
||||
CARGO_WEB_RELEASE=$(curl -L -s -H 'Accept: application/json' https://github.com/koute/cargo-web/releases/latest)
|
||||
CARGO_WEB_VERSION=$(echo "${CARGO_WEB_RELEASE}" | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/')
|
||||
CARGO_WEB_URL="https://github.com/koute/cargo-web/releases/download/${CARGO_WEB_VERSION}/cargo-web-x86_64-unknown-linux-gnu.gz"
|
||||
|
||||
mkdir -p ~/.cargo/bin
|
||||
echo "Downloading cargo-web from: ${CARGO_WEB_URL}"
|
||||
curl -L "${CARGO_WEB_URL}" | gzip -d > ~/.cargo/bin/cargo-web
|
||||
chmod +x ~/.cargo/bin/cargo-web
|
||||
|
||||
cd "$DIR/test_suite"
|
||||
cargo web test --target=wasm32-unknown-emscripten --nodejs
|
||||
else
|
||||
CHANNEL=nightly
|
||||
cd "$DIR"
|
||||
@@ -50,6 +62,7 @@ else
|
||||
channel build
|
||||
channel build --no-default-features
|
||||
channel build --no-default-features --features alloc
|
||||
channel build --no-default-features --features 'rc alloc'
|
||||
channel test --features 'rc unstable'
|
||||
cd "$DIR/test_suite/deps"
|
||||
channel build
|
||||
|
||||
Reference in New Issue
Block a user