-
Notifications
You must be signed in to change notification settings - Fork 13k
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
rustdoc: allow full set of compiler options to be specified #43031
Comments
Over at Tor, we want to test our Rust↔C FFI. For example, we want to check if our FFI leaks memory or passes dangling Rust pointers to C. We'd like to write those tests in Rust though, not C, and I think we should utilize as much standard Rust as possible, including doctests. So, if we want full test coverage, we need a way to enable sanitizers in rustdoc. I asked @steveklabnik on IRC and he said that this would probably be the best way to go about that. I'd like to do this myself, but I think the exact design will require solid knowledge of rustc internals, and so it would be more work for someone to explain that to me. I'm hoping that it's not too much work for someone in-the-know to implement this. If it helps, nightly-only options are fine for us. This would probably be really useful for all Rust projects that call into C code, not just Tor. |
Update: #49956 ported the |
Triage: I don't think there's been any movement on this issue. |
Currently rustdoc does not forward `-Z` options to rustc when building test executables. This makes impossible to use rustdoc to run test samples when crate under test is instrumented with one of sanitizers `-Zsanitizer=...`, since the final linking step will not include sanitizer runtime library. Forward `-Z` options to rustc to solve the issue. Helps with rust-lang#43031.
rustdoc: forward -Z options to rustc Currently rustdoc does not forward `-Z` options to rustc when building test executables. This makes impossible to use rustdoc to run test samples when crate under test is instrumented with one of sanitizers `-Zsanitizer=...`, since the final linking step will not include sanitizer runtime library. Forward `-Z` options to rustc to solve the issue. Helps with rust-lang#43031.
- RUSTDOCFLAGS is used to pass arguments to doc tests Tracking issue: rust-lang/rust#43031
- RUSTDOCFLAGS is used to pass arguments to doc tests Tracking issue: rust-lang/rust#43031
- RUSTDOCFLAGS is used to pass arguments to doc tests Tracking issue: rust-lang/rust#43031
rustdoc
doesn't accept the full set of compiler options (in particular-C
), so it isn't possible to build doctests in the same way as crates, binaries and normal unit tests. The ideal would be to just allow the test source to be extracted (#43029), so that building the doctest is identical to other code.Failing that, some systematic way of converting a rustc compiler command line to a rustdoc one for building doctests would be OK.
(Filed separately, the ability to just build a test without running it: #43030)
The text was updated successfully, but these errors were encountered: