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

Deprecated warnings in cargo output for rustc-serialize feature #174

Conversation

quodlibetor
Copy link
Contributor

Unfortunately due to rust-lang/rust#39935 placing the annotation on the impls
of Encodable/Decodable for the various items have no effect whatsoever, so
we need to place it on some type that chrono actually uses internally. The only
type that I can find that only exists for rustc-serialize only is the
TsSeconds struct.

So, marking TsSeconds deprecated causes Chrono's internal uses of TsSeconds
to emit deprecation warnings, both in our builds and for packages that specify
Chrono as a dependency with the rustc-serialize feature active. This means
that the current commit will cause a warning: use of deprecated item: RustcSerialize will be removed before chrono 1.0, use Serde instead to appear
in cargo build output.

Unfortunately I don't think that it's possible for downstream crates to disable
the warning the warning in any way other than actually switching to Serde or
using an older chrono. That's the reason for all the #[allow(deprecated)]
through the code, it means that the warning appears almost exactly once,
instead of dozens of times.

@quodlibetor quodlibetor force-pushed the deprecated-warnings-for-rustc_serialize branch 2 times, most recently from 8484038 to 94c1808 Compare March 28, 2018 02:26
Unfortunately due to rust-lang/rust#39935 placing the annotation on the `impl`s
of `Encodable`/`Decodable` for the various items have no effect whatsoever, so
we need to place it on some type that chrono actually uses internally. The only
*type* that I can find that only exists for rustc-serialize only is the
 `TsSeconds` struct.

So, marking TsSeconds deprecated causes Chrono's internal uses of `TsSeconds`
to emit deprecation warnings, both in our builds and for packages that specify
Chrono as a dependency with the `rustc-serialize` feature active. This means
that the current commit will cause a `warning: use of deprecated item:
RustcSerialize will be removed before chrono 1.0, use Serde instead` to appear
in `cargo build` output.

Unfortunately I don't think that it's possible for downstream crates to disable
the warning the warning in any way other than actually switching to Serde or
using an older chrono. That's the reason for all the `#[allow(deprecated)]`
through the code, it means that the warning appears almost exactly once,
instead of dozens of times.
@quodlibetor quodlibetor self-assigned this Apr 1, 2018
@quodlibetor quodlibetor force-pushed the deprecated-warnings-for-rustc_serialize branch from 94c1808 to 39ca2e6 Compare April 1, 2018 23:57
@quodlibetor quodlibetor merged commit a060684 into chronotope:master Apr 3, 2018
@quodlibetor quodlibetor deleted the deprecated-warnings-for-rustc_serialize branch April 3, 2018 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant