You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like this is because the generated structure correctly marks the field as deprecated but not the access functions generated by #[prost(enumeration = "Color", tag = "1")].
To see the actual function generated by the macro I had to use cargo expand:
cargo expand -p prost_reproducer_app --color always items | less -r
...
#[allow(dead_code)]implShirt{///Returns the enum value of `deprecated_color`, or the default if the field is set to an invalid enum value.pubfndeprecated_color(&self) -> Color{::core::convert::TryFrom::try_from(self.deprecated_color).unwrap_or(Color::default())}///Sets `deprecated_color` to the provided enum value.pubfnset_deprecated_color(&mutself,value:Color){self.deprecated_color = value asi32;}}
We can see that the functions have no #[deprecated] decorator attached to them. However, they do access deprecated_color internally, which should raise a warning. I don't know why rustc silences it (just because it's a macro ? Couldn't find anything about this behavior), but it does.
The text was updated successfully, but these errors were encountered:
If you declare a message with a deprecated enum field, like so:
You don't get a deprecation warning if you try to use the deprecated_color access functions:
I've made a reproducer for this bug here: https://github.com/Orycterope/prost_deprecation_reproducer
It looks like this is because the generated structure correctly marks the field as deprecated but not the access functions generated by
#[prost(enumeration = "Color", tag = "1")]
.To see the actual function generated by the macro I had to use cargo expand:
We can see that the functions have no
#[deprecated]
decorator attached to them. However, they do accessdeprecated_color
internally, which should raise a warning. I don't know why rustc silences it (just because it's a macro ? Couldn't find anything about this behavior), but it does.The text was updated successfully, but these errors were encountered: