diff options
-rw-r--r-- | gcc/rust/rust-session-manager.cc | 5 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/syntax-only.rs | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 396f35f..96d94b2 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -542,6 +542,11 @@ Session::parse_file (const char *filename) rust_debug ("\033[0;31mSUCCESSFULLY PARSED CRATE \033[0m"); + // If -fsyntax-only was passed, we can just skip the remaining passes. + // Parsing errors are already emitted in `parse_crate()` + if (flag_syntax_only) + return; + // register plugins pipeline stage register_plugins (parsed_crate); rust_debug ("\033[0;31mSUCCESSFULLY REGISTERED PLUGINS \033[0m"); diff --git a/gcc/testsuite/rust/compile/syntax-only.rs b/gcc/testsuite/rust/compile/syntax-only.rs new file mode 100644 index 0000000..cd84907b --- /dev/null +++ b/gcc/testsuite/rust/compile/syntax-only.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-fsyntax-only" } + +fn main() { + let mut a = 15; + a = true; +} |