Add -Z normalize-docs and enable it for compiler docs
This commit is contained in:
parent
e37f25aa3f
commit
95a6427d2c
5 changed files with 10 additions and 3 deletions
|
@ -996,6 +996,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||||
"run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
|
"run LLVM in non-parallel mode (while keeping codegen-units and ThinLTO)"),
|
||||||
no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
|
no_profiler_runtime: bool = (false, parse_no_flag, [TRACKED],
|
||||||
"prevent automatic injection of the profiler_builtins crate"),
|
"prevent automatic injection of the profiler_builtins crate"),
|
||||||
|
normalize_docs: bool = (false, parse_bool, [TRACKED],
|
||||||
|
"normalize associated items in rustdoc when generating documentation"),
|
||||||
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
|
osx_rpath_install_name: bool = (false, parse_bool, [TRACKED],
|
||||||
"pass `-install_name @rpath/...` to the macOS linker (default: no)"),
|
"pass `-install_name @rpath/...` to the macOS linker (default: no)"),
|
||||||
panic_abort_tests: bool = (false, parse_bool, [TRACKED],
|
panic_abort_tests: bool = (false, parse_bool, [TRACKED],
|
||||||
|
|
|
@ -730,6 +730,7 @@ impl<'a> Builder<'a> {
|
||||||
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
|
.env("CFG_RELEASE_CHANNEL", &self.config.channel)
|
||||||
.env("RUSTDOC_REAL", self.rustdoc(compiler))
|
.env("RUSTDOC_REAL", self.rustdoc(compiler))
|
||||||
.env("RUSTC_BOOTSTRAP", "1")
|
.env("RUSTC_BOOTSTRAP", "1")
|
||||||
|
.arg("-Znormalize_docs")
|
||||||
.arg("-Winvalid_codeblock_attributes");
|
.arg("-Winvalid_codeblock_attributes");
|
||||||
if self.config.deny_warnings {
|
if self.config.deny_warnings {
|
||||||
cmd.arg("-Dwarnings");
|
cmd.arg("-Dwarnings");
|
||||||
|
|
|
@ -527,6 +527,7 @@ impl Step for Rustc {
|
||||||
cargo.rustdocflag("--document-private-items");
|
cargo.rustdocflag("--document-private-items");
|
||||||
cargo.rustdocflag("--enable-index-page");
|
cargo.rustdocflag("--enable-index-page");
|
||||||
cargo.rustdocflag("-Zunstable-options");
|
cargo.rustdocflag("-Zunstable-options");
|
||||||
|
cargo.rustdocflag("-Znormalize-docs");
|
||||||
compile::rustc_cargo(builder, &mut cargo, target);
|
compile::rustc_cargo(builder, &mut cargo, target);
|
||||||
|
|
||||||
// Only include compiler crates, no dependencies of those, such as `libc`.
|
// Only include compiler crates, no dependencies of those, such as `libc`.
|
||||||
|
|
|
@ -1503,9 +1503,12 @@ impl Clean<Type> for hir::Ty<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `None` if the type could not be normalized
|
/// Returns `None` if the type could not be normalized
|
||||||
#[allow(unreachable_code, unused_variables)]
|
|
||||||
fn normalize(cx: &DocContext<'tcx>, ty: Ty<'_>) -> Option<Ty<'tcx>> {
|
fn normalize(cx: &DocContext<'tcx>, ty: Ty<'_>) -> Option<Ty<'tcx>> {
|
||||||
return None; // HACK: low-churn fix for #79459 while we wait for a trait normalization fix
|
// HACK: low-churn fix for #79459 while we wait for a trait normalization fix
|
||||||
|
if !cx.tcx.sess.opts.debugging_opts.normalize_docs {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
use crate::rustc_trait_selection::infer::TyCtxtInferExt;
|
use crate::rustc_trait_selection::infer::TyCtxtInferExt;
|
||||||
use crate::rustc_trait_selection::traits::query::normalize::AtExt;
|
use crate::rustc_trait_selection::traits::query::normalize::AtExt;
|
||||||
use rustc_middle::traits::ObligationCause;
|
use rustc_middle::traits::ObligationCause;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
// ignore-tidy-linelength
|
// ignore-tidy-linelength
|
||||||
// aux-build:normalize-assoc-item.rs
|
// aux-build:normalize-assoc-item.rs
|
||||||
// build-aux-docs
|
// build-aux-docs
|
||||||
// ignore-test
|
// compile-flags:-Znormalize-docs
|
||||||
|
|
||||||
pub trait Trait {
|
pub trait Trait {
|
||||||
type X;
|
type X;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue