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

Support crate_features and proc macros in doctests #1782

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

bsilver8192
Copy link
Contributor

Previously setting features for the doctests themselves wasn't supported at all, and attempting to use a proc macro would fail. I needed both of these together to write a test.

This is the last of my changes to get rust_doc_test working for all of my crates at work.

Previously setting features for the doctests themselves wasn't
supported at all, and attempting to use a proc macro would fail.
I needed both of these together to write a test.
@bsilver8192
Copy link
Contributor Author

The tests fail on Windows, I think it's because rustdoc_test_writer's escaping doesn't work. Unfortunately I don't know enough Windows shell scripting to fix it. What should I do? I see these options:

  • Somebody else fixes the Windows code before merging, either in this PR or a separate one
  • File a bug and disable the problematic test rules on Windows
  • File a bug, use select to avoid setting the cfg for Windows, and comment out the problematic tests
  • File a bug, use select to avoid setting the cfg for Windows, and cfg(not(target_os = "windows")) t
  • Split out the crate_features support for a separate PR, and fork rustdoc_lib.rs into proc_macro and non-proc_macro variants without any cfg

@bsilver8192
Copy link
Contributor Author

@UebelAndre I need help on this. I added a test for the escaping (and found+fixed a bug on Linux), but I have no idea how to do this on Windows. Nothing I read online seems to work the way it's claimed, but it's also hard to confirm what's happening without a local machine to experiment interactively. Seems like there's 2 or 3 nested layers of parsing that all have to be satisfied without escape characters that they strip off, and it may be impossible to do robustly.

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.

1 participant