public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Arthur Cohen <cohenarthur@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-7924] gccrs: [E0753] Use of inner doc comment in invalid context
Date: Tue, 16 Jan 2024 18:07:45 +0000 (GMT)	[thread overview]
Message-ID: <20240116180746.07DF438582A3@sourceware.org> (raw)

https://gcc.gnu.org/g:c0b25c9a3b25510d47cdf6b37afaf208c00a1c0d

commit r14-7924-gc0b25c9a3b25510d47cdf6b37afaf208c00a1c0d
Author: Muhammad Mahad <mahadtxt@gmail.com>
Date:   Thu Aug 17 10:13:00 2023 +0500

    gccrs: [E0753] Use of inner doc comment in invalid context
    
    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>

Diff:
---
 gcc/rust/parse/rust-parse-impl.h            | 5 +++--
 gcc/testsuite/rust/compile/bad_inner_doc.rs | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index d8d82b36391..ca58d5e571a 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -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 ();
diff --git a/gcc/testsuite/rust/compile/bad_inner_doc.rs b/gcc/testsuite/rust/compile/bad_inner_doc.rs
index cfd166ce3ec..96f3b4b6ed2 100644
--- a/gcc/testsuite/rust/compile/bad_inner_doc.rs
+++ b/gcc/testsuite/rust/compile/bad_inner_doc.rs
@@ -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 { }
   }

                 reply	other threads:[~2024-01-16 18:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240116180746.07DF438582A3@sourceware.org \
    --to=cohenarthur@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).