]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: [E0753] Use of inner doc comment in invalid context
authorMuhammad Mahad <mahadtxt@gmail.com>
Thu, 17 Aug 2023 05:13:00 +0000 (10:13 +0500)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 18:00:31 +0000 (19:00 +0100)
gcc/rust/ChangeLog:

* parse/rust-parse-impl.h (Parser::parse_outer_attribute):
Added errorcode & updated error function.

gcc/testsuite/ChangeLog:

* rust/compile/bad_inner_doc.rs:
Updated comment to pass testcase.

Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>
gcc/rust/parse/rust-parse-impl.h
gcc/testsuite/rust/compile/bad_inner_doc.rs

index d8d82b3639131cdd3a702422acd7779067be8e86..ca58d5e571a32679dcf214388507b1b4e80c66df 100644 (file)
@@ -1218,8 +1218,9 @@ Parser<ManagedTokenSource>::parse_outer_attribute ()
   if (lexer.peek_token ()->get_id () == INNER_DOC_COMMENT)
     {
       Error error (
-       lexer.peek_token ()->get_locus (),
-       "inner doc (%<//!%> or %</*!%>) only allowed at start of item "
+       lexer.peek_token ()->get_locus (), ErrorCode::E0753,
+       "expected outer doc comment, inner doc (%<//!%> or %</*!%>) only "
+       "allowed at start of item "
        "and before any outer attribute or doc (%<#[%>, %<///%> or %</**%>)");
       add_error (std::move (error));
       lexer.skip_token ();
index cfd166ce3ec9d244892bdd6632bd2288e3b56404..96f3b4b6ed2ae00ae9b24ded9c7acfb94da64275 100644 (file)
@@ -2,13 +2,13 @@ pub fn main ()
 {
   //! inner doc allowed
   let _x = 42;
-  // { dg-error "inner doc" "" { target *-*-* } .+1 }
+  // { dg-error "expected outer doc comment, inner doc" "" { target *-*-* } .+1 }
   //! inner doc disallowed
   mod module
   {
     /*! inner doc allowed */
     /// outer doc allowed
-    // { dg-error "inner doc" "" { target *-*-* } .+1 }
+    // { dg-error "expected outer doc comment, inner doc" "" { target *-*-* } .+1 }
     /*! but inner doc not here */
     mod x { }
   }