File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -6630,6 +6630,22 @@ impl<'a> Parser<'a> {
6630
6630
self . expect ( & token:: OpenDelim ( token:: Brace ) ) ?;
6631
6631
let mut trait_items = vec ! [ ] ;
6632
6632
while !self . eat ( & token:: CloseDelim ( token:: Brace ) ) {
6633
+ if let token:: DocComment ( _) = self . token {
6634
+ if self . look_ahead ( 1 ,
6635
+ |tok| tok == & token:: Token :: CloseDelim ( token:: Brace ) ) {
6636
+ let mut err = self . diagnostic ( ) . struct_span_err_with_code (
6637
+ self . span ,
6638
+ "found a documentation comment that doesn't document anything" ,
6639
+ DiagnosticId :: Error ( "E0584" . into ( ) ) ,
6640
+ ) ;
6641
+ err. help ( "doc comments must come before what they document, maybe a \
6642
+ comment was intended with `//`?",
6643
+ ) ;
6644
+ err. emit ( ) ;
6645
+ self . bump ( ) ;
6646
+ continue ;
6647
+ }
6648
+ }
6633
6649
let mut at_end = false ;
6634
6650
match self . parse_trait_item ( & mut at_end) {
6635
6651
Ok ( item) => trait_items. push ( item) ,
You can’t perform that action at this time.
0 commit comments