Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: serde-rs/json
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.123
Choose a base ref
...
head repository: serde-rs/json
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.0.124
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Aug 11, 2024

  1. Copy the full SHA
    8eba786 View commit details
  2. Merge pull request #1173 from iex-rs/fix-big-endian

    Oops, fix skip_to_escape on BE architectures
    dtolnay authored Aug 11, 2024
    Copy the full SHA
    8b314a7 View commit details
  3. Release 1.0.124

    dtolnay committed Aug 11, 2024
    Copy the full SHA
    cf771a0 View commit details
Showing with 5 additions and 10 deletions.
  1. +1 −1 Cargo.toml
  2. +1 −1 src/lib.rs
  3. +2 −7 src/read.rs
  4. +1 −1 tests/test.rs
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "serde_json"
version = "1.0.123"
version = "1.0.124"
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
categories = ["encoding", "parser-implementations", "no-std"]
description = "A JSON serialization file format"
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -299,7 +299,7 @@
//! [macro]: crate::json
//! [`serde-json-core`]: https://github.com/rust-embedded-community/serde-json-core
#![doc(html_root_url = "https://docs.rs/serde_json/1.0.123")]
#![doc(html_root_url = "https://docs.rs/serde_json/1.0.124")]
// Ignored clippy lints
#![allow(
clippy::collapsible_else_if,
9 changes: 2 additions & 7 deletions src/read.rs
Original file line number Diff line number Diff line change
@@ -453,22 +453,17 @@ impl<'a> SliceRead<'a> {
const ONE_BYTES: Chunk = Chunk::MAX / 255; // 0x0101...01

for chunk in rest.chunks_exact(STEP) {
let chars = Chunk::from_ne_bytes(chunk.try_into().unwrap());
let chars = Chunk::from_le_bytes(chunk.try_into().unwrap());
let contains_ctrl = chars.wrapping_sub(ONE_BYTES * 0x20) & !chars;
let chars_quote = chars ^ (ONE_BYTES * Chunk::from(b'"'));
let contains_quote = chars_quote.wrapping_sub(ONE_BYTES) & !chars_quote;
let chars_backslash = chars ^ (ONE_BYTES * Chunk::from(b'\\'));
let contains_backslash = chars_backslash.wrapping_sub(ONE_BYTES) & !chars_backslash;
let masked = (contains_ctrl | contains_quote | contains_backslash) & (ONE_BYTES << 7);
if masked != 0 {
let addresswise_first_bit = if cfg!(target_endian = "little") {
masked.trailing_zeros()
} else {
masked.leading_zeros()
};
// SAFETY: chunk is in-bounds for slice
self.index = unsafe { chunk.as_ptr().offset_from(self.slice.as_ptr()) } as usize
+ addresswise_first_bit as usize / 8;
+ masked.trailing_zeros() as usize / 8;
return;
}
}
2 changes: 1 addition & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
@@ -2504,7 +2504,7 @@ fn test_control_character_search() {
for n in 0..16 {
for m in 0..16 {
test_parse_err::<String>(&[(
&format!("\"{}\n{}\"", ".".repeat(n), ".".repeat(m)),
&format!("\"{}\n{}\"", " ".repeat(n), " ".repeat(m)),
"control character (\\u0000-\\u001F) found while parsing a string at line 2 column 0",
)]);
}