-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Doctests now run on non-exported macro_rules!, but can't actually test the macro #97030
Copy link
Copy link
Open
Labels
A-doctestsArea: Documentation tests, run by rustdocArea: Documentation tests, run by rustdocT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant 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.Performance or correctness regression from one stable version to another.
Milestone
Metadata
Metadata
Assignees
Labels
A-doctestsArea: Documentation tests, run by rustdocArea: Documentation tests, run by rustdocT-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.Relevant 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.Performance or correctness regression from one stable version to another.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
No status
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-doctestbuild 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.