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

rustdoc: allow full set of compiler options to be specified #43031

Open
jsgf opened this issue Jul 3, 2017 · 3 comments
Open

rustdoc: allow full set of compiler options to be specified #43031

jsgf opened this issue Jul 3, 2017 · 3 comments
Labels
A-doctests Area: Documentation tests, run by rustdoc C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jsgf
Copy link
Contributor

jsgf commented Jul 3, 2017

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)

@steveklabnik steveklabnik added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. labels Jul 5, 2017
@Mark-Simulacrum Mark-Simulacrum added the C-feature-request Category: A feature request, i.e: not implemented / a PR. label Jul 28, 2017
@Hello71
Copy link

Hello71 commented Apr 17, 2018

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.

@QuietMisdreavus
Copy link
Member

Update: #49956 ported the -C option. That's still nowhere near the full spread of rustc flags, but it's the one mentioned in the issue description.

@steveklabnik
Copy link
Member

Triage: I don't think there's been any movement on this issue.

tmiasko added a commit to tmiasko/rust that referenced this issue Oct 11, 2019
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.
Centril added a commit to Centril/rust that referenced this issue Oct 20, 2019
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.
sharksforarms added a commit to sharksforarms/grcov that referenced this issue May 28, 2020
- RUSTDOCFLAGS is used to pass arguments to doc tests

Tracking issue: rust-lang/rust#43031
sharksforarms added a commit to sharksforarms/grcov that referenced this issue May 28, 2020
- RUSTDOCFLAGS is used to pass arguments to doc tests

Tracking issue: rust-lang/rust#43031
svartalf pushed a commit to actions-rs/grcov that referenced this issue Jun 4, 2020
- RUSTDOCFLAGS is used to pass arguments to doc tests

Tracking issue: rust-lang/rust#43031
@ehuss ehuss removed the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 18, 2022
@lolbinarycat lolbinarycat added the A-doctests Area: Documentation tests, run by rustdoc label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc C-feature-request Category: A feature request, i.e: not implemented / a PR. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
Status: No status
Development

No branches or pull requests

7 participants