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

Can't ignore soft destabilization of rustc-serialize with #![allow(soft_unstable)] #123156

Closed
pitdicker opened this issue Mar 28, 2024 · 6 comments · Fixed by #123182
Closed

Can't ignore soft destabilization of rustc-serialize with #![allow(soft_unstable)] #123156

pitdicker opened this issue Mar 28, 2024 · 6 comments · Fixed by #123182
Assignees
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@pitdicker
Copy link
Contributor

pitdicker commented Mar 28, 2024

In chrono we have support for rustc-serialize behind a feature flag.

As a workaround for #116016 I added the line:

#![cfg_attr(feature = "rustc-serialize", allow(deprecated), allow(soft_unstable))]

It now gives a new error:

error[E0658]: use of unstable library feature 'libstd_sys_internals': used by the panic! macro
  --> src/weekday.rs:33:64
   |
33 | #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
   |                                                                ^^^^^^^^^^^^^^
   |
   = help: add `#![feature(libstd_sys_internals)]` to the crate attributes to enable
   = note: this compiler was built on 2024-03-27; consider upgrading it if it is out of date
   = note: this error originates in the derive macro `RustcDecodable` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0658]: use of unstable library feature 'libstd_sys_internals': used by the panic! macro
  --> src/month.rs:32:64
   |
32 | #[cfg_attr(feature = "rustc-serialize", derive(RustcEncodable, RustcDecodable))]
   |                                                                ^^^^^^^^^^^^^^
   |
   = help: add `#![feature(libstd_sys_internals)]` to the crate attributes to enable
   = note: this compiler was built on 2024-03-27; consider upgrading it if it is out of date
   = note: this error originates in the derive macro `RustcDecodable` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0658`.
error: could not compile `chrono` (lib) due to 2 previous errors; 4 warnings emitted

cc @jhpratt

@pitdicker pitdicker added C-bug Category: This is a bug. regression-untriaged Untriaged performance or correctness regression. labels Mar 28, 2024
@rustbot rustbot added I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 28, 2024
@pitdicker pitdicker changed the title Can't ignore soft destabilization of rustc-serialize with #![feature(libstd_sys_internals)] Can't ignore soft destabilization of rustc-serialize with #![allow(soft_unstable)] Mar 28, 2024
@pitdicker
Copy link
Contributor Author

The derived Decodable implementation for an enum is using ::std::rt::begin_panic. Manually implementing Decodable and using unreachable!() is a workaround.

@apiraino
Copy link
Contributor

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-critical

@rustbot rustbot added P-critical Critical priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Mar 28, 2024
@ehuss
Copy link
Contributor

ehuss commented Mar 28, 2024

cc @jhpratt

@jieyouxu jieyouxu added T-libs Relevant to the library team, which will review and decide on the PR/issue. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Mar 28, 2024
@jhpratt
Copy link
Member

jhpratt commented Mar 28, 2024

I'm actually not sure this is a T-libs issue. I suspect it's related to #[allow_internal_unstable], but I haven't had a chance to look into it yet.

@jhpratt jhpratt added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. and removed regression-untriaged Untriaged performance or correctness regression. labels Mar 28, 2024
@jhpratt
Copy link
Member

jhpratt commented Mar 29, 2024

I have confirmed this is an issue with the expansion of RustcDecodable on enums and aim to have a PR up tonight. As RustcEncodable is a built-in macro, it is technically in T-compiler land, I believe.

@rustbot claim

@jhpratt
Copy link
Member

jhpratt commented Mar 29, 2024

PR is up, including a regression test: #123182

@jhpratt jhpratt added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Mar 29, 2024
@bors bors closed this as completed in e41d7e7 Apr 3, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Apr 3, 2024
Rollup merge of rust-lang#123182 - jhpratt:fix-decodable-derive, r=davidtwco

Avoid expanding to unstable internal method

Fixes rust-lang#123156

Rather than expanding to `std::rt::begin_panic`, the expansion is now to `unreachable!()`. The resulting behavior is identical. A test that previously triggered the same error as rust-lang#123156 has been added to ensure it does not regress.

r? compiler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) C-bug Category: This is a bug. P-critical Critical priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants