pull_number int64 64 2.85k | test_patch stringlengths 303 98.3k | issue_numbers listlengths 1 2 | instance_id stringlengths 18 20 | problem_statement stringlengths 24 6.49k | version stringclasses 19
values | base_commit stringlengths 40 40 | patch stringlengths 372 188k | repo stringclasses 1
value | created_at stringlengths 20 20 | hints_text stringlengths 0 6.32k | environment_setup_commit stringclasses 20
values |
|---|---|---|---|---|---|---|---|---|---|---|---|
233 | diff --git a/serde_tests/tests/test_annotations.rs b/serde_tests/tests/test_annotations.rs
index dc91b9b5d..82f1265e2 100644
--- a/serde_tests/tests/test_annotations.rs
+++ b/serde_tests/tests/test_annotations.rs
@@ -23,24 +23,44 @@ struct DisallowUnknown {
}
#[derive(Debug, PartialEq, Serialize, Deserialize)]
-str... | [
"211",
"218"
] | serde-rs__serde-233 | Consider removing format specific renames
cc @hugoduncan.
I did a quick search through github, and I couldn't find anyone using `#[serde(rename(json=..., xml=...))]` and etc. I'm not sure if it's pulling it's weight and I'm considering removing it in the upcoming 0.7.0 release. This is also adding some complication in... | 0.6 | a926cb62f05012d15618922029e1cd9cdf42cd10 | diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs
index cb0e25e8c..3d172a06c 100644
--- a/serde/src/de/mod.rs
+++ b/serde/src/de/mod.rs
@@ -424,15 +424,6 @@ pub trait Deserializer {
{
self.deserialize(visitor)
}
-
- /// Specify a format string for the deserializer.
- ///
- /// The deser... | serde-rs/serde | 2016-02-08T06:07:45Z | I'm using it in my AWS code, as the names used in the XML replies from
AWS don't match the names used in their API requests.
Having said that I haven't found time to work on anything in rust in the
last few months.
@hugoduncan: Do you have your code online? I did find another rust AWS API client, [rusoto](https://git... | d24b2c86f2c9b3f5036289d6c2c5764be57d2127 |
224 | diff --git a/serde_tests/tests/test_bytes.rs b/serde_tests/tests/test_bytes.rs
index 137d00986..785ff5503 100644
--- a/serde_tests/tests/test_bytes.rs
+++ b/serde_tests/tests/test_bytes.rs
@@ -9,6 +9,12 @@ use serde::bytes::{ByteBuf, Bytes};
#[derive(Debug, PartialEq)]
struct Error;
+impl serde::ser::Error for Erro... | [
"57"
] | serde-rs__serde-224 | `Path` serialization can panic
The `Serialize` implementation of `Path` incorrectly assumes that all paths can be represented as Unicode strings.
| 0.6 | 9ae47a261e2e2f7dacc44c91e315fc90675e4e4b | diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs
index 7d01a384d..cc20f9b60 100644
--- a/serde/src/ser/impls.rs
+++ b/serde/src/ser/impls.rs
@@ -27,6 +27,7 @@ use std::sync::Arc;
use core::nonzero::{NonZero, Zeroable};
use super::{
+ Error,
Serialize,
Serializer,
SeqVisitor,
@@ -682,7 ... | serde-rs/serde | 2016-01-28T18:41:45Z | Good point! Should be simple enough to have it return a syntax error if it gets a non-unicode string.
err, rather tries to serialize to a non-unicode string. So it could either just be serialized as a byte string, or we first try to encode it as a string, then fail back to a byte string if it's non-unicode.
What shou... | d24b2c86f2c9b3f5036289d6c2c5764be57d2127 |
139 | diff --git a/serde_tests/benches/bench_log.rs b/serde_tests/benches/bench_log.rs
index 4fa108da5..1dddcf500 100644
--- a/serde_tests/benches/bench_log.rs
+++ b/serde_tests/benches/bench_log.rs
@@ -1,6 +1,6 @@
use std::io::{self, Read, Write};
use num::FromPrimitive;
-use test::Bencher;
+use test::{Bencher, black_box}... | [
"122"
] | serde-rs__serde-139 | Serializing a map with non-string keys will silently generate invalid JSON
For example, a `HashMap<u32, u32>` will produce invalid JSON when serialized.
At a minimum, the json serializer should error rather than produce invalid JSON.
Ideally however, it would fall back to serializing the map as a list of pairs:
```
... | 0.5 | 7b773ac08880adece2f1bd809efcbd5828b23293 | diff --git a/serde_json/src/error.rs b/serde_json/src/error.rs
index 6621188bb..6c3a494c9 100644
--- a/serde_json/src/error.rs
+++ b/serde_json/src/error.rs
@@ -2,6 +2,7 @@ use std::error;
use std::fmt;
use std::io;
use std::result;
+use std::string::FromUtf8Error;
use serde::de;
@@ -44,7 +45,6 @@ impl fmt::Deb... | serde-rs/serde | 2015-08-14T05:34:23Z | we had this issue before with rustc-serialize... I wasn't aware we also had it in serde...
probably we just need an intermediate serializer here: https://github.com/serde-rs/serde/blob/master/serde_json/src/ser.rs#L262 that is passed to the MapVisitor, to check for stringable keys and error else. Fallback to serializi... | 7b773ac08880adece2f1bd809efcbd5828b23293 |
684 | diff --git a/serde_test/src/de.rs b/serde_test/src/de.rs
index 2ad0c9be1..559e9972d 100644
--- a/serde_test/src/de.rs
+++ b/serde_test/src/de.rs
@@ -31,76 +31,105 @@ impl<I> Deserializer<I>
self.tokens.next()
}
+ pub fn expect_token(&mut self, expected: Token) -> Result<(), Error> {
+ match se... | [
"656"
] | serde-rs__serde-684 | Simplify contract around SeqVisitor::end() and MapVisitor::end()
These are really easy to screw up when implementing visit_seq and visit_map. If you forget to call them, things may work in some formats and fail in really confusing ways in other formats.
Hopefully we can find a way for the type system to enforce corr... | 0.8 | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f | diff --git a/.travis.yml b/.travis.yml
index 87e33f84b..9ef108a71 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,8 +19,8 @@ script:
- (cd testing && travis-cargo --skip nightly test)
- (cd testing && travis-cargo --only nightly test -- --features unstable-testing)
- (cd serde_derive && travis-cargo --only nightly... | serde-rs/serde | 2017-01-13T18:24:06Z | I think we can just get rid of end() and handle their job inside whatever calls visit_seq or visit_map. | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f |
682 | diff --git a/testing/tests/test_de.rs b/testing/tests/test_de.rs
index d1879fe84..3359492e8 100644
--- a/testing/tests/test_de.rs
+++ b/testing/tests/test_de.rs
@@ -32,12 +32,40 @@ struct Struct {
c: i32,
}
+#[derive(PartialEq, Debug, Deserialize)]
+#[serde(deny_unknown_fields)]
+struct StructDenyUnknown {
+ ... | [
"444"
] | serde-rs__serde-682 | Fields marked skip_deserializing are ignored even if deny_unknown_fields is set
I have [this struct definition](https://github.com/sfackler/log4rs/blob/6eea8767b5ed5c014d06685d78a6df8c54147a92/src/file/serde.rs.in#L1-L14). It is configured to derive `Deserialize` and deny unknown fields. I have a field marked to be sk... | 0.8 | c008c6d3a8e5315667c0380df1d91ff1daa5d71d | diff --git a/serde_codegen/src/de.rs b/serde_codegen/src/de.rs
index b2d64a9bf..ed4f9e0aa 100644
--- a/serde_codegen/src/de.rs
+++ b/serde_codegen/src/de.rs
@@ -480,11 +480,14 @@ fn deserialize_item_enum(
let type_name = item_attrs.name().deserialize_name();
+ let variant_names_idents = variants.iter()
+ ... | serde-rs/serde | 2017-01-13T07:29:07Z | @oli-obk @erickt opinion on this?
It seems like there are two different use cases for `skip_deserializing`.
1. A field of the struct is not present in the serialized form.
2. A field of the struct is present in the serialized form but should not be deserialized.
If we make this change, there would be no way to handle... | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f |
681 | diff --git a/serde_test/src/de.rs b/serde_test/src/de.rs
index 39e14faaa..2ad0c9be1 100644
--- a/serde_test/src/de.rs
+++ b/serde_test/src/de.rs
@@ -85,12 +85,12 @@ impl<I> Deserializer<I>
})
}
- fn visit_struct<V>(&mut self, len: Option<usize>, mut visitor: V) -> Result<V::Value, Error>
+ fn visi... | [
"559"
] | serde-rs__serde-681 | `deserialize_struct` is called with real field names instead of deserializable names
``` rust
#[derive(Deserialize)]
pub struct S {
#[serde(rename = "A")]
a: u8,
#[serde(skip_deserializing)]
b: u8,
}
```
I was surprised to see this in the generated code:
``` rust
const FIELDS: &'static [&'static str] ... | 0.8 | 110d36fa1469375ad00dcd0f460451e6e390f1ed | diff --git a/serde_codegen/src/de.rs b/serde_codegen/src/de.rs
index 8eb699701..84cbaa7da 100644
--- a/serde_codegen/src/de.rs
+++ b/serde_codegen/src/de.rs
@@ -503,7 +503,7 @@ fn deserialize_item_enum(
true,
);
- let variant_names = variants.iter().map(|variant| variant.ident.to_string());
+ let ... | serde-rs/serde | 2017-01-12T19:24:34Z | @dtolnay: yeah I think this would make sense to change. There isn't much reason for the deserializer to get passed the rust-field-specific names. This must have just been something we missed when we added field renaming. I'm not sure if anyone uses them. Maybe toml? I remember it did some funky things with trying to re... | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f |
678 | diff --git a/testing/tests/test_gen.rs b/testing/tests/test_gen.rs
index 660eb52e1..24338312e 100644
--- a/testing/tests/test_gen.rs
+++ b/testing/tests/test_gen.rs
@@ -208,6 +208,85 @@ fn test_gen() {
struct NonAsciiIdents {
σ: f64
}
+
+ #[derive(Serialize, Deserialize)]
+ struct EmptyBraced {... | [
"676"
] | serde-rs__serde-678 | Empty braced struct generates dead code
```rust
#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
pub struct Config {
}
```
The generated code (cleaned up) looks like:
```rust
impl Deserialize for Config {
fn deserialize<D>(deserializer: &mut D) -> Result<Config, D::Error>
where D: Deserial... | 0.8 | 8242c64152d2d13ec4ebc4e197db709500cc9fce | diff --git a/serde_codegen/src/de.rs b/serde_codegen/src/de.rs
index e75a7c961..9e0b6bee9 100644
--- a/serde_codegen/src/de.rs
+++ b/serde_codegen/src/de.rs
@@ -509,14 +509,6 @@ fn deserialize_item_enum(
const VARIANTS: &'static [&'static str] = &[ #(#variant_names),* ];
};
- let ignored_arm = if ite... | serde-rs/serde | 2017-01-11T19:03:35Z | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f | |
671 | diff --git a/testing/tests/test_de.rs b/testing/tests/test_de.rs
index 280d427f8..d1879fe84 100644
--- a/testing/tests/test_de.rs
+++ b/testing/tests/test_de.rs
@@ -3,7 +3,7 @@ use std::net;
use std::path::PathBuf;
use std::time::Duration;
-use serde::Deserialize;
+use serde::de::{Deserialize, Type};
extern crat... | [
"667"
] | serde-rs__serde-671 | Stop generating visit_usize and visit_bytes for FieldVisitor
As far as I know, not a single format uses these. The visit_usize case is better served by going through visit_seq like Bincode does. The visit_bytes case causes problems with supporting no_std: https://github.com/serde-rs/serde/issues/666#issuecomment-271109... | 0.8 | 41931224721513c95c4f70ed953ad258d96ebec3 | diff --git a/serde_codegen/src/de.rs b/serde_codegen/src/de.rs
index 163874bd4..e75a7c961 100644
--- a/serde_codegen/src/de.rs
+++ b/serde_codegen/src/de.rs
@@ -1,5 +1,5 @@
use syn::{self, aster};
-use quote::{self, Tokens};
+use quote::Tokens;
use bound;
use internals::ast::{Body, Field, Item, Style, Variant};
@@... | serde-rs/serde | 2017-01-08T09:02:40Z | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f | |
664 | diff --git a/serde_test/src/de.rs b/serde_test/src/de.rs
index 121dcd3db..101cc8110 100644
--- a/serde_test/src/de.rs
+++ b/serde_test/src/de.rs
@@ -856,7 +856,7 @@ impl<'a, I> VariantVisitor for DeserializerVariantVisitor<'a, I>
}
}
Some(_) => {
- Deserialize::... | [
"657"
] | serde-rs__serde-664 | Remove the Deserialize trait bound on Visitor::Value
The deserializer should not be able to produce an Ok(Value) any other way - it should be forced to call one of the Visitor methods.
Also the type may legitimately not implement Deserialize, for example if you are doing stateful deserialization https://github.com/s... | 0.8 | a3f556959f18c33388a3e4d4498c1b7abf6197e4 | diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs
index 210b36b03..9c930a9ff 100644
--- a/serde/src/de/mod.rs
+++ b/serde/src/de/mod.rs
@@ -412,7 +412,7 @@ pub trait Deserializer {
/// This trait represents a visitor that walks through a deserializer.
pub trait Visitor {
/// The value produced by this visit... | serde-rs/serde | 2017-01-03T09:53:24Z | An example of doing it wrong: [`serde_test::DeserializerVariantVisitor`](https://github.com/serde-rs/serde/blob/v0.8.21/serde_test/src/de.rs#L859) (this is a bug). | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f |
653 | diff --git a/testing/tests/test_ser.rs b/testing/tests/test_ser.rs
index 525735339..afc850700 100644
--- a/testing/tests/test_ser.rs
+++ b/testing/tests/test_ser.rs
@@ -30,12 +30,20 @@ struct Struct {
c: i32,
}
-#[derive(Serialize)]
+#[derive(Serialize, PartialEq, Debug)]
enum Enum {
Unit,
One(i32),
... | [
"638"
] | serde-rs__serde-653 | Attribute skip_(de)serializing for enum variants
```rust
#[derive(Serialize, Deserialize)]
enum E {
A,
B,
#[serde(skip_serializing, skip_deserializing)]
C,
}
```
When serializing, it should error when the value is that variant. When deserializing, it should be like the variant doesn't exist.
| 0.8 | 2c984980a0faf0670d1d461aac2527feecf9de30 | diff --git a/serde_codegen/src/ser.rs b/serde_codegen/src/ser.rs
index 449a24904..531604169 100644
--- a/serde_codegen/src/ser.rs
+++ b/serde_codegen/src/ser.rs
@@ -255,77 +255,123 @@ fn serialize_variant(
let variant_ident = variant.ident.clone();
let variant_name = variant.attrs.name().serialize_name();
-... | serde-rs/serde | 2016-12-24T12:01:17Z | #641 handles `skip_deserializing`. We still need to do `skip_serializing`. | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f |
652 | diff --git a/testing/tests/test.rs.in b/testing/tests/test.rs.in
index fca1ff465..04c69bdba 100644
--- a/testing/tests/test.rs.in
+++ b/testing/tests/test.rs.in
@@ -1,4 +1,5 @@
extern crate serde;
+extern crate serde_test;
#[macro_use]
mod macros;
diff --git a/testing/tests/test_bytes.rs b/testing/tests/test_bytes... | [
"645"
] | serde-rs__serde-652 | Support deserializing ByteBuf from string
A Deserializer should be able to call visit_str or visit_string to deserialize a ByteBuf. The ByteBuf should contain the bytes of the string.
Relevant to https://github.com/traviskaufman/serde_bencode/issues/7.
| 0.8 | 2c984980a0faf0670d1d461aac2527feecf9de30 | diff --git a/serde/src/bytes.rs b/serde/src/bytes.rs
index a732712cf..988c24a55 100644
--- a/serde/src/bytes.rs
+++ b/serde/src/bytes.rs
@@ -84,7 +84,7 @@ mod bytebuf {
use de;
#[cfg(feature = "collections")]
- use collections::Vec;
+ use collections::{String, Vec};
/// `ByteBuf` wraps a `Vec<u... | serde-rs/serde | 2016-12-24T04:18:37Z | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f | |
578 | diff --git a/serde_derive/tests/compile-fail/duplicate-attribute/rename-and-ser.rs b/serde_derive/tests/compile-fail/duplicate-attribute/rename-and-ser.rs
index 312583af1..2f3950f8e 100644
--- a/serde_derive/tests/compile-fail/duplicate-attribute/rename-and-ser.rs
+++ b/serde_derive/tests/compile-fail/duplicate-attribu... | [
"575"
] | serde-rs__serde-578 | Update from rustc_macro to proc_macro
The name of attributes / libraries / feature flags / everything related to Macros 1.1 has changed from rustc_macro to proc_macro in https://github.com/rust-lang/rust/pull/36945 and https://github.com/rust-lang/cargo/pull/3160. We need to update serde_derive to use the new names.
| 0.8 | e547a06639ee62dff40813afbbdbf1ed1d792e99 | diff --git a/README.md b/README.md
index 448d9ed28..f0c6ec643 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ You may be looking for:
## Serde in action
```rust
-#![feature(rustc_macro)]
+#![feature(proc_macro)]
#[macro_use]
extern crate serde_derive;
diff --git a/examples/serde-syntex-example/src/main... | serde-rs/serde | 2016-10-08T22:32:45Z | 88a4ed9cd72c7901b025dd8c8d86c69cfc6b157f | |
2,422 | diff --git a/test_suite/tests/regression/issue2415.rs b/test_suite/tests/regression/issue2415.rs
new file mode 100644
index 000000000..31c522709
--- /dev/null
+++ b/test_suite/tests/regression/issue2415.rs
@@ -0,0 +1,5 @@
+use serde_derive::Serialize;
+
+#[derive(Serialize)]
+#[serde()]
+pub struct S;
| [
"2415",
"2421"
] | serde-rs__serde-2422 | Possible semver breaking change in serde 1.0.157
When pinning the version of `serde` in Cargo.toml to `1.0.156`, my crate compiles, switching to `1.0.157` results in an error in my `influxdb2` dependency:
```bash
error: unexpected end of input, unexpected token in nested attribute, expected ident
--> /home/midas/.... | 1.15 | acfd19cb463ea77d2146d637c35d8751601dae75 | diff --git a/serde_derive/src/internals/attr.rs b/serde_derive/src/internals/attr.rs
index 9875b6606..b0a7d08a2 100644
--- a/serde_derive/src/internals/attr.rs
+++ b/serde_derive/src/internals/attr.rs
@@ -307,6 +307,12 @@ impl Container {
continue;
}
+ if let syn::Meta::List(m... | serde-rs/serde | 2023-03-28T05:02:10Z | acfd19cb463ea77d2146d637c35d8751601dae75 | |
2,410 | diff --git a/test_suite/tests/regression/issue2409.rs b/test_suite/tests/regression/issue2409.rs
new file mode 100644
index 000000000..2e3936691
--- /dev/null
+++ b/test_suite/tests/regression/issue2409.rs
@@ -0,0 +1,11 @@
+use serde::Deserialize;
+
+macro_rules! bug {
+ ($serde_path:literal) => {
+ #[derive(... | [
"2409"
] | serde-rs__serde-2410 | Regression in serde 1.0.157 when a proc macro enables syn's full feature
With https://github.com/nox/serde-none-group, the command `cargo build --features syn-full` fails while the command `cargo build` succeeds. The only difference is that the failing command enables the "full" feature of the crate `syn` from a proc m... | 1.15 | 479a00a215cd291e9c0b0ad0373e26694018bf1c | diff --git a/serde_derive/Cargo.toml b/serde_derive/Cargo.toml
index f2a3e37cf..b824bb993 100644
--- a/serde_derive/Cargo.toml
+++ b/serde_derive/Cargo.toml
@@ -24,7 +24,7 @@ proc-macro = true
[dependencies]
proc-macro2 = "1.0"
quote = "1.0"
-syn = "2.0"
+syn = "2.0.3"
[dev-dependencies]
serde = { version = "1.0... | serde-rs/serde | 2023-03-20T11:04:16Z | acfd19cb463ea77d2146d637c35d8751601dae75 | |
2,403 | diff --git a/test_suite/tests/test_annotations.rs b/test_suite/tests/test_annotations.rs
index 8ff725e01..2b8bed664 100644
--- a/test_suite/tests/test_annotations.rs
+++ b/test_suite/tests/test_annotations.rs
@@ -2395,6 +2395,159 @@ fn test_untagged_enum_containing_flatten() {
);
}
+#[test]
+fn test_partially_u... | [
"1402"
] | serde-rs__serde-2403 | #[serde(flatten)] attribute support for enum variants
Hi!
I have the following use-case for a feature similar to `#[serde(flatten)]`, but for enum variants rather than struct fields. Generally happy to dive into `serde_derive` myself in case you think this would be worth having, but it could also be that I'm trying ... | 1.15 | acfd19cb463ea77d2146d637c35d8751601dae75 | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index d4238f13e..0b86cde6f 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -1165,6 +1165,32 @@ fn deserialize_enum(
params: &Parameters,
variants: &[Variant],
cattrs: &attr::Container,
+) -> Fragment {
+ // The variants h... | serde-rs/serde | 2023-03-16T17:02:17Z | It looks like this is similar to #1350 where you suggest manually flattening, but that would be fairly cumbersome in this case (`Expression` might have a couple dozen variants) and I guess I'm still curious whether there's a "better" way to do this.
Seems reasonable! I would be interested in supporting this better. I h... | acfd19cb463ea77d2146d637c35d8751601dae75 |
2,387 | diff --git a/test_suite/tests/test_annotations.rs b/test_suite/tests/test_annotations.rs
index f32c22c1a..8ff725e01 100644
--- a/test_suite/tests/test_annotations.rs
+++ b/test_suite/tests/test_annotations.rs
@@ -642,7 +642,7 @@ fn test_unknown_field_rename_struct() {
Token::Str("a4"),
Token::... | [
"1504"
] | serde-rs__serde-2387 | Field aliases do not work in combination with `flatten`
Field aliases as introduced in https://github.com/serde-rs/serde/pull/1458 do not work when deserializing "flattened" structures.
### Expected behavior
Field aliases should work when deserializing "flattened" structures.
### Observed behavior
Field a... | 1.15 | a13c6382b6a4644be01b9b6c331b0cc32d32bc58 | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index a703adaf7..679086e61 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -2400,7 +2400,8 @@ fn deserialize_struct_as_struct_visitor(
.collect();
let fields_stmt = {
- let field_names = field_names_idents.iter().map... | serde-rs/serde | 2023-03-05T07:27:53Z | I just got bitten by this too.
This is a bug -- I would accept a PR to fix this.
I'll try to give it a shot, but first time poking at serde_derive, so no promises :)
Yeah, I just got bit by this too.
I was using variants, so I thought it was related to that.
I can take a try at fixing this if there's been no pr... | acfd19cb463ea77d2146d637c35d8751601dae75 |
2,383 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index c053d6903..f6782f68f 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -892,3 +892,53 @@ pub struct RemotePackedNonCopyDef {
impl Drop for RemotePackedNonCopyDef {
fn drop(&mut self) {}
}
+
+/////////////... | [
"2371"
] | serde-rs__serde-2383 | "undeclared lifetime" when derive `Deserialize` for an enum with both `flatten` and `'static` fields
The following code panics with the error:
```rust
use serde::Deserialize;
#[derive(Deserialize)]
struct Nested {
float: f64,
}
#[derive(Deserialize)]
#[serde(tag = "tag")]
enum InternallyTagged {
F... | 1.15 | a13c6382b6a4644be01b9b6c331b0cc32d32bc58 | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index a703adaf7..c0701625f 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -954,6 +954,7 @@ fn deserialize_struct(
lifetime: _serde::__private::PhantomData,
}
};
+ let need_seed = deserializer.is_none();
... | serde-rs/serde | 2023-02-25T17:19:12Z | Since `&'static str` usually represents a string embedded in the binary of your program I don't think it's possible to or even makes sense to `Deserialize` one? Surely what you want to do is this:
```rs
#[derive(Deserialize)]
#[serde(tag = "tag")]
enum InternallyTagged<'a> {
Flatten {
#[serde(flatten)... | acfd19cb463ea77d2146d637c35d8751601dae75 |
2,330 | diff --git a/test_suite/tests/test_remote.rs b/test_suite/tests/test_remote.rs
index c6d276e10..d997f0f01 100644
--- a/test_suite/tests/test_remote.rs
+++ b/test_suite/tests/test_remote.rs
@@ -79,6 +79,13 @@ mod remote {
pub value: T,
}
+ impl<T> StructGeneric<T> {
+ #[allow(dead_code)]
+ ... | [
"2327"
] | serde-rs__serde-2330 | Deriving Serialize for a struct from external crate which uses generics
Hello,
I'm trying to implement Serialize for [nom_locate's](https://docs.rs/nom_locate/latest/nom_locate/) [`LocatedSpan`](https://docs.rs/nom_locate/latest/nom_locate/struct.LocatedSpan.html). It's a struct that encapsulates a token with some lo... | 1.14 | fabbd2b0970084fe8f85bf850f8cd295dd12b305 | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index ef7a2dee2..a703adaf7 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -712,8 +712,9 @@ fn deserialize_seq(
if params.has_getter {
let this_type = ¶ms.this_type;
+ let (_, ty_generics, _) = params.generics.sp... | serde-rs/serde | 2022-11-28T01:18:49Z | fabbd2b0970084fe8f85bf850f8cd295dd12b305 | |
2,159 | diff --git a/test_suite/tests/test_de_error.rs b/test_suite/tests/test_de_error.rs
index da6e7656c..db534e983 100644
--- a/test_suite/tests/test_de_error.rs
+++ b/test_suite/tests/test_de_error.rs
@@ -379,57 +379,81 @@ fn test_nonzero_i8() {
let test = assert_de_tokens_error::<NonZeroI8>;
// from zero
- ... | [
"2158"
] | serde-rs__serde-2159 | Improve errors upon deserializing NonZero*
Deserializing errors on NonZero* could definitely be improved, not sure if this is possible, but somehow the normal numerical types have better information attached to them - is this fault of the wrappers - probably not.
<details>
<summary> silly example code </summary>... | 1.13 | bc66aeb0d316d608e43061372d6bd400aad2d393 | diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs
index d7c57568a..c5aaca723 100644
--- a/serde/src/de/impls.rs
+++ b/serde/src/de/impls.rs
@@ -81,8 +81,34 @@ impl<'de> Deserialize<'de> for bool {
////////////////////////////////////////////////////////////////////////////////
macro_rules! impl_deserialize... | serde-rs/serde | 2022-01-21T06:01:53Z | bc66aeb0d316d608e43061372d6bd400aad2d393 | |
2,079 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index 93d5cd3a5..3e19d3c4b 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -846,3 +846,19 @@ where
{
T::deserialize(deserializer)
}
+
+/////////////////////////////////////////////////////////////////////////... | [
"2078"
] | serde-rs__serde-2079 | Unaligned reference warnings on packed structures
I'm getting `unaligned_references` warnings using `serde_derive` on packed structures. From #1747 and #1813 it seems like this should have been fixed since these structures also impl's `Copy`.
Here's a minimal example that reproduces what I'm seeing w/ serde 1.0.... | 1.12 | 55fdbea20bbcb0f0fa7e9545ec0ea10c87a6643d | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index 0903a084c..7f4d7c441 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -36,7 +36,7 @@ pub fn expand_derive_deserialize(
let impl_block = if let Some(remote) = cont.attrs.remote() {
let vis = &input.vis;
- let use... | serde-rs/serde | 2021-08-23T17:19:46Z | 55fdbea20bbcb0f0fa7e9545ec0ea10c87a6643d | |
1,997 | diff --git a/test_suite/tests/test_de.rs b/test_suite/tests/test_de.rs
index cb861374f..fb77f8d91 100644
--- a/test_suite/tests/test_de.rs
+++ b/test_suite/tests/test_de.rs
@@ -15,7 +15,7 @@ use std::sync::atomic::{
AtomicUsize, Ordering,
};
use std::sync::{Arc, Weak as ArcWeak};
-use std::time::{Duration, UNIX_... | [
"1996"
] | serde-rs__serde-1997 | Serde panics when deserializing a malformed SystemTime
`SystemTime` is deserialized by deserializing a duration and adding it to `UNIX_EPOCH`. The documentation states that this can panic `if the resulting point in time cannot be represented by the underlying data structure`.
Also, `SystemTime` panics in the same si... | 1.12 | c26101532509477132721a8c56b7024891aaf1b4 | diff --git a/serde/build.rs b/serde/build.rs
index ca991a5d2..d9fd94074 100644
--- a/serde/build.rs
+++ b/serde/build.rs
@@ -76,12 +76,14 @@ fn main() {
println!("cargo:rustc-cfg=serde_derive");
}
- // TryFrom, Atomic types, and non-zero signed integers stabilized in Rust 1.34:
+ // TryFrom, Atomi... | serde-rs/serde | 2021-03-06T01:17:16Z | 55fdbea20bbcb0f0fa7e9545ec0ea10c87a6643d | |
1,970 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index 73f7fa50f..002885ead 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -7,6 +7,7 @@
#![allow(
unknown_lints,
mixed_script_confusables,
+ clippy::ptr_arg,
clippy::trivially_copy_pass_by_ref
)]... | [
"1969"
] | serde-rs__serde-1970 | `Self` does not work in a field with serialize_with
Closely related to #1506, #1565, #1830.
```rust
use serde::{Serialize, Serializer};
#[derive(Serialize)]
struct Struct {
#[serde(serialize_with = "vec_first_element")]
vec: Vec<Self>, // works if written as Vec<Struct>
}
fn vec_first_element<S>(... | 1.12 | b054ea41053ea4047882cc33970d2257cdfe04ac | diff --git a/serde_derive/src/lib.rs b/serde_derive/src/lib.rs
index f10baac01..8d1464ec8 100644
--- a/serde_derive/src/lib.rs
+++ b/serde_derive/src/lib.rs
@@ -79,8 +79,8 @@ mod try;
#[proc_macro_derive(Serialize, attributes(serde))]
pub fn derive_serialize(input: TokenStream) -> TokenStream {
- let input = par... | serde-rs/serde | 2021-01-25T21:27:57Z | 55fdbea20bbcb0f0fa7e9545ec0ea10c87a6643d | |
1,001 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index a82801b91..5d708014b 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -358,6 +358,21 @@ fn test_gen() {
#[serde(borrow, with = "StrDef")]
s: Str<'a>,
}
+
+ mod vis {
+ pub struc... | [
"1000"
] | serde-rs__serde-1001 | Remote type visibility
The `#[serde(remote)]` attribute generates `deserialize` and `serialize` methods in an impl for the local type but they're private - this prevents a remote "Def" type in a module from being exported outside of it. There are workarounds (newtype or redefine proxy functions) but would there be any ... | 1.0 | e6487cf6fa216c303491983aa3d74ea76f3215b6 | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index 03e265af4..647281c01 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -28,9 +28,10 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result<Tokens, Str
let body = Stmts(deserialize_body(&cont, ¶ms));
let... | serde-rs/serde | 2017-07-26T06:56:06Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
995 | diff --git a/test_suite/no_std/Cargo.toml b/test_suite/no_std/Cargo.toml
index 80bb6ed2a..7c0040666 100644
--- a/test_suite/no_std/Cargo.toml
+++ b/test_suite/no_std/Cargo.toml
@@ -7,3 +7,5 @@ publish = false
libc = { version = "0.2", default-features = false }
serde = { path = "../../serde", default-features = false... | [
"988"
] | serde-rs__serde-995 | No bin target named `serde_derive_tests_no_std`
In the test_suite directory, `cargo clippy` fails with this message.
```
error: no bin target named `serde_derive_tests_no_std`
```
As though it sees that bin target in test_suite/no_std/Cargo.toml but tries to build that bin target against test_suite/Cargo.toml.
... | 1.0 | 1c2a4bff1c01d0c84b653f2f4313f15621aa3168 | diff --git a/Cargo.toml b/Cargo.toml
index 29db37d3b..cb35f8543 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -5,5 +5,4 @@ members = [
"serde_derive_internals",
"serde_test",
"test_suite",
- "test_suite/no_std",
]
diff --git a/travis.sh b/travis.sh
index ddfbc3339..c43cb55f9 100755
--- a/travis.sh
+++ ... | serde-rs/serde | 2017-07-21T07:09:16Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
971 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index 2f3d6299a..a82801b91 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -330,6 +330,34 @@ fn test_gen() {
struct EmptyArray {
empty: [X; 0],
}
+
+ enum Or<A, B> {
+ A(A),
+ B(B... | [
"972"
] | serde-rs__serde-971 | Deriving Deserialize for a remote generic enum fails
I'm attempting to derive `Deserialize` and `Serialize` for the [`Or` enum from the `or` crate](https://docs.rs/or/0.0.1/or/enum.Or.html).
Deriving `Serialize` works fine:
```rust
#[derive(Serialize)] #[serde(untagged, remote = "Or")] enum OrDef<A, B> { A(A), B(B... | 1.0 | 4fdba725fe30dc30658b8e71bead7d9b83ab9b0f | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index 20ccb696f..03e265af4 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -23,15 +23,14 @@ pub fn expand_derive_deserialize(input: &syn::DeriveInput) -> Result<Tokens, Str
let ident = &cont.ident;
let params = Parameters::new(... | serde-rs/serde | 2017-06-30T03:13:43Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
963 | diff --git a/test_suite/tests/test_identifier.rs b/test_suite/tests/test_identifier.rs
index 76f1cffae..83a0d3b17 100644
--- a/test_suite/tests/test_identifier.rs
+++ b/test_suite/tests/test_identifier.rs
@@ -23,7 +23,10 @@ fn test_variant_identifier() {
Bbb,
}
+ assert_de_tokens(&V::Aaa, &[Token::U8... | [
"962"
] | serde-rs__serde-963 | Numeric variant identifier deserialization only handles u32
Even if the identifier is serialized as a u32, some formats like CBOR store numeric values in a variable length encoding. Small variant numbers are then deserialized as an e.g. u8. Unfortunately, the generated visitor only implements `visit_u32`, but `visit_u8... | 1.0 | 4fdba725fe30dc30658b8e71bead7d9b83ab9b0f | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index 20ccb696f..741baec77 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -1387,10 +1387,10 @@ fn deserialize_identifier(
};
let visit_index = if is_variant {
- let variant_indices = 0u32..;
+ let variant_indices... | serde-rs/serde | 2017-06-20T03:22:48Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
949 | diff --git a/test_suite/tests/test_de.rs b/test_suite/tests/test_de.rs
index d1bddfaf4..b915fba76 100644
--- a/test_suite/tests/test_de.rs
+++ b/test_suite/tests/test_de.rs
@@ -14,7 +14,7 @@ extern crate serde_derive;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::net;
use std::path::{Path, P... | [
"535"
] | serde-rs__serde-949 | impl Serialize and Deserialize for std::time::SystemTime
If there is a different type that is better suited for timestamps in serialized data that's already supported by serde, I'd be happy to know about it. The serialized format should probably be [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601).
| 1.0 | fd3d1396d33a49200daaaf8bf17eba78fe4183d8 | diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs
index 13f5c9966..1a48f8031 100644
--- a/serde/src/de/impls.rs
+++ b/serde/src/de/impls.rs
@@ -1364,6 +1364,132 @@ impl<'de> Deserialize<'de> for Duration {
////////////////////////////////////////////////////////////////////////////////
+#[cfg(feature = "s... | serde-rs/serde | 2017-06-04T08:40:20Z | :+1: We're going to have to use this approach mentioned in the documentation:
> Although a `SystemTime` cannot be directly inspected, the `UNIX_EPOCH` constant is provided in this module as an anchor in time to learn information about a `SystemTime`. By calculating the duration from this fixed point in time, a SystemT... | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 |
935 | diff --git a/test_suite/tests/test_annotations.rs b/test_suite/tests/test_annotations.rs
index f2604d456..cb9642e8f 100644
--- a/test_suite/tests/test_annotations.rs
+++ b/test_suite/tests/test_annotations.rs
@@ -580,6 +580,41 @@ fn test_skip_serializing_struct() {
);
}
+#[derive(Debug, PartialEq, Serialize, De... | [
"931"
] | serde-rs__serde-935 | Warn when using only one of skip_serializing and skip_deserializing
I used the `skip_serializing` attribute for a field, but forgot to add `skip_deserializing` too. After serializing my data to a binary format (with `bincode`), I tried to deserialize it but got an error which took a long time to track down.
```
/* ... | 1.0 | 4d5e450054431abb44e35c9d0c73d89b5741f05b | diff --git a/serde_derive_internals/src/attr.rs b/serde_derive_internals/src/attr.rs
index f60219103..caf306cfa 100644
--- a/serde_derive_internals/src/attr.rs
+++ b/serde_derive_internals/src/attr.rs
@@ -719,6 +719,12 @@ impl Field {
skip_deserializing.set_true();
}
+ ... | serde-rs/serde | 2017-05-16T09:39:16Z | From some quick github searches it looks like having one but not both of `skip_serializing` and `skip_deserializing` on a type that derives both `Serialize` and `Deserialize` is fairly uncommon but there are some legitimate use cases. I would be on board with adding a single attribute that means both, and improving the... | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 |
933 | diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs
index 651bcfea1..c4c615664 100644
--- a/test_suite/tests/test_macros.rs
+++ b/test_suite/tests/test_macros.rs
@@ -695,6 +695,35 @@ fn test_internally_tagged_enum() {
);
}
+#[test]
+fn test_internally_tagged_struct_variant_containing_... | [
"932"
] | serde-rs__serde-933 | Regression deserializing string Enums between 1.0.3 and 1.0.4
The example in https://gist.github.com/anonymous/440028c896809d8b3b51d8333cb6d2f9 works for me with `serde = "=1.0.3"`, `serde_json = "1.0.2"` and `serde_derive = "1.0.4"` and current stable rust, but errors when specifying `serde = "=1.0.4"` (or less precis... | 1.0 | c68b95969679a4d67180d14cf3b200dc9ce34de1 | diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs
index 2c5648cd5..19736a14b 100644
--- a/serde/src/private/de.rs
+++ b/serde/src/private/de.rs
@@ -1082,7 +1082,7 @@ mod content {
}
(variant, Some(value))
}
- Content::String(variant)... | serde-rs/serde | 2017-05-14T19:30:53Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
926 | diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs
index 6c7e4b2ab..651bcfea1 100644
--- a/test_suite/tests/test_macros.rs
+++ b/test_suite/tests/test_macros.rs
@@ -695,6 +695,30 @@ fn test_internally_tagged_enum() {
);
}
+#[test]
+fn test_internally_tagged_borrow() {
+ #[derive(D... | [
"906"
] | serde-rs__serde-926 | Support borrowing within internally tagged enum
Serde panics when trying to deserialize an struct which has a borrowed field, which also contains a borrowed field. For example, the following code compiles fine:
**EDIT:** fixed the example
```rust
#[macro_use]
extern crate serde_derive;
extern crate serde;
ext... | 1.0 | 58e30eaee4f62acc621ce95635fa7c7f8fe5c123 | diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs
index 45b383fb0..2c5648cd5 100644
--- a/serde/src/private/de.rs
+++ b/serde/src/private/de.rs
@@ -233,7 +233,7 @@ mod content {
///
/// Not public API. Use serde-value instead.
#[derive(Debug)]
- pub enum Content {
+ pub enum Content<'d... | serde-rs/serde | 2017-05-11T02:57:59Z | I don't think this is correctly minimized from what you showed in IRC earlier. [It gives a different error.](http://play.integer32.com/?gist=29b4a709bd0aecba7a5aa19024619778) Side note: the panic is coming from your code not Serde, because you unwrap the error. :wink:
I minimized it to this:
```rust
#[macro_use]
... | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 |
905 | diff --git a/test_suite/tests/test_macros.rs b/test_suite/tests/test_macros.rs
index d4144ab3d..6c7e4b2ab 100644
--- a/test_suite/tests/test_macros.rs
+++ b/test_suite/tests/test_macros.rs
@@ -751,6 +751,31 @@ fn test_adjacently_tagged_enum() {
],
);
+ // unit with excess content (f, g, h)
+ asser... | [
"816"
] | serde-rs__serde-905 | Tag/Content attributes should silently ignore unkown attributes
Currently if I use `#[serde(tag, content)]` on a tagged enum, it seems that serde would throw error when the JSON string contains attributes other than the tag and the content. I think silently ignore the unknown field could be better?
| 1.0 | c96efcb87ab72f14a2a084644308c4a5e98ed820 | diff --git a/serde/src/private/de.rs b/serde/src/private/de.rs
index 270e1df8a..45b383fb0 100644
--- a/serde/src/private/de.rs
+++ b/serde/src/private/de.rs
@@ -16,6 +16,7 @@ use de::Unexpected;
#[cfg(any(feature = "std", feature = "collections"))]
pub use self::content::{Content, ContentRefDeserializer, ContentDeser... | serde-rs/serde | 2017-04-27T18:25:41Z | Really we should respect deny_unknown_fields.
```rust
// as you said
#[derive(Serialize, Deserialize)]
#[serde(tag = "t", content = "c")]
enum E { /* ... */ }
// current behavior
#[derive(Serialize, Deserialize)]
#[serde(tag = "t", content = "c", deny_unknown_fields)]
enum F { /* ... */ }
```
I would w... | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 |
452 | diff --git a/serde_macros/tests/test.rs b/serde_macros/tests/test.rs
index e92112185..e04627877 100644
--- a/serde_macros/tests/test.rs
+++ b/serde_macros/tests/test.rs
@@ -1,7 +1,6 @@
#![feature(test, custom_attribute, custom_derive, plugin)]
#![plugin(serde_macros)]
-extern crate serde;
extern crate test;
inc... | [
"219"
] | serde-rs__serde-452 | Serializer and Deserializer should be pure interface
For now the Serializer and Deserializer traits contain many functions, but many of them have default implementations. A problem is, the default implementations make too many assumption about the serializing protocol, probably based on json. Though them may be conveni... | null | d751b4c39a956f3b36dd967d940a2f6fd0c2718e | diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs
index 4096fa8fb..1680312b0 100644
--- a/serde/src/de/impls.rs
+++ b/serde/src/de/impls.rs
@@ -593,7 +593,7 @@ macro_rules! array_impls {
fn deserialize<D>(deserializer: &mut D) -> Result<[T; $len], D::Error>
where D: Deseri... | serde-rs/serde | 2016-07-20T08:47:40Z | I agree. This "magic" has caused me some headache debugging, so I ended up replacing all of them manually.
+1. I think magic layers are more appropriate for Deserialize/Serialize sugar, which are types that many serde users need to interact with. The -er types are relatively rarely implemented, and harder for an autho... | 8cb6607e827717136a819caa44d8e43702724883 |
446 | diff --git a/serde_test/Cargo.toml b/serde_test/Cargo.toml
index 38d167027..9855d12fd 100644
--- a/serde_test/Cargo.toml
+++ b/serde_test/Cargo.toml
@@ -2,7 +2,7 @@
name = "serde_test"
# DO NOT RELEASE ANY MORE 0.7 RELEASES FROM THIS BRANCH
# USE THE 0.7.x BRANCH
-version = "0.8.0-rc1"
+version = "0.8.0-rc2"
author... | [
"404"
] | serde-rs__serde-446 | Rename feature "nightly-testing" to "unstable-testing"
From what I understand, the community has started to use the feature `unstable*` instead of `nightly*` for things that may depend on the nightly compiler. If this is the case, when we do 0.8, we should consider renaming this feature.
| null | 6c18896cf592238ba643aa9050e536e64d4a732c | diff --git a/.travis.yml b/.travis.yml
index 7e3e0d3b9..19a2d6929 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,15 +18,15 @@ before_script:
script:
- (cd serde && travis-cargo build)
- (cd serde && travis-cargo --skip nightly test)
-- (cd serde && travis-cargo --only nightly test -- --features nightly-testing)
+... | serde-rs/serde | 2016-07-17T20:18:29Z | 8cb6607e827717136a819caa44d8e43702724883 | |
437 | diff --git a/serde_test/src/de.rs b/serde_test/src/de.rs
index a2d4c3d7d..24dabe194 100644
--- a/serde_test/src/de.rs
+++ b/serde_test/src/de.rs
@@ -135,15 +135,18 @@ impl<I> de::Deserializer for Deserializer<I>
Some(Token::Option(true)) => visitor.visit_some(self),
Some(Token::Unit) => visito... | [
"386"
] | serde-rs__serde-437 | Unable to serialize sequence without knowing all elements.
In the logging library I'm working on, I would like to serialize map elements, provided by user API calls. However at any given time, I have only one `key: value` pair.
So I can't efficiently serialize a map:
```
fn serialize_map<V>(&mut self, visitor: V)... | 0.7 | ed603d4580154bc09af94964c2aca8b42f268274 | diff --git a/serde/src/ser/impls.rs b/serde/src/ser/impls.rs
index d0ac49bc9..a8876c958 100644
--- a/serde/src/ser/impls.rs
+++ b/serde/src/ser/impls.rs
@@ -64,8 +64,6 @@ use super::{
Error,
Serialize,
Serializer,
- SeqVisitor,
- MapVisitor,
};
//////////////////////////////////////////////////... | serde-rs/serde | 2016-07-12T13:45:46Z | Have you seen https://serde-rs.github.io/serde/serde/ser/impls/struct.MapIteratorVisitor.html ? Either that fits your use case or I don't understand your situation (please elaborate with some code in that case).
@oli-obk: This visitor is taking an iterator. I can't provide an iterator since I don't have a collection o... | ed603d4580154bc09af94964c2aca8b42f268274 |
418 | diff --git a/serde_macros/tests/compile_tests.rs b/serde_macros/tests/compile_tests.rs
index 27c212b4d..419425226 100644
--- a/serde_macros/tests/compile_tests.rs
+++ b/serde_macros/tests/compile_tests.rs
@@ -20,6 +20,11 @@ fn run_mode(mode: &'static str) {
}
#[test]
-fn compile_test() {
+fn compile_fail() {
r... | [
"350"
] | serde-rs__serde-418 | serde_macros spans need add expansion info
clippy can't detect whether the code was expanded or not without that info
cc https://github.com/Manishearth/rust-clippy/issues/969
| 0.7 | 5deba439c3e44b5646cef22d34ccc412cbcb23f3 | diff --git a/serde_codegen/src/de.rs b/serde_codegen/src/de.rs
index c875848cb..69d70bc37 100644
--- a/serde_codegen/src/de.rs
+++ b/serde_codegen/src/de.rs
@@ -8,6 +8,7 @@ use syntax::ptr::P;
use syntax::tokenstream::TokenTree;
use bound;
+use span;
use internals::ast::{Body, Field, Item, Style, Variant};
use in... | serde-rs/serde | 2016-07-03T17:54:02Z | ed603d4580154bc09af94964c2aca8b42f268274 | |
412 | diff --git a/serde_macros/tests/test.rs b/serde_macros/tests/test.rs
index f2e785a56..e92112185 100644
--- a/serde_macros/tests/test.rs
+++ b/serde_macros/tests/test.rs
@@ -4,6 +4,6 @@
extern crate serde;
extern crate test;
-include!("../../serde_tests/tests/test.rs.in");
+include!("../../testing/tests/test.rs.in")... | [
"411"
] | serde-rs__serde-412 | Publish a serde_test crate containing the Token De/Serializer.
[This Serializer and Deserializer](https://github.com/serde-rs/serde/blob/6ab508a93c8163a12315729f00fce4c539dfebd5/serde_tests/tests/token.rs) would be really useful for writing tests in other crates that implement Serialize/Deserialize for their types.
| 0.7 | 6ab508a93c8163a12315729f00fce4c539dfebd5 | diff --git a/.travis.yml b/.travis.yml
index ff56c4826..de282ca26 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,15 +22,15 @@ script:
- (cd serde && travis-cargo build -- --no-default-features)
- (cd serde && travis-cargo --only nightly build -- --no-default-features --features alloc)
- (cd serde && travis-cargo ... | serde-rs/serde | 2016-06-29T05:26:15Z | ed603d4580154bc09af94964c2aca8b42f268274 | |
371 | diff --git a/serde_tests/Cargo.toml b/serde_tests/Cargo.toml
index adb7a9401..477921763 100644
--- a/serde_tests/Cargo.toml
+++ b/serde_tests/Cargo.toml
@@ -19,6 +19,7 @@ syntex_syntax = { version = "^0.35.0" }
serde_codegen = { version = "*", path = "../serde_codegen", features = ["with-syntex"] }
[dev-dependencie... | [
"369"
] | serde-rs__serde-371 | implement Serialize + Deserialize for HashMap with custom hash functions
As far as I am aware the implementation of HashMap serialization/deserialization is only for SipHasher.
```
impl<K, V> Serialize for HashMap<K, V>
where K: Serialize + Eq + Hash,
V: Serialize,
```
Is it feasible or desired to impl... | 0.7 | 84a573c92699ef13f27758c543d8b8038964d960 | diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs
index ed727aa23..bdd547c7f 100644
--- a/serde/src/de/impls.rs
+++ b/serde/src/de/impls.rs
@@ -32,7 +32,7 @@ use collections::enum_set::{CLike, EnumSet};
#[cfg(all(feature = "nightly", feature = "collections"))]
use collections::borrow::ToOwned;
-use core::h... | serde-rs/serde | 2016-06-11T08:11:42Z | Custom hashers were added in Rust 1.7, and since serde is currently tracking the last 3 releases it seems like we could add support for this now. @dtolnay / @oli-obk: what do you two think?
Let's do it.
| ed603d4580154bc09af94964c2aca8b42f268274 |
354 | diff --git a/serde_tests/tests/test_annotations.rs b/serde_tests/tests/test_annotations.rs
index cdaa899ef..79e1683b3 100644
--- a/serde_tests/tests/test_annotations.rs
+++ b/serde_tests/tests/test_annotations.rs
@@ -441,7 +441,8 @@ enum RenameEnumSerializeDeserialize<A> {
#[serde(rename(serialize="dick_grayson", ... | [
"353"
] | serde-rs__serde-354 | `rename` attributes overwrite each other
``` rust
#![feature(custom_derive, plugin)]
#![plugin(serde_macros)]
extern crate serde_json;
#[derive(Serialize, Deserialize, Default)]
struct S {
#[serde(rename(serialize="s1", deserialize="d1"))]
v1: (),
#[serde(rename(serialize="s2"))]
#[serde(rename(deseri... | 0.7 | 4b472be56e8b071a12b3b4f03c3829251812453c | diff --git a/serde_codegen/src/attr.rs b/serde_codegen/src/attr.rs
index 2a3bd4979..b59e860b8 100644
--- a/serde_codegen/src/attr.rs
+++ b/serde_codegen/src/attr.rs
@@ -82,7 +82,6 @@ impl ContainerAttrs {
// Parse `#[serde(rename="foo")]`
ast::MetaItemKind::NameValue(ref name, ... | serde-rs/serde | 2016-06-06T08:50:43Z | ed603d4580154bc09af94964c2aca8b42f268274 | |
338 | diff --git a/serde_tests/tests/test_gen.rs b/serde_tests/tests/test_gen.rs
index 805c100db..8410b2c3c 100644
--- a/serde_tests/tests/test_gen.rs
+++ b/serde_tests/tests/test_gen.rs
@@ -49,6 +49,12 @@ enum EnumWith<T> {
i: i32 },
}
+#[derive(Serialize)]
+struct MultipleRef<'a, 'b, 'c, T> where T: 'c, 'c: 'b,... | [
"337"
] | serde-rs__serde-338 | Double reference generates bad code
``` rust
#[derive(Serialize)]
pub struct S<'a, 'b, T> where 'b: 'a, T: 'a + 'b {
a: &'a &'b T,
b: T,
}
```
```
error: cannot infer an appropriate lifetime for borrow expression due to conflicting requirements [E0495]
return Ok(Some(try!(_serializer.serialize_struct... | 0.7 | 16d3e96b77fe8d50a2f9d9716ec231fc04251bce | diff --git a/serde_codegen/src/bound.rs b/serde_codegen/src/bound.rs
index c46cc2b0b..4f563e9b2 100644
--- a/serde_codegen/src/bound.rs
+++ b/serde_codegen/src/bound.rs
@@ -139,9 +139,9 @@ fn contains_generic(ty: &ast::Ty, generics: &ast::Generics) -> bool {
//
// impl<'a, T> Serialize for Test<'a, T>
// w... | serde-rs/serde | 2016-05-19T06:49:47Z | ed603d4580154bc09af94964c2aca8b42f268274 | |
335 | diff --git a/serde_tests/tests/test_gen.rs b/serde_tests/tests/test_gen.rs
index 8410b2c3c..6f897e089 100644
--- a/serde_tests/tests/test_gen.rs
+++ b/serde_tests/tests/test_gen.rs
@@ -1,5 +1,6 @@
// These just test that serde_codegen is able to produce code that compiles
-// successfully when there are a variety of g... | [
"330"
] | serde-rs__serde-335 | Tuple struct fields with deserialize_with still require Deserialize bound
The following complains about `Url` not implementing `Deserialize`
``` rust
#[derive(Deserialize)]
pub struct SerializableUrl(#[serde(deserialize_with="DeserializeWith::deserialize_with")] Url)
```
| 0.7 | cc115ca43a52e88d4afb2dc50e21c9380812f13b | diff --git a/serde_codegen/src/attr.rs b/serde_codegen/src/attr.rs
index d8dc7379f..cc5cfe383 100644
--- a/serde_codegen/src/attr.rs
+++ b/serde_codegen/src/attr.rs
@@ -177,31 +177,29 @@ pub struct FieldAttrs {
name: Name,
skip_serializing_field: bool,
skip_deserializing_field: bool,
- skip_serializin... | serde-rs/serde | 2016-05-16T18:46:34Z | ed603d4580154bc09af94964c2aca8b42f268274 | |
1,251 | diff --git a/test_suite/tests/test_de.rs b/test_suite/tests/test_de.rs
index 3a8fcc448..a7eedba3f 100644
--- a/test_suite/tests/test_de.rs
+++ b/test_suite/tests/test_de.rs
@@ -17,15 +17,15 @@ use std::ffi::{CString, OsString};
use std::net;
use std::num::Wrapping;
use std::path::{Path, PathBuf};
-use std::rc::Rc;
-... | [
"186"
] | serde-rs__serde-1251 | No way to serialize Weak pointers
As mentioned on [reddit](https://www.reddit.com/r/rust/comments/3u4ri0/serde_serializing_weak/). Open question: What do we do if the value the `Weak` pointer is pointing at has been destroyed? Should we serialize them as an `Option` pointer?
| 1.0 | dc921892be95f07914fff21410c12310a8305158 | diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs
index 5a53a418e..aa4ede6c4 100644
--- a/serde/src/de/impls.rs
+++ b/serde/src/de/impls.rs
@@ -1474,6 +1474,44 @@ where
////////////////////////////////////////////////////////////////////////////////
+/// This impl requires the [`"rc"`] Cargo feature of Se... | serde-rs/serde | 2018-05-07T17:41:10Z | It's also not clear what we should do for deserialization.
I'd serialize it as an `Option` pointer and during deserialization, in case it's `None`, just create an `Rc`, make a `Weak` from that and `drop` the `Rc`.
@oli-obk: I suppose that would work, but it seems sad that we wouldn't actually be able to deserialize t... | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 |
1,249 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index d6921e148..f0255bad3 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -567,6 +567,17 @@ fn test_gen() {
}
assert::<AssocDeriveMulti<i32, NoSerdeImpl>>();
+
+ #[derive(Serialize)]
+ #[serde(tag... | [
"1247"
] | serde-rs__serde-1249 | Adjacently tagged empty tuple variant or struct variant generates broken Serialize
```rust
#[derive(Serialize)]
#[serde(tag = "t", content = "c")]
enum E {
A {}, // same for `A()`
}
```
```
error[E0392]: parameter `'__a` is never used
--> src/main.rs:68:10
|
68 | #[derive(Serialize)]
| ... | 1.0 | 9dc05c36f0fa9efc66e4bb0ae59822d475c3b0a0 | diff --git a/serde_derive/src/ser.rs b/serde_derive/src/ser.rs
index 987cc53ae..38b03eece 100644
--- a/serde_derive/src/ser.rs
+++ b/serde_derive/src/ser.rs
@@ -645,7 +645,7 @@ fn serialize_adjacently_tagged_variant(
let (_, ty_generics, where_clause) = params.generics.split_for_impl();
- let wrapper_generi... | serde-rs/serde | 2018-05-07T04:50:07Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
1,248 | diff --git a/test_suite/tests/compile-fail/conflict/flatten-within-enum.rs b/test_suite/tests/compile-fail/conflict/flatten-within-enum.rs
deleted file mode 100644
index d2e007d26..000000000
--- a/test_suite/tests/compile-fail/conflict/flatten-within-enum.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2018 Serde Devel... | [
"1206"
] | serde-rs__serde-1248 | Support flatten within struct variant
```rust
#[derive(Serialize, Deserialize)]
enum Foo {
A {
#[serde(flatten)]
fields: HashMap<String, String>,
}
}
```
```
error: proc-macro derive panicked
--> src/main.rs:6:21
|
6 | #[derive(Serialize, Deserialize)]
| ... | 1.0 | 5098609935f236a30d9c42356d2941d847c699f6 | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index f1a37b854..e3197fcf4 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -838,6 +838,10 @@ fn deserialize_struct(
quote! {
_serde::Deserializer::deserialize_any(#deserializer, #visitor_expr)
}
+ } else i... | serde-rs/serde | 2018-05-07T04:24:19Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
1,245 | diff --git a/test_suite/tests/test_annotations.rs b/test_suite/tests/test_annotations.rs
index 5e38ad34a..815a47b6a 100644
--- a/test_suite/tests/test_annotations.rs
+++ b/test_suite/tests/test_annotations.rs
@@ -1793,3 +1793,49 @@ fn test_flatten_enum_newtype() {
],
);
}
+
+#[test]
+fn test_flatten_inte... | [
"1189"
] | serde-rs__serde-1245 | Support deserializing a flattened internally tagged enum
This would be valuable to support if possible. Serialization already works but deserialization does not.
```rust
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
#[derive(Serialize, Deserialize, Debug)]
struct Data... | 1.0 | ed425b3a6f1854a9058902aee57263972321fa87 | diff --git a/serde/src/de/mod.rs b/serde/src/de/mod.rs
index 826662dfa..0a5c487d7 100644
--- a/serde/src/de/mod.rs
+++ b/serde/src/de/mod.rs
@@ -1132,6 +1132,18 @@ pub trait Deserializer<'de>: Sized {
fn is_human_readable(&self) -> bool {
true
}
+
+ // Not public API.
+ #[doc(hidden)]
+ fn p... | serde-rs/serde | 2018-05-06T04:43:11Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
1,241 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index e06ec5a88..d6921e148 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -333,9 +333,7 @@ fn test_gen() {
#[derive(Serialize, Deserialize)]
#[serde(untagged, remote = "Or")]
enum OrDef<A, B> {
- ... | [
"976"
] | serde-rs__serde-1241 | Types used in remote derive are dead code
Remote derive structs exist only to tell serde_derive what are the fields of the real struct. As such, no code uses the fields of the remote derive struct.
```rust
#[macro_use]
extern crate serde_derive;
extern crate serde;
#[derive(Serialize)]
#[serde(remote = "S")... | 1.0 | 893c0578ddf4b692d10a44053805fad67fae2fdb | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index af3d3693e..1ad97006d 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -16,6 +16,7 @@ use bound;
use fragment::{Expr, Fragment, Match, Stmts};
use internals::ast::{Container, Data, Field, Style, Variant};
use internals::{self, attr}... | serde-rs/serde | 2018-05-02T20:30:26Z | Things to be careful about:
- Should work for non-public structs.
- Should work for structs with fields of non-public type.
- Should work for structs with generic type parameters.
- Should work for structs with type parameters bound by a non-public trait.
- Should work for structs with lifetime parameters.
- Al... | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 |
1,213 | diff --git a/test_suite/tests/test_gen.rs b/test_suite/tests/test_gen.rs
index 368403e77..aa5e0c4c8 100644
--- a/test_suite/tests/test_gen.rs
+++ b/test_suite/tests/test_gen.rs
@@ -539,6 +539,30 @@ fn test_gen() {
array: [u8; 256],
}
assert_ser::<BigArray>();
+
+ trait AssocSerde {
+ type A... | [
"1208"
] | serde-rs__serde-1213 | Infer correct trait bounds for use of a type parameter associated type
The following expands to `impl<T: Trait> Serialize for Struct<T>` which fails to compile.
```rust
trait Trait {
type Assoc;
}
#[derive(Serialize)]
struct Struct<T: Trait> {
assoc: T::Assoc,
}
```
The builtin derives already g... | 1.0 | 5efb22ebee128f1ec4a755556230bdd66c3f2026 | diff --git a/serde_derive/src/bound.rs b/serde_derive/src/bound.rs
index 4e7c7d71b..1506a9ba2 100644
--- a/serde_derive/src/bound.rs
+++ b/serde_derive/src/bound.rs
@@ -50,18 +50,39 @@ pub fn with_where_predicates(
generics
}
-pub fn with_where_predicates_from_fields<F>(
+pub fn with_where_predicates_from_field... | serde-rs/serde | 2018-04-10T15:26:14Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
1,205 | diff --git a/test_suite/tests/compile-fail/conflict/flatten-newtype-struct.rs b/test_suite/tests/compile-fail/conflict/flatten-newtype-struct.rs
new file mode 100644
index 000000000..07566f8c7
--- /dev/null
+++ b/test_suite/tests/compile-fail/conflict/flatten-newtype-struct.rs
@@ -0,0 +1,16 @@
+// Copyright 2018 Serde ... | [
"1188"
] | serde-rs__serde-1205 | Assertion failed: !cattrs.has_flatten()
This should have a better error message, ideally detected by serde_derive_internals.
```rust
#[derive(Deserialize)]
struct Mitsuhiko(#[serde(flatten)] HashMap<String, String>);
```
```
error: proc-macro derive panicked
--> src/main.rs:18:10
|
18 | #[derive(Deser... | 1.0 | 9c659d9d869c2a175595cd62ea9460009df392c4 | diff --git a/serde_derive_internals/src/check.rs b/serde_derive_internals/src/check.rs
index 31980a398..6db99a173 100644
--- a/serde_derive_internals/src/check.rs
+++ b/serde_derive_internals/src/check.rs
@@ -47,11 +47,20 @@ fn check_flatten(cx: &Ctxt, cont: &Container) {
Data::Enum(_) => {
assert... | serde-rs/serde | 2018-04-01T20:12:09Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
1,204 | diff --git a/test_suite/tests/compile-fail/conflict/flatten-within-enum.rs b/test_suite/tests/compile-fail/conflict/flatten-within-enum.rs
new file mode 100644
index 000000000..d2e007d26
--- /dev/null
+++ b/test_suite/tests/compile-fail/conflict/flatten-within-enum.rs
@@ -0,0 +1,21 @@
+// Copyright 2018 Serde Developer... | [
"1185"
] | serde-rs__serde-1204 | Flatten inside a struct variant produces broken Serialize code
```rust
#[derive(Serialize)]
enum Mitsuhiko {
A {
#[serde(flatten)]
fields: HashMap<String, String>,
}
}
```
```
error[E0277]: the trait bound `<__S as _IMPL_SERIALIZE_FOR_Mitsuhiko::_serde::Serializer>::SerializeStructVa... | 1.0 | 9c659d9d869c2a175595cd62ea9460009df392c4 | diff --git a/serde_derive_internals/src/ast.rs b/serde_derive_internals/src/ast.rs
index fd531d8c7..fd742c9e5 100644
--- a/serde_derive_internals/src/ast.rs
+++ b/serde_derive_internals/src/ast.rs
@@ -68,6 +68,9 @@ impl<'a> Container<'a> {
Data::Enum(ref mut variants) => for variant in variants {
... | serde-rs/serde | 2018-04-01T20:02:11Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
1,140 | diff --git a/test_suite/Cargo.toml b/test_suite/Cargo.toml
index 50e10e360..23a9fd79d 100644
--- a/test_suite/Cargo.toml
+++ b/test_suite/Cargo.toml
@@ -9,6 +9,7 @@ unstable = ["serde/unstable", "compiletest_rs"]
[dev-dependencies]
fnv = "1.0"
+proc-macro2 = "0.2"
rustc-serialize = "0.3.16"
serde = { path = "../s... | [
"1139"
] | serde-rs__serde-1140 | Tuple structs with private fields do not work with proc-macro2/nightly
The test suite does not compile, lots of errors like this:
```rust
#[derive(Serialize)]
struct S(u8);
```
```
error[E0611]: field `0` of tuple-struct `S` is private
--> src/main.rs:8:10
|
8 | #[derive(Serialize)]
| ^^^^^^... | 1.0 | 16bc9fb99e20438f9f9cf5ea7aa7b8958f12d696 | diff --git a/serde_derive/src/de.rs b/serde_derive/src/de.rs
index c9154321a..1e78d52af 100644
--- a/serde_derive/src/de.rs
+++ b/serde_derive/src/de.rs
@@ -6,7 +6,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-use syn::{self, Ident, Member};
+use syn::{se... | serde-rs/serde | 2018-01-10T06:23:55Z | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 | |
1,124 | diff --git a/serde_test/src/assert.rs b/serde_test/src/assert.rs
index 903a56164..821014097 100644
--- a/serde_test/src/assert.rs
+++ b/serde_test/src/assert.rs
@@ -195,15 +195,15 @@ where
panic!("{} remaining tokens", de.remaining());
}
- // Do the same thing for deserialize_from. This isn't *great*... | [
"1122"
] | serde-rs__serde-1124 | Is deserialize_from really more like into
Insightful comment from @nox in #servo:
> **\<nox>** Yeah but I’m curious about the name.
> **\<nox>** The idea I heard was more like deserialize_into than deserialize_from.
| 1.0 | 0b89bc920e6052c05483c8b56661e859caae9d25 | diff --git a/serde/src/de/impls.rs b/serde/src/de/impls.rs
index 87aa6c684..ddd1997cd 100644
--- a/serde/src/de/impls.rs
+++ b/serde/src/de/impls.rs
@@ -15,7 +15,7 @@ use de::{Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, Va
use de::MapAccess;
use de::from_primitive::FromPrimitive;
-use priva... | serde-rs/serde | 2017-12-17T19:00:22Z | The naming is meant to align with the relatively obscure Clone::clone_from --
```rust
trait Clone {
fn clone(&self) -> Self;
fn clone_from(&mut self, source: &Self);
}
```
```rust
trait Deserialize<'de> {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>;
fn deserialize_from<D>(... | 4cea81f93f12473e0ccbdad2ddecff1f7ea85402 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.