Skip to content

Deprecated map fields not marked as deprecated in generated code #1383

@okkero

Description

@okkero

Consider the following message definition:

message Foo {
  uint32 foo = 1 [deprecated = true];
  repeated string bar = 2 [deprecated = true];
  map<uint32, string> baz = 3 [deprecated = true];
}

These fields are all deprecated, so you'd expect they would all get marked as #[deprecated] in the generated Rust code. However, only foo and bar get correctly marked, and baz does not:

#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Foo {
    #[deprecated]
    #[prost(uint32, tag = "1")]
    pub foo: u32,
    #[deprecated]
    #[prost(string, repeated, tag = "2")]
    pub bar: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
    #[prost(map = "uint32, string", tag = "3")]
    pub baz: ::std::collections::HashMap<u32, ::prost::alloc::string::String>,
}

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