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
PR #85617 had an unintended side effect that generates invalid warnings on enum declarations.
A simple example, below, demonstrates the issue. I reverted the change from that PR, and I don't get the warning, to validate that PR causes the problem.
This is a significant issue for projects that require warnings be treated as errors, so I hope we can prioritize a fix or revert of the change. Thanks!
I tried this code:
#[derive(Debug)]pubstructTxid();#[derive(Debug)]#[deprecated(note = "Use EchoRequest instead")]// #[allow(deprecated)] // required to avoid warningpubenumEchoRequestMessage{EchoString{value:Option<String>,tx_id:Txid},}#[allow(deprecated)]implEchoRequestMessage{pubfnnew() -> Self{EchoRequestMessage::EchoString{value:None,tx_id:Txid()}}}#[allow(deprecated)]fnmain(){let mess = EchoRequestMessage::new();println!("made a {:?}", mess);}
I expected to see this happen: No warnings
I should not have to allow(deprecated) on the declaration of the deprecated thing.
Instead, this happened: I get a deprecation warning on the declaration of the thing that is declared as deprecated.
$ /usr/local/google/home/richkadel/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc test_deprecated.rs
warning: use of deprecated variant EchoRequestMessage::EchoString: Use EchoRequest instead
--> test_deprecated.rs:8:5
|
8 | EchoString { value: Option, tx_id: Txid },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[warn(deprecated)] on by default
I think reverting it to start makes sense to me if it's having significant impact, I'd at least be happy to r+ such a revert (and the PR can be relanded later with a fix).
PR #85617 had an unintended side effect that generates invalid warnings on
enum
declarations.A simple example, below, demonstrates the issue. I reverted the change from that PR, and I don't get the warning, to validate that PR causes the problem.
This is a significant issue for projects that require warnings be treated as errors, so I hope we can prioritize a fix or revert of the change. Thanks!
I tried this code:
I expected to see this happen: No warnings
I should not have to
allow(deprecated)
on the declaration of the deprecated thing.Instead, this happened: I get a deprecation warning on the declaration of the thing that is declared as deprecated.
$ /usr/local/google/home/richkadel/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc test_deprecated.rs
warning: use of deprecated variant
EchoRequestMessage::EchoString
: Use EchoRequest instead--> test_deprecated.rs:8:5
|
8 | EchoString { value: Option, tx_id: Txid },
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note:
#[warn(deprecated)]
on by defaultwarning: 1 warning emitted
Meta
rustc --version --verbose
:git log
:The text was updated successfully, but these errors were encountered: