diff options
| author | Joshua Nelson <jyn514@gmail.com> | 2021-02-28 22:51:35 -0500 |
|---|---|---|
| committer | Joshua Nelson <jyn514@gmail.com> | 2021-03-02 11:38:07 -0500 |
| commit | d5c300b1f2e9a6f7f05b2fa51ca2b4d011d289f4 (patch) | |
| tree | c0c371de2ebc85a92b6f6f4ef37cef9e40ff6129 | |
| parent | 44c2794976986677c4f5524f63562d02e0e53d57 (diff) | |
| download | rust-d5c300b1f2e9a6f7f05b2fa51ca2b4d011d289f4.tar.gz rust-d5c300b1f2e9a6f7f05b2fa51ca2b4d011d289f4.zip | |
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.
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 3 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 6 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/deprecated-attrs.rs | 4 | ||||
| -rw-r--r-- | src/test/rustdoc-ui/deprecated-attrs.stderr | 11 |
4 files changed, 18 insertions, 6 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index afd1642bbd5..d0ab0d657d9 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -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, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index a935bd6b456..19821c3ccef 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -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, diff --git a/src/test/rustdoc-ui/deprecated-attrs.rs b/src/test/rustdoc-ui/deprecated-attrs.rs index a0439acc024..5febc5eb9cd 100644 --- a/src/test/rustdoc-ui/deprecated-attrs.rs +++ b/src/test/rustdoc-ui/deprecated-attrs.rs @@ -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 diff --git a/src/test/rustdoc-ui/deprecated-attrs.stderr b/src/test/rustdoc-ui/deprecated-attrs.stderr index 42a229abf58..b855cedf522 100644 --- a/src/test/rustdoc-ui/deprecated-attrs.stderr +++ b/src/test/rustdoc-ui/deprecated-attrs.stderr @@ -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 |
