version stringclasses 2
values | instance_id stringlengths 17 19 | pull_number int64 31 1.18k | issue_numbers sequencelengths 1 2 | created_at stringlengths 20 20 | hints_text stringlengths 0 3.56k | base_commit stringlengths 40 40 | problem_statement stringlengths 94 8.7k | patch stringlengths 441 52k | test_patch stringlengths 298 13k | repo stringclasses 1
value | environment_setup_commit stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
1.0 | serde-rs__json-1175 | 1,175 | [
"877"
] | 2024-08-12T18:26:05Z | @dtolnay Have you had a chance to look into this? It'd be great to get your review. | cf771a0471dd797b6fead77e767f2f7943740c98 | Deserialize invalid UTF-8 into byte bufs as WTF-8
Previously #828 added support for deserializing lone leading and
trailing surrogates into WTF-8 encoded bytes when deserializing a string
as bytes. This commit extends this to cover the case of a leading
surrogate followed by code units that are not trailing surrogat... | diff --git a/src/de.rs b/src/de.rs
index bfde371a1..bd6f2e50c 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -1575,7 +1575,10 @@ impl<'de, 'a, R: Read<'de>> de::Deserializer<'de> for &'a mut Deserializer<R> {
///
/// The behavior of serde_json is specified to fail on non-UTF-8 strings
/// when deserializing i... | diff --git a/tests/test.rs b/tests/test.rs
index 9f2159513..4290cb3ef 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1707,7 +1707,7 @@ fn test_byte_buf_de() {
}
#[test]
-fn test_byte_buf_de_lone_surrogate() {
+fn test_byte_buf_de_invalid_surrogates() {
let bytes = ByteBuf::from(vec![237, 160, 188]);
l... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 |
1.0 | serde-rs__json-1055 | 1,055 | [
"1054"
] | 2023-08-15T21:59:39Z | 8652bf2bc5dac3b5496725452cfe14ca573f6232 | Cannot deserialize to `HashMap<bool, _>`
JSON objects can only have string keys, although `HashMap`s can have many types of keys. In the case of `i32` keys (eg `HashMap<i32, i32>`), serde_json coerces the stringified integer key (eg `"1"`) into `1i32`. However, that fails in the case of `bool` keys; it raises an erro... | diff --git a/src/de.rs b/src/de.rs
index 7aad50b96..9975b40a5 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -2203,6 +2203,41 @@ where
deserialize_numeric_key!(deserialize_f32, deserialize_f32);
deserialize_numeric_key!(deserialize_f64);
+ fn deserialize_bool<V>(self, visitor: V) -> Result<V::Value>
+ wher... | diff --git a/tests/test.rs b/tests/test.rs
index 8d9a5942a..e548b7dae 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1654,17 +1654,6 @@ fn test_deserialize_from_stream() {
assert_eq!(request, response);
}
-#[test]
-fn test_serialize_rejects_bool_keys() {
- let map = treemap!(
- true => 2,
- ... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-1045 | 1,045 | [
"423"
] | 2023-07-26T19:15:09Z | 8f90eacf6c6335fbd925b1d663e46f4a7592ebba | Implement IntoDeserializer for Value and &Value
An `IntoDeserializer` impl would provide a way to deserialize from these types while constructing exactly the right error type on failure, rather than constructing a `serde_json::Error` and mapping it to a custom error of the target type through its `Display` impl.
```... | diff --git a/src/value/de.rs b/src/value/de.rs
index 3f14abb3b..2090dd009 100644
--- a/src/value/de.rs
+++ b/src/value/de.rs
@@ -482,6 +482,14 @@ impl<'de> IntoDeserializer<'de, Error> for Value {
}
}
+impl<'de> IntoDeserializer<'de, Error> for &'de Value {
+ type Deserializer = Self;
+
+ fn into_deserial... | diff --git a/tests/test.rs b/tests/test.rs
index acf5de480..8d9a5942a 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -2472,6 +2472,12 @@ fn test_value_into_deserializer() {
let mut map = BTreeMap::new();
map.insert("inner", json!({ "string": "Hello World" }));
+ let outer = Outer::deserialize(serde::d... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-1005 | 1,005 | [
"1004"
] | 2023-03-27T16:41:41Z | 02e583360db1a4aa7d21db911a9b62f34161c386 | `Number` loses precision on f32s
Hi there, I've gone through a couple of issues but haven't found anything that quite matches my problem, so if this is a duplicate, feel free to close this and direct me elsewhere :)
The following small snippet replicates my issue:
```rs
use serde::{Deserialize, Serialize};
use se... | diff --git a/src/number.rs b/src/number.rs
index 21a76411c..5ecbde873 100644
--- a/src/number.rs
+++ b/src/number.rs
@@ -279,6 +279,35 @@ impl Number {
}
}
+ pub(crate) fn as_f32(&self) -> Option<f32> {
+ #[cfg(not(feature = "arbitrary_precision"))]
+ match self.n {
+ N::PosI... | diff --git a/tests/regression/issue1004.rs b/tests/regression/issue1004.rs
new file mode 100644
index 000000000..3f5bd96aa
--- /dev/null
+++ b/tests/regression/issue1004.rs
@@ -0,0 +1,12 @@
+#![cfg(feature = "arbitrary_precision")]
+
+#[test]
+fn test() {
+ let float = 5.55f32;
+ let value = serde_json::to_value(... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-956 | 956 | [
"953"
] | 2022-11-22T06:28:36Z | 586fefb5a1e619b0f1a82d94b52ce25754b73ea0 | Invalid JSON values are accepted: numbers with trailing dot but only if greater than u64::MAX
According to JSON spec, both of these should be errors:
```rust
fn main() {
let x1: Result<serde_json::Value, _> = serde_json::from_str("18446744073709551615.");
assert!(x1.is_err());
let x2: Result<serde_js... | diff --git a/src/de.rs b/src/de.rs
index 378b71062..88d0f2624 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -451,30 +451,33 @@ impl<'de, R: Read<'de>> Deserializer<R> {
&mut self,
positive: bool,
mut significand: u64,
- mut exponent: i32,
+ exponent_before_decimal_point: i32,
)... | diff --git a/tests/regression/issue953.rs b/tests/regression/issue953.rs
new file mode 100644
index 000000000..771aa5287
--- /dev/null
+++ b/tests/regression/issue953.rs
@@ -0,0 +1,9 @@
+use serde_json::Value;
+
+#[test]
+fn test() {
+ let x1 = serde_json::from_str::<Value>("18446744073709551615.");
+ assert!(x1.... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-848 | 848 | [
"845"
] | 2022-01-16T00:41:56Z | 66919777d0c31addd190c7a48ec78145a270294d | `arbitrary_precision` Breaks Visitors
I'm not sure if I'm doing something wrong here, but I'm trying to write a type that can deserialize from either strings or integers.
Initially I did this using an `untagged` enumeration variant to do the heavy lifting - see [here](https://github.com/influxdata/pbjson/blob/26626... | diff --git a/src/de.rs b/src/de.rs
index b4c5ef7dc..bf103f04b 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -864,6 +864,15 @@ impl<'de, R: Read<'de>> Deserializer<R> {
buf.push('-');
}
self.scan_integer(&mut buf)?;
+ if positive {
+ if let Ok(unsigned) = buf.parse() {
+ ... | diff --git a/tests/regression/issue845.rs b/tests/regression/issue845.rs
new file mode 100644
index 000000000..dcca55694
--- /dev/null
+++ b/tests/regression/issue845.rs
@@ -0,0 +1,72 @@
+use serde::{Deserialize, Deserializer};
+use std::convert::TryFrom;
+use std::fmt::{self, Display};
+use std::marker::PhantomData;
+... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-801 | 801 | [
"799"
] | 2021-09-14T20:01:13Z | b419f2e0650ab959a3db0b0ca471269e81abf27f | Preserve sign on negative zero f32
`-0` is parsed as `0` for `f32` type.
Is it intentional? I know that this is an edge case, but this is somewhat important for my use case, because it technically two different values.
rustc 1.54.0, serde_json v1.0.67
| diff --git a/src/de.rs b/src/de.rs
index 7cc9f9b8e..a2f34b908 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -434,8 +434,8 @@ impl<'de, R: Read<'de>> Deserializer<R> {
} else {
let neg = (significand as i64).wrapping_neg();
- // Convert into a float if we underflow.... | diff --git a/tests/test.rs b/tests/test.rs
index 9fdf26cc7..d6a0e81c1 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -805,6 +805,7 @@ fn test_parse_u64() {
#[test]
fn test_parse_negative_zero() {
for negative_zero in &[
+ "-0",
"-0.0",
"-0e2",
"-0.0e2",
| serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-796 | 796 | [
"795"
] | 2021-08-28T18:22:46Z | 7b4585fbff5962f05ffb1d7b5a296cf35b69072e | Deserialization from Value fails to catch unknown fields in struct variant
This is an inconsistency between `from_str` and `from_value`. In general these are supposed to have the same behavior on identical input.
```rust
use serde::de::{
Deserialize, Deserializer, EnumAccess, IgnoredAny, MapAccess, VariantAcce... | diff --git a/src/value/de.rs b/src/value/de.rs
index 5ff011961..24ca82696 100644
--- a/src/value/de.rs
+++ b/src/value/de.rs
@@ -538,7 +538,7 @@ impl<'de> VariantAccess<'de> for VariantDeserializer {
V: Visitor<'de>,
{
match self.value {
- Some(Value::Object(v)) => visitor.visit_map(Ma... | diff --git a/tests/regression/issue795.rs b/tests/regression/issue795.rs
new file mode 100644
index 000000000..43198a33d
--- /dev/null
+++ b/tests/regression/issue795.rs
@@ -0,0 +1,57 @@
+use serde::de::{
+ Deserialize, Deserializer, EnumAccess, IgnoredAny, MapAccess, VariantAccess, Visitor,
+};
+use serde_json::jso... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-786 | 786 | [
"785"
] | 2021-07-17T03:32:52Z | ea39063f9c8c7dde4ac43bbd9843287bece59b1a | With feature "arbitrary_precision" exponent marker get converted to lowercase
Comment in [`Cargo.toml`](https://github.com/serde-rs/json/blob/ea39063f9c8c7dde4ac43bbd9843287bece59b1a/Cargo.toml#L71) for feature `arbitrary_precision` states:
> This feature makes `JSON` -> `serde_json::Number` -> `JSON` produce output i... | diff --git a/src/de.rs b/src/de.rs
index 15c8236b6..1824117a0 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -898,7 +898,7 @@ impl<'de, R: Read<'de>> Deserializer<R> {
fn scan_number(&mut self, buf: &mut String) -> Result<()> {
match tri!(self.peek_or_null()) {
b'.' => self.scan_decimal(buf),
- ... | diff --git a/tests/test.rs b/tests/test.rs
index 2fe7c560a..3d701d827 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1007,8 +1007,14 @@ fn test_parse_number() {
#[cfg(feature = "arbitrary_precision")]
test_parse_ok(vec![
("1e999", Number::from_string_unchecked("1e999".to_owned())),
+ ("1e+... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-757 | 757 | [
"755"
] | 2021-02-28T04:47:02Z | 9bcb08fd926c1c727cb1343363d41c25f2e6025d | Panic on input that is not valid UTF8 when deserializing to a RawValue
Very similar to this issue: https://github.com/serde-rs/json/issues/99
However, I ran into this problem when deserializing to a RawValue.
```
let json_str2 = &[ b'"', b'\xCE', b'\xF8', b'"'];
let v2: serde_json::Result<Box<serde_json::value:... | diff --git a/src/read.rs b/src/read.rs
index 522c0e011..574857cd8 100644
--- a/src/read.rs
+++ b/src/read.rs
@@ -587,7 +587,10 @@ impl<'a> Read<'a> for SliceRead<'a> {
V: Visitor<'a>,
{
let raw = &self.slice[self.raw_buffering_start_index..self.index];
- let raw = str::from_utf8(raw).unwra... | diff --git a/tests/test.rs b/tests/test.rs
index ffe58c979..2fe7c560a 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -2201,6 +2201,25 @@ fn test_boxed_raw_value() {
assert_eq!(r#"["a",42,{"foo": "bar"},null]"#, array_to_string);
}
+#[cfg(feature = "raw_value")]
+#[test]
+fn test_raw_invalid_utf8() {
+ use... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-648 | 648 | [
"647"
] | 2020-04-04T23:17:05Z | fd6741f4b0b3fc90a58a6f578e33a9adc6403f3f | StreamDeserializer enters a busy-loop for malformed input
See the test in
https://github.com/oli-obk/cargo_metadata/pull/106/commits/ea84dc353dc4367c507eec0f4fd1f73892cf4d28
There, the `for message in stream_deserilizer` loop loops infinitelly, because serde repeteadly tries to parse the same invalid portion of i... | diff --git a/src/de.rs b/src/de.rs
index 1a7192672..890a51687 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -151,6 +151,7 @@ impl<'de, R: Read<'de>> Deserializer<R> {
StreamDeserializer {
de: self,
offset: offset,
+ failed: false,
output: PhantomData,
... | diff --git a/tests/stream.rs b/tests/stream.rs
index 9fabe0de2..ca54e9a15 100644
--- a/tests/stream.rs
+++ b/tests/stream.rs
@@ -169,3 +169,14 @@ fn test_json_stream_invalid_number() {
assert_eq!(second.to_string(), "trailing characters at line 1 column 2");
});
}
+
+#[test]
+fn test_error() {
+ let d... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-525 | 525 | [
"524"
] | 2019-03-19T09:15:01Z | Thanks, I would accept a PR to return an EOF error in this case. | e6b02d1b53cf1c685db9e20f6a300e8f22a9bf00 | StreamDeserializer errors on cut-off decimal numbers
Simple example:
```rust
fn main() {
dbg!(serde_json::Deserializer::from_slice(b"[1.").into_iter::<Vec<f64>>().next());
}
```
I'd expect that to return None or an EOF error - the array is not finished yet and the number is valid if it's followed by more digi... | diff --git a/src/de.rs b/src/de.rs
index e3effc365..f8d4ace53 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -380,7 +380,14 @@ impl<'de, R: Read<'de>> Deserializer<R> {
}
fn parse_integer(&mut self, positive: bool) -> Result<ParserNumber> {
- match try!(self.next_char_or_null()) {
+ let next = matc... | diff --git a/tests/stream.rs b/tests/stream.rs
index 7127b2534..88a395294 100644
--- a/tests/stream.rs
+++ b/tests/stream.rs
@@ -81,6 +81,36 @@ fn test_json_stream_truncated() {
});
}
+#[test]
+fn test_json_stream_truncated_decimal() {
+ let data = "{\"x\":4.";
+
+ test_stream!(data, Value, |stream| {
+ ... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 |
1.0 | serde-rs__json-521 | 521 | [
"520"
] | 2019-02-28T08:59:36Z | 6ac689b2b327ed00e8a56d812a5c860177ab10dd | Error roundtripping (regression from 1.0.25 to 1.0.38)
We need to roundtrip an enum that has an element `Float(f32)`. That used to work with 1.0.25, but fails with 1.0.38. [This gist](https://gist.github.com/lutter/2820e2c98331d5b5b6b95d62912e2e0f) has complete code that demonstrates the problem.
What happens is tha... | diff --git a/Cargo.toml b/Cargo.toml
index 168a40df3..dd912d69c 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -22,6 +22,7 @@ itoa = "0.4.3"
ryu = "0.2"
[dev-dependencies]
+automod = "0.1"
compiletest_rs = { version = "0.3", features = ["stable"] }
serde_bytes = "0.10"
serde_derive = "1.0"
diff --git a/src/number.r... | diff --git a/tests/regression.rs b/tests/regression.rs
new file mode 100644
index 000000000..eff29ff6c
--- /dev/null
+++ b/tests/regression.rs
@@ -0,0 +1,6 @@
+extern crate automod;
+extern crate serde;
+extern crate serde_derive;
+
+#[path = "regression/mod.rs"]
+mod regression;
diff --git a/tests/regression/issue520.... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-512 | 512 | [
"511"
] | 2019-01-16T21:56:30Z | Forgot to mention, works ok for u64 | 22c0c7e92fe93d0c0f8ee1a1fcf3588290975d53 | u128 as hashmap key results in invalid json
See example output here being invalid json (key not quoted): [playground link](https://play.integer32.com/?version=stable&mode=debug&edition=2018&gist=c026aab61d8559c539d5742cb3b498ee)
| diff --git a/src/ser.rs b/src/ser.rs
index d0fc66a4b..463c15a16 100644
--- a/src/ser.rs
+++ b/src/ser.rs
@@ -987,10 +987,22 @@ where
serde_if_integer128! {
fn serialize_i128(self, value: i128) -> Result<()> {
- self.ser
+ try!(self
+ .ser
+ .formatter
... | diff --git a/tests/test.rs b/tests/test.rs
index 46b3396eb..548f71a32 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1782,6 +1782,16 @@ fn test_integer_key() {
)]);
}
+#[test]
+fn test_integer128_key() {
+ let map = treemap! {
+ 100000000000000000000000000000000000000u128 => ()
+ };
+ let j ... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 |
1.0 | serde-rs__json-506 | 506 | [
"502"
] | 2018-12-29T09:22:21Z | Thanks! I would accept a PR to support u128 => Value in the case that arbitrary_precision is enabled. | 32f1568c2a280d3456c566c811680f5bd65fd7f3 | u128 doesn't work for Value
Looks like there's a bug in serde_json. This program:
```
#[macro_use]
extern crate serde_json;
use std::str::FromStr;
fn main() {
let string = format!("{}", u128::max_value());
println!("{}", string);
let val = serde_json::value::Value::from_str(&string);
let va... | diff --git a/src/value/ser.rs b/src/value/ser.rs
index 172784cce..c377b533d 100644
--- a/src/value/ser.rs
+++ b/src/value/ser.rs
@@ -77,6 +77,13 @@ impl serde::Serializer for Serializer {
Ok(Value::Number(value.into()))
}
+ serde_if_integer128! {
+ #[cfg(feature = "arbitrary_precision")]
+ ... | diff --git a/tests/test.rs b/tests/test.rs
index 97da8133a..c08645a02 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1909,6 +1909,13 @@ fn test_partialeq_number() {
);
}
+#[test]
+#[cfg(integer128)]
+#[cfg(feature = "arbitrary_precision")]
+fn test_partialeq_integer128() {
+ number_partialeq_ok!(i128::MI... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 |
1.0 | serde-rs__json-493 | 493 | [
"492"
] | 2018-10-04T05:25:14Z | 805f394f8b4165e4f365c27068eedc1d9cb6ac52 | Malformed number causes panic in de.rs
The following test case demonstrates the problem. This could be used for DOSing Rust web apps.
```rust
extern crate serde_json;
#[test]
fn parse_json() {
let f: Result<f64, _> = serde_json::from_str("3.5E-2147483647");
}
```
```
stack backtrace:
0: std::sys::... | diff --git a/src/de.rs b/src/de.rs
index 70ebf0d5e..020869a64 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -676,7 +676,7 @@ impl<'de, R: Read<'de>> Deserializer<R> {
) -> Result<f64> {
let mut f = significand as f64;
loop {
- match POW10.get(exponent.abs() as usize) {
+ match P... | diff --git a/tests/test.rs b/tests/test.rs
index 954ac901b..688dfe5db 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -860,6 +860,7 @@ fn test_parse_f64() {
("0.00e00", 0.0),
("0.00e+00", 0.0),
("0.00e-00", 0.0),
+ ("3.5E-2147483647", 0.0),
(
&format!("{}", (i64... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-485 | 485 | [
"355"
] | 2018-09-20T08:49:13Z | @dtolnay mentions that the work happening in #416 might lay some groundwork for such a change to take place.
Yeah, this sounds useful. Ideally we could get some of the building blocks for this sort of thing (custom 'built-in' types) integrated into serde itself, in time.
I need this for a project I'm working on, and wo... | b0e3a9798b95ea95d7fcc5d38b9e62010d367557 | Add a RawValue type
It would be helpful to have a type similar to Go's [`json.RawMessage`](https://golang.org/pkg/encoding/json/#RawMessage) that is not tokenized during deserialization, but rather its raw contents stored as a `Vec<u8>` or `&'de [u8]`.
The following pseudo-code demonstrates the idea.
```rust
#[der... | diff --git a/Cargo.toml b/Cargo.toml
index 2f8ebe5ca..0ccec383a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -26,6 +26,12 @@ compiletest_rs = "0.3"
serde_bytes = "0.10"
serde_derive = "1.0"
+[package.metadata.docs.rs]
+features = ["raw_value"]
+
+[package.metadata.playground]
+features = ["raw_value"]
+
### FEATU... | diff --git a/tests/test.rs b/tests/test.rs
index 08d038837..ec2de425e 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -938,9 +938,9 @@ fn test_serialize_char() {
#[test]
fn test_malicious_number() {
#[derive(Serialize)]
- #[serde(rename = "$__serde_private_Number")]
+ #[serde(rename = "$serde_json::priva... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 |
1.0 | serde-rs__json-480 | 480 | [
"355"
] | 2018-09-14T10:25:28Z | @dtolnay mentions that the work happening in #416 might lay some groundwork for such a change to take place.
Yeah, this sounds useful. Ideally we could get some of the building blocks for this sort of thing (custom 'built-in' types) integrated into serde itself, in time.
I need this for a project I'm working on, and wo... | d4612639020d4e744cb755e63430b7f95e566c7a | Add a RawValue type
It would be helpful to have a type similar to Go's [`json.RawMessage`](https://golang.org/pkg/encoding/json/#RawMessage) that is not tokenized during deserialization, but rather its raw contents stored as a `Vec<u8>` or `&'de [u8]`.
The following pseudo-code demonstrates the idea.
```rust
#[der... | diff --git a/src/de.rs b/src/de.rs
index f1c5c3cff..0ad91a2a8 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -8,6 +8,7 @@
//! Deserialize JSON data to a Rust data structure.
+use std::borrow::Cow;
use std::io;
use std::marker::PhantomData;
use std::result;
@@ -946,6 +947,22 @@ impl<'de, R: Read<'de>> Deserializer<R>... | diff --git a/tests/test.rs b/tests/test.rs
index 08d038837..09c51a62d 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -44,7 +44,7 @@ use serde_bytes::{ByteBuf, Bytes};
use serde_json::{
from_reader, from_slice, from_str, from_value, to_string, to_string_pretty, to_value, to_vec,
- to_writer, Deserializer, ... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 |
1.0 | serde-rs__json-462 | 462 | [
"461"
] | 2018-07-16T16:38:33Z | 1b36cec484a24dc8d1700cf2ef0577a96d4d7b6f | Unused result warning in json! macro.
Stumbled upon a warning coming from the `json!` macro that will cause compiles to fail if the `unused_results` warning is set with [this test case](http://play.rust-lang.org/?gist=baf66a86706282966f5109f537b74041&version=stable&mode=debug&edition=2015). Here's what I get running it... | diff --git a/src/macros.rs b/src/macros.rs
index 29e16b7ab..a3accf75b 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -161,7 +161,7 @@ macro_rules! json_internal {
// Insert the current entry followed by trailing comma.
(@object $object:ident [$($key:tt)+] ($value:expr) , $($rest:tt)*) => {
- $obje... | diff --git a/tests/test.rs b/tests/test.rs
index 4e9c0ccd9..08d038837 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -1847,6 +1847,9 @@ fn test_json_macro() {
(<Result<&str, ()> as Clone>::clone(&Ok("")).unwrap()): "ok",
(<Result<(), &str> as Clone>::clone(&Err("")).unwrap_err()): "err"
});
+
... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 | |
1.0 | serde-rs__json-455 | 455 | [
"454"
] | 2018-06-24T23:27:48Z | 7efc0972cd04fc05e028d4d7f5b95359b82d878b | Get ExpectedSomeIdent error instead of Eof error if the input ends with a truncated "null"
```rust
extern crate serde_json;
fn main() {
match serde_json::from_str::<serde_json::Value>("nu") {
Ok(_) => unreachable!(),
Err(err) => match err.classify() {
serde_json::error::Category:... | diff --git a/src/de.rs b/src/de.rs
index b154cad60..f1c5c3cff 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -308,9 +308,16 @@ impl<'de, R: Read<'de>> Deserializer<R> {
}
fn parse_ident(&mut self, ident: &[u8]) -> Result<()> {
- for c in ident {
- if Some(*c) != try!(self.next_char()) {
- ... | diff --git a/tests/test.rs b/tests/test.rs
index 0b84ce869..811c409af 100644
--- a/tests/test.rs
+++ b/tests/test.rs
@@ -613,6 +613,15 @@ where
let mut de = Deserializer::from_str(&twoline);
IgnoredAny::deserialize(&mut de).unwrap();
assert_eq!(0xDEAD_BEEF, u64::deserialize(&mut de).unwrap())... | serde-rs/json | cf771a0471dd797b6fead77e767f2f7943740c98 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6