Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serde_codegen missing some carraige returns #196

Closed
mikedilger opened this issue Dec 20, 2015 · 6 comments
Closed

serde_codegen missing some carraige returns #196

mikedilger opened this issue Dec 20, 2015 · 6 comments
Labels
Milestone

Comments

@mikedilger
Copy link

This:

/// An uploaded file that was received as part of `multipart/form-data` parsing.
///
/// Files are streamed to disk because they may not fit in memory.
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UploadedFile {
    /// The temporary file where the data was saved.
    pub path: PathBuf,
    /// The filename that was specified in the data, unfiltered. It may or may not be legal on the
    /// local filesystem.
    pub filename: Option<String>,
    /// The unvalidated content-type that was specified in the data.
    pub content_type: Mime,
    /// The size of the file.
    pub size: usize,
    // The temporary directory the upload was put into, saved for the Drop trait
    tempdir: PathBuf,
}

is turning into this:

/// An uploaded file that was received as part of `multipart/form-data` parsing.////// Files are streamed to disk because they may not fit in memory.#[derive_Clone]
#[derive_PartialEq]
#[derive_Debug]
pub struct UploadedFile {
    /// The temporary file where the data was saved.
    pub path: PathBuf,
    /// The filename that was specified in the data, unfiltered. It may or may not be legal on the
    /// local filesystem.
    pub filename: Option<String>,
    /// The unvalidated content-type that was specified in the data.
    pub content_type: Mime,
    /// The size of the file.
    pub size: usize,
    tempdir: PathBuf,
}
impl ::serde::de::Deserialize for UploadedFile {
...

Causing one of the derives to be commented out.
(serde_codegen 0.6.6, syntex 0.22.0)

Any sort of workaround would be appreciated.

@mtdowling
Copy link

Just ran into this today myself. Is this an issue in serde_codegen or in syntex?

@erickt
Copy link
Member

erickt commented Jan 18, 2016

@mtdowling: I think this was supposed to be fixed in the latest syntex and serde_codegen. Which version are you on?

@erickt erickt added the bug label Jan 18, 2016
@erickt erickt added this to the v0.7.0 milestone Jan 18, 2016
@jimmycuadra
Copy link
Contributor

This is happening to me using these versions:

  • serde_codegen 0.6.10
  • syntex 0.26.0

Anyone have a workaround for this in the interim?

@erickt
Copy link
Member

erickt commented Feb 16, 2016

Ugh, I was able to reproduce this. One workaround would be to use the /** ... */ style comments, as in:

/**
An uploaded file that was received as part of `multipart/form-data` parsing.

Files are streamed to disk because they may not fit in memory.
*/
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct UploadedFile {
    /// The temporary file where the data was saved.
    pub path: PathBuf,
    /// The filename that was specified in the data, unfiltered. It may or may not be legal on the
    /// local filesystem.
    pub filename: Option<String>,
    /// The unvalidated content-type that was specified in the data.
    pub content_type: Mime,
    /// The size of the file.
    pub size: usize,
    // The temporary directory the upload was put into, saved for the Drop trait
    tempdir: PathBuf,
}

That still has the missing-newline, but it won't comment out critical code.

@erickt
Copy link
Member

erickt commented Feb 17, 2016

Turns out this is a rust pretty printing bug that syntex inherited.

@erickt
Copy link
Member

erickt commented Feb 17, 2016

Moving this bug over to serde-deprecated/syntex#31.

@erickt erickt closed this as completed Feb 17, 2016
rubdos pushed a commit to rubdos/serde that referenced this issue Jun 20, 2017
`use serde;` leads to compilation error; `extern crate` is enough

This PR fixes the compile error of `num-complex` that appears due to a redundant `use serde;` after `extern crate serde;` in the same module. To reproduce the error, just build `num-complex` with the feature `serde`, see below.

```zsh
% cargo build --features serde
   Compiling num-complex v0.1.32 (file:///home/janis/github/num/complex)
src/lib.rs:27:5: 27:10 error: an extern crate named `serde` has already been imported in this module [E0259]
src/lib.rs:27 use serde;
                  ^~~~~
src/lib.rs:19:1: 19:20 note: previous import of `serde` here
src/lib.rs:19 extern crate serde;
              ^~~~~~~~~~~~~~~~~~~
src/lib.rs:27:5: 27:10 help: run `rustc --explain E0259` to see a detailed explanation
error: aborting due to previous error
error: Could not compile `num-complex`.
```
rubdos pushed a commit to rubdos/serde that referenced this issue Jun 20, 2017
Fix import serde and rational deserialization

Similar to serde-rs#196 for num/complex, “use serde;” needed to be removed in num/rational.

Also, deserialization of `num/rational` needed to be fixed by adding type annotations.

This is in response to rust-num/num#222 (comment) of issue rust-num/num#222.

Also added a travis line, in response to rust-num/num#222 (comment). Hope it works.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

4 participants