File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -5940,6 +5940,14 @@ impl<'a> Parser<'a> {
59405940 self . expect ( & token:: OpenDelim ( token:: Brace ) ) ?;
59415941 let mut trait_items = vec ! [ ] ;
59425942 while !self . eat ( & token:: CloseDelim ( token:: Brace ) ) {
5943+ if let token:: DocComment ( _) = self . token {
5944+ if self . look_ahead ( 1 , |tok| tok == & token:: Token :: CloseDelim ( token:: Brace ) ) {
5945+ self . span_fatal_err ( self . span , Error :: UselessDocComment ) . emit ( ) ;
5946+ self . bump ( ) ;
5947+ continue ;
5948+ }
5949+ }
5950+
59435951 let mut at_end = false ;
59445952 match self . parse_trait_item ( & mut at_end) {
59455953 Ok ( item) => trait_items. push ( item) ,
@@ -7676,7 +7684,7 @@ impl<'a> Parser<'a> {
76767684 & mut self . token_cursor . stack [ prev] . last_token
76777685 } ;
76787686
7679- // Pull our the toekns that we've collected from the call to `f` above
7687+ // Pull our the tokens that we've collected from the call to `f` above
76807688 let mut collected_tokens = match * last_token {
76817689 LastToken :: Collecting ( ref mut v) => mem:: replace ( v, Vec :: new ( ) ) ,
76827690 LastToken :: Was ( _) => panic ! ( "our vector went away?" ) ,
Original file line number Diff line number Diff line change 1+ //! issue #56766
2+ //!
3+ //! invalid doc comment at the end of a trait declaration
4+
5+ trait Foo {
6+ ///
7+ fn foo ( & self ) ;
8+ /// I am not documenting anything
9+ //~^ ERROR: found a documentation comment that doesn't document anything [E0585]
10+ }
11+
12+ fn main ( ) {
13+
14+ }
Original file line number Diff line number Diff line change 1+ error[E0585]: found a documentation comment that doesn't document anything
2+ --> $DIR/trait-impl.rs:8:5
3+ |
4+ LL | /// I am not documenting anything
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+ |
7+ = help: doc comments must come before what they document, maybe a comment was intended with `//`?
8+
9+ error: aborting due to previous error
10+
11+ For more information about this error, try `rustc --explain E0585`.
You can’t perform that action at this time.
0 commit comments