Report that doc(plugins) doesn't work using diagnostics instead of println!

This also adds a test for the output and fixes `rustc_attr` to properly
know that `plugins` is a valid attribute.
This commit is contained in:
Joshua Nelson 2021-02-28 22:51:35 -05:00
parent 44c2794976
commit d5c300b1f2
4 changed files with 18 additions and 6 deletions

View File

@ -559,7 +559,8 @@ impl CheckAttrVisitor<'tcx> {
sym::masked,
sym::no_default_passes, // deprecated
sym::no_inline,
sym::passes, // deprecated
sym::passes, // deprecated
sym::plugins, // removed, but rustdoc warns about it itself
sym::primitive,
sym::spotlight,
sym::test,

View File

@ -572,6 +572,8 @@ crate fn run_global_ctxt(
if name == "no_default_passes" {
msg.help("you may want to use `#![doc(document_private_items)]`");
} else if name.starts_with("plugins") {
msg.warn("`#![doc(plugins = \"...\")]` no longer functions; see CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>");
}
msg.emit();
@ -618,10 +620,6 @@ crate fn run_global_ctxt(
}
sym::plugins => {
report_deprecated_attr("plugins = \"...\"", diag, attr.span());
eprintln!(
"WARNING: `#![doc(plugins = \"...\")]` \
no longer functions; see CVE-2018-1000622"
);
continue;
}
_ => continue,

View File

@ -11,3 +11,7 @@
//~| NOTE see issue #44136
//~| WARNING ignoring unknown pass
//~| NOTE `collapse-docs` pass was removed
#![doc(plugins = "xxx")]
//~^ WARNING attribute is deprecated
//~| NOTE see issue #44136
//~| WARNING no longer functions; see CVE

View File

@ -29,5 +29,14 @@ LL | #![doc(passes = "collapse-docs unindent-comments")]
|
= note: the `collapse-docs` pass was removed in #80261 <https://github.com/rust-lang/rust/pull/80261>
warning: 4 warnings emitted
warning: the `#![doc(plugins = "...")]` attribute is deprecated
--> $DIR/deprecated-attrs.rs:14:8
|
LL | #![doc(plugins = "xxx")]
| ^^^^^^^^^^^^^^^
|
= note: see issue #44136 <https://github.com/rust-lang/rust/issues/44136> for more information
= warning: `#![doc(plugins = "...")]` no longer functions; see CVE-2018-1000622 <https://nvd.nist.gov/vuln/detail/CVE-2018-1000622>
warning: 5 warnings emitted