File tree Expand file tree Collapse file tree 5 files changed +73
-0
lines changed
compiler/rustc_passes/src Expand file tree Collapse file tree 5 files changed +73
-0
lines changed Original file line number Diff line number Diff line change @@ -544,6 +544,41 @@ impl CheckAttrVisitor<'tcx> {
544544 {
545545 return false ;
546546 }
547+ } else if let Some ( i_meta) = meta. meta_item ( ) {
548+ if ![
549+ sym:: cfg,
550+ sym:: hidden,
551+ sym:: html_favicon_url,
552+ sym:: html_logo_url,
553+ sym:: html_no_source,
554+ sym:: html_playground_url,
555+ sym:: html_root_url,
556+ sym:: include,
557+ sym:: inline,
558+ sym:: issue_tracker_base_url,
559+ sym:: masked,
560+ sym:: no_default_passes, // deprecated
561+ sym:: no_inline,
562+ sym:: passes, // deprecated
563+ sym:: primitive,
564+ sym:: spotlight,
565+ sym:: test,
566+ ]
567+ . iter ( )
568+ . any ( |m| i_meta. has_name ( * m) )
569+ {
570+ self . tcx
571+ . sess
572+ . struct_span_err (
573+ meta. span ( ) ,
574+ & format ! (
575+ "unknown `doc` attribute `{}`" ,
576+ i_meta. name_or_empty( ) ,
577+ ) ,
578+ )
579+ . emit ( ) ;
580+ return false ;
581+ }
547582 }
548583 }
549584 }
Original file line number Diff line number Diff line change 1+ #![ crate_type = "lib" ]
2+ #![ doc( as_ptr) ] //~ ERROR
3+
4+ #[ doc( as_ptr) ] //~ ERROR
5+ pub fn foo ( ) { }
Original file line number Diff line number Diff line change 1+ error: unknown `doc` attribute `as_ptr`
2+ --> $DIR/doc-attr.rs:4:7
3+ |
4+ LL | #[doc(as_ptr)]
5+ | ^^^^^^
6+
7+ error: unknown `doc` attribute `as_ptr`
8+ --> $DIR/doc-attr.rs:2:8
9+ |
10+ LL | #![doc(as_ptr)]
11+ | ^^^^^^
12+
13+ error: aborting due to 2 previous errors
14+
Original file line number Diff line number Diff line change 1+ #![ crate_type = "lib" ]
2+ #![ doc( as_ptr) ] //~ ERROR
3+
4+ #[ doc( as_ptr) ] //~ ERROR
5+ pub fn foo ( ) { }
Original file line number Diff line number Diff line change 1+ error: unknown `doc` attribute `as_ptr`
2+ --> $DIR/doc-attr.rs:4:7
3+ |
4+ LL | #[doc(as_ptr)]
5+ | ^^^^^^
6+
7+ error: unknown `doc` attribute `as_ptr`
8+ --> $DIR/doc-attr.rs:2:8
9+ |
10+ LL | #![doc(as_ptr)]
11+ | ^^^^^^
12+
13+ error: aborting due to 2 previous errors
14+
You can’t perform that action at this time.
0 commit comments