Add ui test for unsupported doc(attribute = "...") case for attributes with namespace

This commit is contained in:
Guillaume Gomez
2025-08-28 16:27:54 +02:00
parent 10bd61dcf2
commit f3c023433f
3 changed files with 18 additions and 0 deletions

View File

@@ -879,6 +879,7 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
s.is_reserved(|| edition::LATEST_STABLE_EDITION) || s.is_weak() || s == sym::SelfTy
}
// FIXME: This should support attributes with namespace like `diagnostic::do_not_recommend`.
fn is_builtin_attr(s: Symbol) -> bool {
rustc_feature::BUILTIN_ATTRIBUTE_MAP.contains_key(&s)
}

View File

@@ -0,0 +1,7 @@
// This is currently not supported but should be!
#![feature(rustdoc_internals)]
#[doc(attribute = "diagnostic::do_not_recommend")] //~ ERROR
/// bla
mod yup {}

View File

@@ -0,0 +1,10 @@
error: nonexistent builtin attribute `diagnostic::do_not_recommend` used in `#[doc(attribute = "...")]`
--> $DIR/doc-attribute-unsupported.rs:5:19
|
LL | #[doc(attribute = "diagnostic::do_not_recommend")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: only existing builtin attributes are allowed in core/std
error: aborting due to 1 previous error