Skip to content

RUSTFLAGS / RUSTDOCFLAGS are not being passed to rustdoc when target-applies-to-host nightly feature is used #10744

Closed
@jplatte

Description

@jplatte

Problem

For two project I maintain, the docs generated by CI no longer includes an index file despite the appropriate nightly flags being used. I initially opened rust-lang/rust#97881 for this, but now found out that it's actually a bug in Cargo that doesn't pass RUSTDOCFLAGS on to rustdoc in the affected workspaces (though it doesn't seem to affect all workspaces).

Steps

  • Clone https://github.com/ruma/ruma/tree/rustdoc-bug
  • With the environment variable RUSTDOCFLAGS set to --cfg compile_error, run cargo +nightly doc -p ruma
  • Observe no errors despite this in crates/ruma/src/lib.rs
    #[cfg(compile_error)]
    compile_error!("!!!");

Notes

  • Reproducible with a recent version of cargo (1.63.0-nightly (85e457e15 2022-06-07))
  • Reproducible with cargo 1.61.0-nightly (3d6970d 2022-02-28) (rustup nightly-2022-03-02)
  • Not reproducible with cargo 1.61.0-nightly (d6cdde5 2022-02-22) (rustup nightly-2022-03-01).

Version

cargo 1.63.0-nightly (85e457e15 2022-06-07)
release: 1.63.0-nightly
commit-hash: 85e457e158db216a2938d51bc3b617a5a7fe6015
commit-date: 2022-06-07
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1n)
os: Arch Linux Rolling Release [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions