diff options
author | Muhammad Mahad <mahadtxt@gmail.com> | 2023-08-17 10:13:00 +0500 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2024-01-16 19:00:31 +0100 |
commit | c0b25c9a3b25510d47cdf6b37afaf208c00a1c0d (patch) | |
tree | 4cfc08537d7d11707425b71db3d69401683499bd /gcc | |
parent | 4ad44eae61457754cb0249bb6df24cc33f684163 (diff) | |
download | gcc-c0b25c9a3b25510d47cdf6b37afaf208c00a1c0d.zip gcc-c0b25c9a3b25510d47cdf6b37afaf208c00a1c0d.tar.gz gcc-c0b25c9a3b25510d47cdf6b37afaf208c00a1c0d.tar.bz2 |
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>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 5 | ||||
-rw-r--r-- | 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 d8d82b3..ca58d5e 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 cfd166c..96f3b4b 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 { } } |