You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Rollup merge of rust-lang#82651 - jyn514:rustdoc-warnings, r=GuillaumeGomez
Cleanup rustdoc warnings
## Clean up error reporting for deprecated passes
Using `error!` here goes all the way back to the original commit, rust-lang#8540. I don't see any reason to use logging; rustdoc should use diagnostics wherever possible. See rust-lang#81932 (comment) for further context.
- Use spans for deprecated attributes
- Use a proper diagnostic for unknown passes, instead of error logging
- Add tests for unknown passes
- Improve some wording in diagnostics
## Report that `doc(plugins)` doesn't work using diagnostics instead of `eprintln!`
This also adds a test for the output.
This was added in rust-lang#52194. I don't see any particular reason not to use diagnostics here, I think it was just missed in rust-lang#50541.
diag.struct_span_warn(sp,&format!("the `#![doc({})]` attribute is deprecated", name));
496
+
msg.note(
497
497
"see issue #44136 <https://github.com/rust-lang/rust/issues/44136> \
498
498
for more information",
499
499
);
500
500
501
501
if name == "no_default_passes"{
502
502
msg.help("you may want to use `#![doc(document_private_items)]`");
503
+
}elseif name.starts_with("plugins"){
504
+
msg.warn("`#![doc(plugins = \"...\")]` no longer functions; see CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>");
503
505
}
504
506
505
507
msg.emit();
506
508
}
507
509
510
+
let parse_pass = |name:&str,sp:Option<Span>| {
511
+
ifletSome(pass) = passes::find_pass(name){
512
+
Some(ConditionalPass::always(pass))
513
+
}else{
514
+
let msg = &format!("ignoring unknown pass `{}`", name);
515
+
letmut warning = ifletSome(sp) = sp {
516
+
tcx.sess.struct_span_warn(sp, msg)
517
+
}else{
518
+
tcx.sess.struct_warn(msg)
519
+
};
520
+
if name == "collapse-docs"{
521
+
warning.note("the `collapse-docs` pass was removed in #80261 <https://github.com/rust-lang/rust/pull/80261>");
0 commit comments