Compare commits

...

24 Commits

Author SHA1 Message Date
David Tolnay 17c3c0cf86 Release 1.0.137 2022-04-30 21:45:31 -07:00
David Tolnay 210e6c354e Clean up clippy allows which are superseded by msrv in clippy.toml 2022-04-30 21:35:00 -07:00
David Tolnay 41823a96df Ignore more type_repetition_in_bounds
I'm not sure what is going on with this lint but it's triggering in a
lot of test code. Will need to investigate further.

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:194:21
        |
    194 |             bound = "E: SerializeWith + DeserializeWith"
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
        = help: consider combining the bounds: `"E: SerializeWith + DeserializeWith": "E: SerializeWith + DeserializeWith" + "E: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:184:21
        |
    184 |     #[serde(bound = "D: SerializeWith + DeserializeWith")]
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith + DeserializeWith": "D: SerializeWith + DeserializeWith" + "D: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:210:31
        |
    210 |             bound(serialize = "E: SerializeWith")
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"E: SerializeWith": "E: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:201:31
        |
    201 |     #[serde(bound(serialize = "D: SerializeWith", deserialize = "D: DeserializeWith"))]
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith": "D: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:231:21
        |
    231 |             bound = "E: SerializeWith + DeserializeWith"
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"E: SerializeWith + DeserializeWith": "E: SerializeWith + DeserializeWith" + "E: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:221:21
        |
    221 |     #[serde(bound = "D: SerializeWith + DeserializeWith")]
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith + DeserializeWith": "D: SerializeWith + DeserializeWith" + "D: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:247:31
        |
    247 |             bound(serialize = "E: SerializeWith")
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"E: SerializeWith": "E: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:238:31
        |
    238 |     #[serde(bound(serialize = "D: SerializeWith", deserialize = "D: DeserializeWith"))]
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith": "D: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
      --> test_suite/tests/test_annotations.rs:84:5
       |
    84 |     C: MyDefault,
       |     ^^^^^^^^^^^^
       |
       = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
       = help: consider combining the bounds: `C: MyDefault`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
      --> test_suite/tests/test_annotations.rs:85:5
       |
    85 |     E: MyDefault,
       |     ^^^^^^^^^^^^
       |
       = help: consider combining the bounds: `E: MyDefault`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_annotations.rs:105:5
        |
    105 |     C: MyDefault;
        |     ^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `C: MyDefault`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1066:5
         |
    1066 |     B: 'a,
         |     ^^^^^
         |
         = help: consider combining the bounds: ``
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1067:5
         |
    1067 |     D: SerializeWith,
         |     ^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `D: SerializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1106:5
         |
    1106 |     B: SerializeWith,
         |     ^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `B: SerializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1150:5
         |
    1150 |     B: SerializeWith,
         |     ^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `B: SerializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1368:5
         |
    1368 |     B: DeserializeWith,
         |     ^^^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `B: DeserializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds
2022-04-30 21:32:36 -07:00
David Tolnay 7ca13ff240 Ignore type_repetition_in_bounds lint that is incompatible with msrv
https://github.com/rust-lang/rust-clippy/issues/8772
2022-04-30 21:32:26 -07:00
David Tolnay 52391fd868 Inform clippy of supported compiler version in clippy.toml 2022-04-30 20:40:23 -07:00
David Tolnay 9b2d8dfc6b Add a miri test job in CI 2022-04-28 20:43:03 -07:00
David Tolnay 07ba7ea8dd Update workflows to actions/checkout@v3 2022-04-24 19:06:18 -07:00
David Tolnay 9f29f6bb4a Disable expandtest on miri 2022-04-24 16:01:52 -07:00
David Tolnay f6c104fd1d Ignore unused ignore attribute warning in some configurations 2022-04-24 16:01:22 -07:00
David Tolnay 8a3a6fb101 Disable ui test on miri 2022-04-24 15:21:17 -07:00
David Tolnay b5c3b5e8e5 Update ui test suite to nightly-2022-04-17 2022-04-16 23:48:27 -07:00
David Tolnay 996d171461 Merge pull request #2201 from atouchet/urls
Update some URLs
2022-04-14 02:50:36 -07:00
Alex Touchet e1c4517335 Update some URLs 2022-04-13 21:42:37 -07:00
David Tolnay 6e94a27c76 Merge pull request #2194 from serde-rs/exhaustive
Update exhaustive matching to syn 1.0.90
2022-03-28 10:27:27 -07:00
David Tolnay b23a768414 Update exhaustive matching to syn 1.0.90 2022-03-28 10:21:37 -07:00
David Tolnay 7e19ae8c94 Fix rust-version in serde_test Cargo.toml too
#2168
2022-01-25 14:49:56 -08:00
David Tolnay 404a1d142a Fix rust-version in Cargo.toml
Closes #2168.
2022-01-25 14:42:09 -08:00
David Tolnay 02bd79a0ba Release 1.0.136 2022-01-25 13:34:29 -08:00
David Tolnay c3ce2c934a Merge pull request #2167 from serde-rs/error128
Render 128-bit integer value into Visitor errors
2022-01-25 13:07:01 -08:00
David Tolnay 0d71ac84b5 Render 128-bit integer value into Visitor errors 2022-01-25 12:06:35 -08:00
David Tolnay 82c3eb7ba4 Add test of visitor error messages 2022-01-25 11:24:53 -08:00
David Tolnay 8932c852a5 Release 1.0.135 2022-01-22 16:04:17 -08:00
David Tolnay 9f3dd3c7c4 Merge pull request #2163 from serde-rs/discord
Add discord invite links
2022-01-22 11:23:32 -08:00
David Tolnay dd9b415ff9 Add discord invite links 2022-01-22 11:21:08 -08:00
28 changed files with 182 additions and 72 deletions
+28 -11
View File
@@ -13,7 +13,7 @@ jobs:
name: Test suite name: Test suite
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- run: cd test_suite && cargo test --features unstable - run: cd test_suite && cargo test --features unstable
@@ -21,7 +21,7 @@ jobs:
name: Test suite (windows) name: Test suite (windows)
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- run: cd test_suite && cargo test --features unstable -- --skip ui --exact - run: cd test_suite && cargo test --features unstable -- --skip ui --exact
@@ -33,7 +33,7 @@ jobs:
matrix: matrix:
rust: [stable, beta] rust: [stable, beta]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{matrix.rust}} toolchain: ${{matrix.rust}}
@@ -50,7 +50,7 @@ jobs:
matrix: matrix:
os: [ubuntu, windows] os: [ubuntu, windows]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- run: cd serde && cargo build - run: cd serde && cargo build
- run: cd serde && cargo build --no-default-features - run: cd serde && cargo build --no-default-features
@@ -59,12 +59,16 @@ jobs:
- run: cd serde && cargo test --features derive,rc,unstable - run: cd serde && cargo test --features derive,rc,unstable
- run: cd test_suite/no_std && cargo build - run: cd test_suite/no_std && cargo build
if: matrix.os != 'windows' if: matrix.os != 'windows'
- run: cd serde_derive && cargo check --tests
env:
RUSTFLAGS: --cfg exhaustive ${{env.RUSTFLAGS}}
if: matrix.os != 'windows'
msrv: msrv:
name: Rust 1.13.0 name: Rust 1.13.0
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.13.0 - uses: dtolnay/rust-toolchain@1.13.0
- name: Get timestamp for cache - name: Get timestamp for cache
id: date id: date
@@ -85,7 +89,7 @@ jobs:
matrix: matrix:
rust: [1.19.0, 1.20.0, 1.21.0, 1.25.0, 1.26.0, 1.34.0] rust: [1.19.0, 1.20.0, 1.21.0, 1.25.0, 1.26.0, 1.34.0]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{matrix.rust}} toolchain: ${{matrix.rust}}
@@ -100,7 +104,7 @@ jobs:
matrix: matrix:
rust: [1.27.0, 1.28.0] rust: [1.27.0, 1.28.0]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{matrix.rust}} toolchain: ${{matrix.rust}}
@@ -113,7 +117,7 @@ jobs:
name: Rust 1.31.0 name: Rust 1.31.0
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.31.0 - uses: dtolnay/rust-toolchain@1.31.0
- run: cd serde && cargo check --no-default-features - run: cd serde && cargo check --no-default-features
- run: cd serde && cargo check - run: cd serde && cargo check
@@ -123,7 +127,7 @@ jobs:
name: Rust 1.36.0 name: Rust 1.36.0
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.36.0 - uses: dtolnay/rust-toolchain@1.36.0
- run: cd serde && cargo build --no-default-features --features alloc - run: cd serde && cargo build --no-default-features --features alloc
@@ -131,7 +135,7 @@ jobs:
name: Emscripten name: Emscripten
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
@@ -154,7 +158,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@clippy - uses: dtolnay/rust-toolchain@clippy
- run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic - run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic
- run: cd serde_derive && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd serde_derive && cargo clippy -- -Dclippy::all -Dclippy::pedantic
@@ -162,3 +166,16 @@ jobs:
- run: cd serde_test && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd serde_test && cargo clippy -- -Dclippy::all -Dclippy::pedantic
- run: cd test_suite && cargo clippy --tests --features unstable -- -Dclippy::all -Dclippy::pedantic - run: cd test_suite && cargo clippy --tests --features unstable -- -Dclippy::all -Dclippy::pedantic
- run: cd test_suite/no_std && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd test_suite/no_std && cargo clippy -- -Dclippy::all -Dclippy::pedantic
miri:
name: Miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@miri
- run: cd serde && cargo miri test --features derive,rc,unstable
env:
MIRIFLAGS: -Zmiri-tag-raw-pointers
- run: cd test_suite && cargo miri test --features unstable
env:
MIRIFLAGS: -Zmiri-tag-raw-pointers
+12 -9
View File
@@ -77,17 +77,20 @@ fn main() {
Serde is one of the most widely used Rust libraries so any place that Rustaceans Serde is one of the most widely used Rust libraries so any place that Rustaceans
congregate will be able to help you out. For chat, consider trying the congregate will be able to help you out. For chat, consider trying the
[#general] or [#beginners] channels of the unofficial community Discord, the [#rust-questions] or [#rust-beginners] channels of the unofficial community
[#rust-usage] channel of the official Rust Project Discord, or the Discord (invite: <https://discord.gg/rust-lang-community>), the [#rust-usage] or
[#general][zulip] stream in Zulip. For asynchronous, consider the [\[rust\] tag [#beginners] channels of the official Rust Project Discord (invite:
on StackOverflow][stackoverflow], the [/r/rust] subreddit which has a pinned <https://discord.gg/rust-lang>), or the [#general][zulip] stream in Zulip. For
weekly easy questions post, or the Rust [Discourse forum][discourse]. It's asynchronous, consider the [\[rust\] tag on StackOverflow][stackoverflow], the
acceptable to file a support issue in this repo but they tend not to get as many [/r/rust] subreddit which has a pinned weekly easy questions post, or the Rust
eyes as any of the above and may get closed without a response after some time. [Discourse forum][discourse]. It's acceptable to file a support issue in this
repo but they tend not to get as many eyes as any of the above and may get
closed without a response after some time.
[#general]: https://discord.com/channels/273534239310479360/274215136414400513 [#rust-questions]: https://discord.com/channels/273534239310479360/274215136414400513
[#beginners]: https://discord.com/channels/273534239310479360/273541522815713281 [#rust-beginners]: https://discord.com/channels/273534239310479360/273541522815713281
[#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848 [#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848
[#beginners]: https://discord.com/channels/442252698964721669/448238009733742612
[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general [zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general
[stackoverflow]: https://stackoverflow.com/questions/tagged/rust [stackoverflow]: https://stackoverflow.com/questions/tagged/rust
[/r/rust]: https://www.reddit.com/r/rust [/r/rust]: https://www.reddit.com/r/rust
+12 -9
View File
@@ -45,17 +45,20 @@ fn main() {
Serde is one of the most widely used Rust libraries so any place that Rustaceans Serde is one of the most widely used Rust libraries so any place that Rustaceans
congregate will be able to help you out. For chat, consider trying the congregate will be able to help you out. For chat, consider trying the
[#general] or [#beginners] channels of the unofficial community Discord, the [#rust-questions] or [#rust-beginners] channels of the unofficial community
[#rust-usage] channel of the official Rust Project Discord, or the Discord (invite: <https://discord.gg/rust-lang-community>, the [#rust-usage] or
[#general][zulip] stream in Zulip. For asynchronous, consider the [\[rust\] tag [#beginners] channels of the official Rust Project Discord (invite:
on StackOverflow][stackoverflow], the [/r/rust] subreddit which has a pinned <https://discord.gg/rust-lang>), or the [#general][zulip] stream in Zulip. For
weekly easy questions post, or the Rust [Discourse forum][discourse]. It's asynchronous, consider the [\[rust\] tag on StackOverflow][stackoverflow], the
acceptable to file a support issue in this repo but they tend not to get as many [/r/rust] subreddit which has a pinned weekly easy questions post, or the Rust
eyes as any of the above and may get closed without a response after some time. [Discourse forum][discourse]. It's acceptable to file a support issue in this
repo but they tend not to get as many eyes as any of the above and may get
closed without a response after some time.
[#general]: https://discord.com/channels/273534239310479360/274215136414400513 [#rust-questions]: https://discord.com/channels/273534239310479360/274215136414400513
[#beginners]: https://discord.com/channels/273534239310479360/273541522815713281 [#rust-beginners]: https://discord.com/channels/273534239310479360/273541522815713281
[#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848 [#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848
[#beginners]: https://discord.com/channels/442252698964721669/448238009733742612
[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general [zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general
[stackoverflow]: https://stackoverflow.com/questions/tagged/rust [stackoverflow]: https://stackoverflow.com/questions/tagged/rust
[/r/rust]: https://www.reddit.com/r/rust [/r/rust]: https://www.reddit.com/r/rust
+1
View File
@@ -0,0 +1 @@
msrv = "1.13.0"
+3 -3
View File
@@ -1,8 +1,8 @@
[package] [package]
name = "serde" name = "serde"
version = "1.0.134" # remember to update html_root_url and serde_derive dependency version = "1.0.137" # remember to update html_root_url and serde_derive dependency
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
rust-version = "1.15" rust-version = "1.13"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "A generic serialization/deserialization framework" description = "A generic serialization/deserialization framework"
homepage = "https://serde.rs" homepage = "https://serde.rs"
@@ -15,7 +15,7 @@ include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APAC
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
serde_derive = { version = "=1.0.134", optional = true, path = "../serde_derive" } serde_derive = { version = "=1.0.137", optional = true, path = "../serde_derive" }
[dev-dependencies] [dev-dependencies]
serde_derive = { version = "1.0", path = "../serde_derive" } serde_derive = { version = "1.0", path = "../serde_derive" }
+30
View File
@@ -0,0 +1,30 @@
use lib::fmt::{self, Write};
use lib::str;
pub struct Buf<'a> {
bytes: &'a mut [u8],
offset: usize,
}
impl<'a> Buf<'a> {
pub fn new(bytes: &'a mut [u8]) -> Self {
Buf { bytes, offset: 0 }
}
pub fn as_str(&self) -> &str {
let slice = &self.bytes[..self.offset];
unsafe { str::from_utf8_unchecked(slice) }
}
}
impl<'a> Write for Buf<'a> {
fn write_str(&mut self, s: &str) -> fmt::Result {
if self.offset + s.len() > self.bytes.len() {
Err(fmt::Error)
} else {
self.bytes[self.offset..self.offset + s.len()].copy_from_slice(s.as_bytes());
self.offset += s.len();
Ok(())
}
}
}
+11 -5
View File
@@ -104,7 +104,7 @@
//! [`Deserialize`]: ../trait.Deserialize.html //! [`Deserialize`]: ../trait.Deserialize.html
//! [`Deserializer`]: ../trait.Deserializer.html //! [`Deserializer`]: ../trait.Deserializer.html
//! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html //! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html
//! [`bincode`]: https://github.com/servo/bincode //! [`bincode`]: https://github.com/bincode-org/bincode
//! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map //! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map
//! [`serde_derive`]: https://crates.io/crates/serde_derive //! [`serde_derive`]: https://crates.io/crates/serde_derive
//! [`serde_json`]: https://github.com/serde-rs/json //! [`serde_json`]: https://github.com/serde-rs/json
@@ -118,6 +118,8 @@ use lib::*;
pub mod value; pub mod value;
#[cfg(not(no_integer128))]
mod format;
mod ignored_any; mod ignored_any;
mod impls; mod impls;
mod utf8; mod utf8;
@@ -1366,8 +1368,10 @@ pub trait Visitor<'de>: Sized {
where where
E: Error, E: Error,
{ {
let _ = v; let mut buf = [0u8; 58];
Err(Error::invalid_type(Unexpected::Other("i128"), &self)) let mut writer = format::Buf::new(&mut buf);
fmt::Write::write_fmt(&mut writer, format_args!("integer `{}` as i128", v)).unwrap();
Err(Error::invalid_type(Unexpected::Other(writer.as_str()), &self))
} }
} }
@@ -1426,8 +1430,10 @@ pub trait Visitor<'de>: Sized {
where where
E: Error, E: Error,
{ {
let _ = v; let mut buf = [0u8; 57];
Err(Error::invalid_type(Unexpected::Other("u128"), &self)) let mut writer = format::Buf::new(&mut buf);
fmt::Write::write_fmt(&mut writer, format_args!("integer `{}` as u128", v)).unwrap();
Err(Error::invalid_type(Unexpected::Other(writer.as_str()), &self))
} }
} }
+5 -7
View File
@@ -59,14 +59,14 @@
//! and from DynamoDB. //! and from DynamoDB.
//! //!
//! [JSON]: https://github.com/serde-rs/json //! [JSON]: https://github.com/serde-rs/json
//! [Bincode]: https://github.com/servo/bincode //! [Bincode]: https://github.com/bincode-org/bincode
//! [CBOR]: https://github.com/enarx/ciborium //! [CBOR]: https://github.com/enarx/ciborium
//! [YAML]: https://github.com/dtolnay/serde-yaml //! [YAML]: https://github.com/dtolnay/serde-yaml
//! [MessagePack]: https://github.com/3Hren/msgpack-rust //! [MessagePack]: https://github.com/3Hren/msgpack-rust
//! [TOML]: https://github.com/alexcrichton/toml-rs //! [TOML]: https://github.com/alexcrichton/toml-rs
//! [Pickle]: https://github.com/birkenfeld/serde-pickle //! [Pickle]: https://github.com/birkenfeld/serde-pickle
//! [RON]: https://github.com/ron-rs/ron //! [RON]: https://github.com/ron-rs/ron
//! [BSON]: https://github.com/zonyitoo/bson-rs //! [BSON]: https://github.com/mongodb/bson-rust
//! [Avro]: https://github.com/flavray/avro-rs //! [Avro]: https://github.com/flavray/avro-rs
//! [JSON5]: https://github.com/callum-oakley/json5-rs //! [JSON5]: https://github.com/callum-oakley/json5-rs
//! [Postcard]: https://github.com/jamesmunns/postcard //! [Postcard]: https://github.com/jamesmunns/postcard
@@ -74,7 +74,7 @@
//! [Envy]: https://github.com/softprops/envy //! [Envy]: https://github.com/softprops/envy
//! [Envy Store]: https://github.com/softprops/envy-store //! [Envy Store]: https://github.com/softprops/envy-store
//! [Cargo]: https://doc.rust-lang.org/cargo/reference/manifest.html //! [Cargo]: https://doc.rust-lang.org/cargo/reference/manifest.html
//! [AWS Parameter Store]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html //! [AWS Parameter Store]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
//! [S-expressions]: https://github.com/rotty/lexpr-rs //! [S-expressions]: https://github.com/rotty/lexpr-rs
//! [D-Bus]: https://docs.rs/zvariant //! [D-Bus]: https://docs.rs/zvariant
//! [FlexBuffers]: https://github.com/google/flatbuffers/tree/master/rust/flexbuffers //! [FlexBuffers]: https://github.com/google/flatbuffers/tree/master/rust/flexbuffers
@@ -84,7 +84,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here. // Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.134")] #![doc(html_root_url = "https://docs.rs/serde/1.0.137")]
// Support using Serde without the standard library! // Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and // Unstable functionality only if the user asks for it. For tracking and
@@ -103,10 +103,8 @@
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/7768 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/7768
semicolon_if_nothing_returned, semicolon_if_nothing_returned,
// not available in our oldest supported compiler // not available in our oldest supported compiler
checked_conversions,
empty_enum, empty_enum,
redundant_field_names, type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/8772
redundant_static_lifetimes,
// integer and float ser/de requires these sorts of casts // integer and float ser/de requires these sorts of casts
cast_possible_truncation, cast_possible_truncation,
cast_possible_wrap, cast_possible_wrap,
+1 -1
View File
@@ -99,7 +99,7 @@
//! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html //! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html
//! [`Serialize`]: ../trait.Serialize.html //! [`Serialize`]: ../trait.Serialize.html
//! [`Serializer`]: ../trait.Serializer.html //! [`Serializer`]: ../trait.Serializer.html
//! [`bincode`]: https://github.com/servo/bincode //! [`bincode`]: https://github.com/bincode-org/bincode
//! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map //! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map
//! [`serde_derive`]: https://crates.io/crates/serde_derive //! [`serde_derive`]: https://crates.io/crates/serde_derive
//! [`serde_json`]: https://github.com/serde-rs/json //! [`serde_json`]: https://github.com/serde-rs/json
+1
View File
@@ -0,0 +1 @@
msrv = "1.31.0"
+2 -2
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde_derive" name = "serde_derive"
version = "1.0.134" # remember to update html_root_url version = "1.0.137" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
rust-version = "1.31" rust-version = "1.31"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@@ -23,7 +23,7 @@ proc-macro = true
[dependencies] [dependencies]
proc-macro2 = "1.0" proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
syn = "1.0.60" syn = "1.0.90"
[dev-dependencies] [dev-dependencies]
serde = { version = "1.0", path = "../serde" } serde = { version = "1.0", path = "../serde" }
+1 -3
View File
@@ -184,9 +184,7 @@ pub fn with_bound(
syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {} syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
syn::Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }
+1 -3
View File
@@ -1912,9 +1912,7 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
| syn::Type::Infer(_) | syn::Type::Infer(_)
| syn::Type::Verbatim(_) => {} | syn::Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
syn::Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }
+1 -3
View File
@@ -147,9 +147,7 @@ impl ReplaceReceiver<'_> {
Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {} Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }
+2 -1
View File
@@ -13,7 +13,7 @@
//! //!
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html //! [https://serde.rs/derive.html]: https://serde.rs/derive.html
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.134")] #![doc(html_root_url = "https://docs.rs/serde_derive/1.0.137")]
#![allow(unknown_lints, bare_trait_objects)] #![allow(unknown_lints, bare_trait_objects)]
// Ignored clippy lints // Ignored clippy lints
#![allow( #![allow(
@@ -60,6 +60,7 @@
clippy::use_self, clippy::use_self,
clippy::wildcard_imports clippy::wildcard_imports
)] )]
#![cfg_attr(all(test, exhaustive), feature(non_exhaustive_omitted_patterns_lint))]
#[macro_use] #[macro_use]
extern crate quote; extern crate quote;
+1
View File
@@ -0,0 +1 @@
msrv = "1.31.0"
+1 -1
View File
@@ -17,7 +17,7 @@ path = "lib.rs"
[dependencies] [dependencies]
proc-macro2 = "1.0" proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
syn = { version = "1.0.60", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] } syn = { version = "1.0.90", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
+1
View File
@@ -0,0 +1 @@
msrv = "1.13.0"
+2 -2
View File
@@ -1,8 +1,8 @@
[package] [package]
name = "serde_test" name = "serde_test"
version = "1.0.134" # remember to update html_root_url version = "1.0.137" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
rust-version = "1.15" rust-version = "1.13"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Token De/Serializer for testing De/Serialize implementations" description = "Token De/Serializer for testing De/Serialize implementations"
homepage = "https://serde.rs" homepage = "https://serde.rs"
+2 -1
View File
@@ -144,7 +144,7 @@
//! # } //! # }
//! ``` //! ```
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.134")] #![doc(html_root_url = "https://docs.rs/serde_test/1.0.137")]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
// Ignored clippy lints // Ignored clippy lints
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))] #![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))]
@@ -161,6 +161,7 @@
must_use_candidate, must_use_candidate,
redundant_field_names, redundant_field_names,
too_many_lines, too_many_lines,
type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/8772
use_debug, use_debug,
use_self use_self
) )
+2
View File
@@ -1,5 +1,7 @@
#[cfg_attr(target_os = "emscripten", ignore)] #[cfg_attr(target_os = "emscripten", ignore)]
#[rustversion::attr(not(nightly), ignore)] #[rustversion::attr(not(nightly), ignore)]
#[cfg_attr(miri, ignore)]
#[allow(unused_attributes)]
#[test] #[test]
fn ui() { fn ui() {
let t = trybuild::TestCases::new(); let t = trybuild::TestCases::new();
+1
View File
@@ -1,6 +1,7 @@
#[cfg_attr(target_os = "emscripten", ignore)] #[cfg_attr(target_os = "emscripten", ignore)]
#[cfg_attr(not(expandtest), ignore)] #[cfg_attr(not(expandtest), ignore)]
#[rustversion::attr(not(nightly), ignore)] #[rustversion::attr(not(nightly), ignore)]
#[cfg_attr(miri, ignore)]
#[allow(unused_attributes)] #[allow(unused_attributes)]
#[test] #[test]
fn expandtest() { fn expandtest() {
+2 -1
View File
@@ -4,7 +4,8 @@
// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422
clippy::nonstandard_macro_braces, clippy::nonstandard_macro_braces,
clippy::too_many_lines, clippy::too_many_lines,
clippy::trivially_copy_pass_by_ref clippy::trivially_copy_pass_by_ref,
clippy::type_repetition_in_bounds
)] )]
use serde::de::{self, MapAccess, Unexpected, Visitor}; use serde::de::{self, MapAccess, Unexpected, Visitor};
+25
View File
@@ -1,6 +1,7 @@
#![allow(clippy::empty_enum, clippy::unreadable_literal)] #![allow(clippy::empty_enum, clippy::unreadable_literal)]
#![cfg_attr(feature = "unstable", feature(never_type))] #![cfg_attr(feature = "unstable", feature(never_type))]
use serde::de::IntoDeserializer;
use serde::Deserialize; use serde::Deserialize;
use serde_test::{assert_de_tokens_error, Token}; use serde_test::{assert_de_tokens_error, Token};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
@@ -185,6 +186,16 @@ fn test_i64() {
); );
} }
#[test]
fn test_i128() {
let deserializer = <i128 as IntoDeserializer>::into_deserializer(1);
let error = <&str>::deserialize(deserializer).unwrap_err();
assert_eq!(
error.to_string(),
"invalid type: integer `1` as i128, expected a borrowed string",
);
}
#[test] #[test]
fn test_u8() { fn test_u8() {
let test = assert_de_tokens_error::<u8>; let test = assert_de_tokens_error::<u8>;
@@ -326,6 +337,13 @@ fn test_u64() {
&[Token::I64(-1)], &[Token::I64(-1)],
"invalid value: integer `-1`, expected u64", "invalid value: integer `-1`, expected u64",
); );
let deserializer = <u64 as IntoDeserializer>::into_deserializer(1);
let error = <&str>::deserialize(deserializer).unwrap_err();
assert_eq!(
error.to_string(),
"invalid type: integer `1`, expected a borrowed string",
);
} }
#[test] #[test]
@@ -349,6 +367,13 @@ fn test_u128() {
&[Token::I64(-1)], &[Token::I64(-1)],
"invalid value: integer `-1`, expected u128", "invalid value: integer `-1`, expected u128",
); );
let deserializer = <u128 as IntoDeserializer>::into_deserializer(1);
let error = <&str>::deserialize(deserializer).unwrap_err();
assert_eq!(
error.to_string(),
"invalid type: integer `1` as u128, expected a borrowed string",
);
} }
#[test] #[test]
+2 -1
View File
@@ -14,7 +14,8 @@
clippy::nonstandard_macro_braces, clippy::nonstandard_macro_braces,
clippy::ptr_arg, clippy::ptr_arg,
clippy::too_many_lines, clippy::too_many_lines,
clippy::trivially_copy_pass_by_ref clippy::trivially_copy_pass_by_ref,
clippy::type_repetition_in_bounds
)] )]
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
@@ -3,7 +3,14 @@ error[E0308]: mismatched types
| |
7 | #[derive(Deserialize)] 7 | #[derive(Deserialize)]
| ^^^^^^^^^^^ expected `u16`, found `u8` | ^^^^^^^^^^^ expected `u16`, found `u8`
8 | #[serde(remote = "remote::S")]
| ----------- arguments to this struct are incorrect
| |
note: tuple struct defined here
--> tests/ui/remote/wrong_de.rs:4:16
|
4 | pub struct S(pub u16);
| ^
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert a `u8` to a `u16` help: you can convert a `u8` to a `u16`
| |
@@ -2,8 +2,16 @@ error[E0308]: mismatched types
--> tests/ui/remote/wrong_getter.rs:15:10 --> tests/ui/remote/wrong_getter.rs:15:10
| |
15 | #[derive(Serialize)] 15 | #[derive(Serialize)]
| ^^^^^^^^^ expected `u8`, found `u16` | ^^^^^^^^^
| |
| expected `u8`, found `u16`
| arguments to this function are incorrect
| |
= note: expected reference `&u8` = note: expected reference `&u8`
found reference `&u16` found reference `&u16`
note: function defined here
--> $WORKSPACE/serde/src/private/ser.rs
|
| pub fn constrain<T: ?Sized>(t: &T) -> &T {
| ^^^^^^^^^
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
+16 -8
View File
@@ -1,9 +1,17 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> tests/ui/remote/wrong_ser.rs:9:10 --> tests/ui/remote/wrong_ser.rs:9:10
| |
9 | #[derive(Serialize)] 9 | #[derive(Serialize)]
| ^^^^^^^^^ expected `u8`, found `u16` | ^^^^^^^^^
| | |
= note: expected reference `&u8` | expected `u8`, found `u16`
found reference `&u16` | arguments to this function are incorrect
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info) |
= note: expected reference `&u8`
found reference `&u16`
note: function defined here
--> $WORKSPACE/serde/src/private/ser.rs
|
| pub fn constrain<T: ?Sized>(t: &T) -> &T {
| ^^^^^^^^^
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)