]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: Do not dump the AST if the parser emit errors
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Tue, 26 Aug 2025 10:55:02 +0000 (12:55 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Thu, 30 Oct 2025 19:58:49 +0000 (20:58 +0100)
gcc/rust/ChangeLog:

* rust-session-manager.cc (Session::compile_crate): Move the AST dump
after parser error check.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/rust-session-manager.cc

index 386aa65b966e7264ec63196bfca1961859db8739..e99fd6b8c0ce71ef7003e192ccd52f7928063f03 100644 (file)
@@ -548,10 +548,6 @@ Session::compile_crate (const char *filename)
   handle_crate_name (filename, *ast_crate.get ());
 
   // dump options except lexer dump
-  if (options.dump_option_enabled (CompileOptions::AST_DUMP_PRETTY))
-    {
-      dump_ast_pretty (*ast_crate.get ());
-    }
   if (options.dump_option_enabled (CompileOptions::TARGET_OPTION_DUMP))
     {
       options.target_data.dump_target_options ();
@@ -560,6 +556,11 @@ Session::compile_crate (const char *filename)
   if (saw_errors ())
     return;
 
+  if (options.dump_option_enabled (CompileOptions::AST_DUMP_PRETTY))
+    {
+      dump_ast_pretty (*ast_crate.get ());
+    }
+
   // setup the mappings for this AST
   CrateNum current_crate = mappings.get_current_crate ();
   AST::Crate &parsed_crate