[gcc r14-7480] gccrs: resolve: Add ResolveExpr::funny_error

Arthur Cohen cohenarthur@gcc.gnu.org
Tue Jan 16 17:37:32 GMT 2024


https://gcc.gnu.org/g:5138ddc3d652b66d3292c1543c34752e9ed78fc6

commit r14-7480-g5138ddc3d652b66d3292c1543c34752e9ed78fc6
Author: Sergey Bugaev <bugaevc@gmail.com>
Date:   Mon Apr 3 18:51:58 2023 +0300

    gccrs: resolve: Add ResolveExpr::funny_error
    
    ...and thread it through the constructors and the ResolveExpr::go ()
    method.
    
    This will be used for implementing the "break rust" Easter egg.
    
    gcc/rust/ChangeLog:
            * resolve/rust-ast-resolve-expr.h,
            resolve/rust-ast-resolve-expr.cc: Add ResolveExpr::funny_error
    
    Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>

Diff:
---
 gcc/rust/resolve/rust-ast-resolve-expr.cc | 10 ++++++----
 gcc/rust/resolve/rust-ast-resolve-expr.h  |  6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.cc b/gcc/rust/resolve/rust-ast-resolve-expr.cc
index 41ce9c9d0fe..e5ee9762134 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.cc
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.cc
@@ -29,9 +29,9 @@ namespace Resolver {
 
 void
 ResolveExpr::go (AST::Expr *expr, const CanonicalPath &prefix,
-		 const CanonicalPath &canonical_prefix)
+		 const CanonicalPath &canonical_prefix, bool funny_error)
 {
-  ResolveExpr resolver (prefix, canonical_prefix);
+  ResolveExpr resolver (prefix, canonical_prefix, funny_error);
   expr->accept_vis (resolver);
 }
 
@@ -674,8 +674,10 @@ ResolveExpr::resolve_closure_param (AST::ClosureParam &param,
 }
 
 ResolveExpr::ResolveExpr (const CanonicalPath &prefix,
-			  const CanonicalPath &canonical_prefix)
-  : ResolverBase (), prefix (prefix), canonical_prefix (canonical_prefix)
+			  const CanonicalPath &canonical_prefix,
+			  bool funny_error)
+  : ResolverBase (), prefix (prefix), canonical_prefix (canonical_prefix),
+    funny_error (funny_error)
 {}
 
 } // namespace Resolver
diff --git a/gcc/rust/resolve/rust-ast-resolve-expr.h b/gcc/rust/resolve/rust-ast-resolve-expr.h
index 896617cc7ff..86ae70ffbd8 100644
--- a/gcc/rust/resolve/rust-ast-resolve-expr.h
+++ b/gcc/rust/resolve/rust-ast-resolve-expr.h
@@ -31,7 +31,8 @@ class ResolveExpr : public ResolverBase
 
 public:
   static void go (AST::Expr *expr, const CanonicalPath &prefix,
-		  const CanonicalPath &canonical_prefix);
+		  const CanonicalPath &canonical_prefix,
+		  bool funny_error = false);
 
   void visit (AST::TupleIndexExpr &expr) override;
   void visit (AST::TupleExpr &expr) override;
@@ -84,10 +85,11 @@ protected:
 
 private:
   ResolveExpr (const CanonicalPath &prefix,
-	       const CanonicalPath &canonical_prefix);
+	       const CanonicalPath &canonical_prefix, bool funny_error);
 
   const CanonicalPath &prefix;
   const CanonicalPath &canonical_prefix;
+  bool funny_error;
 };
 
 } // namespace Resolver


More information about the Gcc-cvs mailing list