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 does not apply cfg(parallel_compiler) when bootstrapping #82301

Closed
cjgillot opened this issue Feb 19, 2021 · 3 comments · Fixed by #84777
Closed

Rustdoc does not apply cfg(parallel_compiler) when bootstrapping #82301

cjgillot opened this issue Feb 19, 2021 · 3 comments · Fixed by #84777
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@cjgillot
Copy link
Contributor

Found while testing #70951.

I tried this code:

In rustc_middle:

pub trait QueryEngine {
  #[cfg(parallel_compiler)]
  unsafe fn deadlock();
}

In downstream crate rustc_query_system:

impl QueryEngine for QueryCtxt {
  #[cfg(parallel_compiler)]
  unsafe fn deadlock() {}
}

I expected to see this happen: rustdoc run successfully.

Instead, this happened: rustdoc complains of missing impl-item deadlock.

My understanding is that ./x.py check compiles with parallel_compiler = true and
puts the trait with deadcode in its metadata.
Rustdoc tries to document ignoring parallel_compiler,
so the function deadcode is missing.

Meta

master at 8599bff

@cjgillot cjgillot added the C-bug Category: This is a bug. label Feb 19, 2021
@jyn514 jyn514 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 20, 2021
@jyn514
Copy link
Member

jyn514 commented May 1, 2021

My understanding is that cfg(parallel_compiler) applies to rustdoc itself just fine, the issue is that rustdoc ignores the cfg when documenting. Is that correct?

@jyn514
Copy link
Member

jyn514 commented May 1, 2021

@cjgillot I can't reproduce this. I ran the following locally:

git checkout b52769b804a12b7045ee1bce893a64045cdb974a  # current HEAD
git revert 9823c2cc700fea541bf2670fcee93af662b63022.
x.py doc compiler/rustc

and all the commands succeeded.

@jyn514
Copy link
Member

jyn514 commented May 1, 2021

Oh, I forgot to set parallel-compiler = true. Yes, with that I can reproduce.

Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue May 10, 2021
…ulacrum

Apply `--cfg parallel_compiler` when documenting

This also reverts commit 9823c2c working around the bug.

Fixes rust-lang#82301.
@bors bors closed this as completed in 5fc8987 May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants