Skip to content

error[internal]: left behind trailing whitespace on code generated by protoc-gen-prost-serde #6626

@nnmm

Description

@nnmm

rustfmt 1.8.0-stable (6b00bc3880 2025-06-23) produces this error with all editions on this file:

pub mod pkg_xyz {
    impl serde::Deserialize for L {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer,
        {
            struct GeneratedVisitor;
            impl serde::de::Visitor for GeneratedVisitor {
                fn visit_map(self, mut map_: String) {
                    let mut field1__ = None;
                    while let Some(k) = map_.next_key() {
                        match k {
                            GeneratedField::Field1 => {
                                field1__ = 
                                Some(map_.next_value::<Vec<::pbjson::private::NumberDeserialize<_>>>()?
                                    .into_iter().map(|x| x.0).collect())
                            ;
                            }
                        }
                    }
                }
            }

            blah()
        }
    }
}

The original file, if needed, is full_reproducer.rs.txt. I added a .txt because GitHub doesn't let me upload a .rs file.

If there is a workaround for this issue, I'd be glad to hear it!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions