Skip to content

Commit 65d329a

Browse files
Add ui test for unsupported doc(attribute = "...") case for attributes with namespace
1 parent 5f6a6bc commit 65d329a

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

compiler/rustc_passes/src/check_attr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
879879
s.is_reserved(|| edition::LATEST_STABLE_EDITION) || s.is_weak() || s == sym::SelfTy
880880
}
881881

882+
// FIXME: This should support attributes with namespace like `diagnostic::do_not_recommend`.
882883
fn is_builtin_attr(s: Symbol) -> bool {
883884
rustc_feature::BUILTIN_ATTRIBUTE_MAP.contains_key(&s)
884885
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// This is currently not supported but should be!
2+
3+
#[doc(attribute = "diagnostic::do_not_recommend")] //~ ERROR
4+
/// bla
5+
mod yup {}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0658]: `#[doc(attribute)]` is meant for internal use only
2+
--> $DIR/doc-attribute-unsupported.rs:3:1
3+
|
4+
LL | #[doc(attribute = "diagnostic::do_not_recommend")]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #90418 <https://github.com/rust-lang/rust/issues/90418> for more information
8+
= help: add `#![feature(rustdoc_internals)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)