From: Kushal Pal <kushalpal...@gmail.com>

gcc/rust/ChangeLog:

        * checks/errors/rust-ast-validation.cc (ASTValidation::visit):
        Enclose const in single quotes.

gcc/testsuite/ChangeLog:

        * rust/compile/const_trait_fn.rs:
        Enclose const in single quotes.

Signed-off-by: Kushal Pal <kushalpal...@gmail.com>
---
 gcc/rust/checks/errors/rust-ast-validation.cc | 2 +-
 gcc/testsuite/rust/compile/const_trait_fn.rs  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc 
b/gcc/rust/checks/errors/rust-ast-validation.cc
index 0ed5d060894..ccb071f74b0 100644
--- a/gcc/rust/checks/errors/rust-ast-validation.cc
+++ b/gcc/rust/checks/errors/rust-ast-validation.cc
@@ -149,7 +149,7 @@ ASTValidation::visit (AST::TraitFunctionDecl &decl)
                       "functions in traits cannot be declared %<async%>");
       if (qualifiers.is_const ())
        rust_error_at (decl.get_identifier ().get_locus (), ErrorCode::E0379,
-                      "functions in traits cannot be declared const");
+                      "functions in traits cannot be declared %<const%>");
     }
 }
 
diff --git a/gcc/testsuite/rust/compile/const_trait_fn.rs 
b/gcc/testsuite/rust/compile/const_trait_fn.rs
index cff2f5f096e..41bba3b5335 100644
--- a/gcc/testsuite/rust/compile/const_trait_fn.rs
+++ b/gcc/testsuite/rust/compile/const_trait_fn.rs
@@ -1,4 +1,4 @@
 trait Osterkz {
     const fn x();
-    // { dg-error "functions in traits cannot be declared const .E0379." "" { 
target *-*-* } .-1 }
+    // { dg-error "functions in traits cannot be declared .const." "" { target 
*-*-* } .-1 }
 }
-- 
2.42.1

Reply via email to