rust-lang / rust-lang/rust

We should only set `deny(warnings)` in doctests when `deny-warnings = false`

Open
#142,151 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-enhancement T-bootstrap T-libs
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

deny(warnings) is usually not something we want to hard-code in the sources, it should only be set on CI -- otherwise lints can introduce frustrating roadblocks when they don't have to. I encountered this as part of this recent problem:

https://github.com/rust-lang/rust/blob/19e02c82119cf25f92fe6325d7caa483fa84b4bb/library/core/src/lib.rs#L50

Would it be possible to set this flag inside ./x instead, and make it depend on the deny-warnings setting in bootstrap.toml? That would make it more consistent with the main crate builds as well. It seems this could be achieved by setting RUSTDOCFLAGS="--doctest-build-arg -D warnings -Zunstable-options".

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the deny(warnings) setting in library/core/src/lib.rs, then trace how doctests are built through bootstrap.toml and ./x. Check how deny-warnings affects main crate builds and whether RUSTDOCFLAGS="--doctest-build-arg -D warnings -Zunstable-options" can be applied consistently. Done means doctests receive the flag only when configured, without hard-coding it in sources.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.