about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-03 21:35:32 +0000
committerbors <bors@rust-lang.org>2021-03-03 21:35:32 +0000
commit1c77a1fa3ca574f2a40056f64d498db8efe0d8a8 (patch)
tree0127748de124ff97776fb5691502a305fc736490 /compiler
parent476acbf1e9965b5e95c90f0d7d658709812b7003 (diff)
parent4b2e4e69dfbf75222ae547659e999cee05833de9 (diff)
Auto merge of #82702 - jyn514:downgrade-err, r=Manishearth
Change error about unknown attributes to a warning

Hard errors should go through a future-compatibility phase first, especially since these attributes only have no effect and don't actively cause bugs.

Follow-up to https://github.com/rust-lang/rust/pull/82662. Fixes ecosystem breakage like https://github.com/rust-lang/rust-clippy/issues/6832.

r? `@GuillaumeGomez`
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index afd1642bbd5..39245ea77e5 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -567,16 +567,23 @@ impl CheckAttrVisitor<'tcx> {
                         .iter()
                         .any(|m| i_meta.has_name(*m))
                         {
-                            self.tcx
-                                .sess
-                                .struct_span_err(
-                                    meta.span(),
-                                    &format!(
+                            self.tcx.struct_span_lint_hir(
+                                UNUSED_ATTRIBUTES,
+                                hir_id,
+                                i_meta.span,
+                                |lint| {
+                                    lint.build(&format!(
                                         "unknown `doc` attribute `{}`",
-                                        i_meta.name_or_empty(),
-                                    ),
-                                )
-                                .emit();
+                                        i_meta.name_or_empty()
+                                    ))
+                                    .warn(
+                                        "this was previously accepted by the compiler but is \
+                                        being phased out; it will become a hard error in \
+                                        a future release!",
+                                    )
+                                    .emit();
+                                },
+                            );
                             return false;
                         }
                     }