Skip to content

Doctests now run on non-exported macro_rules!, but can't actually test the macro #97030

Description

@cuviper

Since #88038 was resolved with #96630, doctests now run on macro_rules! even if the macro is not exported.

This could be considered a breaking change -- it did break CI for rayon when this macro example for internal use suddenly became a real test and failed.

The problem is, I can't figure out how to make a working doctest for that, since it's not exported in the public API. What is the intended way to do this? And if there's not really a way to do it, then maybe this change should be reverted so there isn't any break.

I thought of #[cfg_attr(doctest, macro_export)], which does make even older Rust try to test it, but that still can't reach the macro because it's still using the non-doctest build of the crate.


PS: I ended up making unit tests for that rayon macro, which is probably better in that case, but that doesn't answer how non-exported macro tests should work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-doctestsArea: Documentation tests, run by rustdocT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions