Skip to content

Commit f3c0234

Browse files
Add ui test for unsupported doc(attribute = "...") case for attributes with namespace
1 parent 10bd61d commit f3c0234

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This is currently not supported but should be!
2+
3+
#![feature(rustdoc_internals)]
4+
5+
#[doc(attribute = "diagnostic::do_not_recommend")] //~ ERROR
6+
/// bla
7+
mod yup {}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: nonexistent builtin attribute `diagnostic::do_not_recommend` used in `#[doc(attribute = "...")]`
2+
--> $DIR/doc-attribute-unsupported.rs:5:19
3+
|
4+
LL | #[doc(attribute = "diagnostic::do_not_recommend")]
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: only existing builtin attributes are allowed in core/std
8+
9+
error: aborting due to 1 previous error
10+

0 commit comments

Comments
 (0)