about summary refs log tree commit diff
path: root/compiler/rustc_passes/src
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2021-07-10 22:06:10 -0400
committerJoshua Nelson <jyn514@gmail.com>2021-08-16 05:41:16 +0000
commit03df65497e51c8a69e16ab8d4bc7a7d1b3d471dc (patch)
treed17b558ebfac6cca775ca5bac84b8b15d7671ec8 /compiler/rustc_passes/src
parent2bd17c1d43bba43412cc2f051323a279d6751e43 (diff)
downloadrust-03df65497e51c8a69e16ab8d4bc7a7d1b3d471dc.tar.gz
rust-03df65497e51c8a69e16ab8d4bc7a7d1b3d471dc.zip
feature gate doc(primitive)
Diffstat (limited to 'compiler/rustc_passes/src')
-rw-r--r--compiler/rustc_passes/src/check_attr.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs
index 7cca11f20bb..1bb6b899875 100644
--- a/compiler/rustc_passes/src/check_attr.rs
+++ b/compiler/rustc_passes/src/check_attr.rs
@@ -794,9 +794,24 @@ impl CheckAttrVisitor<'tcx> {
                         | sym::notable_trait
                         | sym::passes
                         | sym::plugins
-                        | sym::primitive
                         | sym::test => {}
 
+                        sym::primitive => {
+                            if !self.tcx.features().doc_primitive {
+                                self.tcx.struct_span_lint_hir(
+                                    INVALID_DOC_ATTRIBUTES,
+                                    hir_id,
+                                    i_meta.span,
+                                    |lint| {
+                                        let mut diag = lint.build(
+                                            "`doc(primitive)` should never have been stable",
+                                        );
+                                        diag.emit();
+                                    },
+                                );
+                            }
+                        }
+
                         _ => {
                             self.tcx.struct_span_lint_hir(
                                 INVALID_DOC_ATTRIBUTES,