Skip to content

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

Description

@jsgf

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)

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.
    on Jul 5, 2017
  2. Hello71 commented on Apr 17, 2018

    @Hello71

    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.

  3. QuietMisdreavus commented on May 31, 2018

    @QuietMisdreavus
    Contributor

    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.

  4. steveklabnik commented on Sep 13, 2019

    @steveklabnik
    Contributor

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

  5. added a commit that references this issue on Oct 20, 2019
  6. removed
    T-dev-toolsRelevant to the dev-tools subteam, which will review and decide on the PR/issue.
    on Jan 18, 2022
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 rustdocC-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions