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

regression: doctest no longer supports derive? #132204

Open
Mark-Simulacrum opened this issue Oct 26, 2024 · 4 comments
Open

regression: doctest no longer supports derive? #132204

Mark-Simulacrum opened this issue Oct 26, 2024 · 4 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@Mark-Simulacrum Mark-Simulacrum added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Oct 26, 2024
@Mark-Simulacrum Mark-Simulacrum added this to the 1.83.0 milestone Oct 26, 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 Oct 26, 2024
@Urgau
Copy link
Member

Urgau commented Oct 26, 2024

This is expected, the (kind-of new) warn-by-default non_local_definitions lint is rightfully triggered here, the derive should put it's things under an unnamed const. However the crate also use #![deny(warnings)] so it unfortunately breaks, nothing we can do about that.

The lint is already in the language section of relnotes.

Different issue, looks like an issue with the arguments passed to the doctest executable. Reminds me of #131095.

@Mark-Simulacrum
Copy link
Member Author

Is this serde's derive? Has that already been fixed on newer versions of serde?

@saethlin
Copy link
Member

Is this serde's derive? Has that already been fixed on newer versions of serde?

Yes and yes. The crate that's failing here is locked to serde 1.0.99 which was released in 2019, and it expands to this:

const _IMPL_DESERIALIZE_FOR_Point: () = {
    #[allow(unknown_lints)]
    #[allow(rust_2018_idioms)]
    extern crate serde as _serde;
    #[automatically_derived]
    impl<'de> _serde::Deserialize<'de> for Point {

Starting in serde 1.0.113 (released in 2020) the Derive macro expands to an unnamed const:

const _: () = {
    #[allow(rust_2018_idioms, clippy::useless_attribute)]
    extern crate serde as _serde;
    #[automatically_derived]
    impl<'de> _serde::Deserialize<'de> for Point {

Since the fix has been out for 4 years and has been a cargo update away the whole time, I don't think there's any action needed here.

@saethlin saethlin removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 27, 2024
@saethlin
Copy link
Member

If someone wants an MCVE:

#[derive(serde::Deserialize)]
struct Point {}
[package]
name = "scratch"
version = "0.1.0"
edition = "2021"

[dependencies]
serde = { version = "=1.0.200", features = ["derive"] }

@Mark-Simulacrum Mark-Simulacrum removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants