about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-03-02 09:42:32 -0500
committerJoshua Nelson <jyn514@gmail.com>2021-03-03 10:04:36 -0500
commit4b2e4e69dfbf75222ae547659e999cee05833de9 (patch)
tree39b9f477bae0969e64c5f9719cfb5616f7ba1875 /compiler
parentedeee915b1c52f97411e57ef6b1a8bd46548a37a (diff)
downloadrust-4b2e4e69dfbf75222ae547659e999cee05833de9.tar.gz
rust-4b2e4e69dfbf75222ae547659e999cee05833de9.zip
Change error about unknown doc attributes to a warning
This prevents breakage across the ecosystem, since the error was just
introduced recently without first having a warning period.
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;
                         }
                     }