[gcc r14-7872] gccrs: [E0572] return is outside of function context

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 18:05:52 GMT 2024


https://gcc.gnu.org/g:47576fa5a866ad0d7ff0112e7d4a9f3dd764f7cc

commit r14-7872-g47576fa5a866ad0d7ff0112e7d4a9f3dd764f7cc
Author: Muhammad Mahad <mahadtxt@gmail.com>
Date:   Mon Jul 31 15:21:58 2023 +0500

    gccrs: [E0572] return is outside of function context
    
    gcc/rust/ChangeLog:
    
            * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit):
            called error function.
    
    Signed-off-by: Muhammad Mahad <mahadtxt@gmail.com>

Diff:
---
 gcc/rust/typecheck/rust-hir-type-check-expr.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.cc b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
index 74c4217e578..c7b124864c9 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.cc
@@ -152,7 +152,7 @@ TypeCheckExpr::visit (HIR::ReturnExpr &expr)
 {
   if (!context->have_function_context ())
     {
-      rust_error_at (expr.get_locus (),
+      rust_error_at (expr.get_locus (), ErrorCode::E0572,
 		     "return statement outside of function body");
       infered = new TyTy::ErrorType (expr.get_mappings ().get_hirid ());
       return;


More information about the Gcc-cvs mailing list