From 966400253b3c5df2ed96e443d64147244dc6f338 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 12 Feb 2020 15:48:08 +0100 Subject: [PATCH] Update to new diagnostic --- src/librustdoc/core.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 116bb70dcf62..4d2d81e48fc9 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -415,17 +415,20 @@ pub fn run_core(options: RustdocOptions) -> (clean::Crate, RenderInfo, RenderOpt if let Some(ref m) = krate.module { if let None | Some("") = m.doc_value() { - let mut diag = tcx.struct_lint_node( + let help = "The following guide may be of use:\n\ + https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\ + .html"; + tcx.struct_lint_node( rustc_lint::builtin::MISSING_CRATE_LEVEL_DOC, ctxt.as_local_hir_id(m.def_id).unwrap(), - "no documentation found for this crate's top-level module", + |lint| { + let mut diag = lint.build( + "no documentation found for this crate's top-level module", + ); + diag.help(help); + diag.emit(); + }, ); - diag.help( - "The following guide may be of use:\n\ - https://doc.rust-lang.org/nightly/rustdoc/how-to-write-documentation\ - .html", - ); - diag.emit(); } }