1035: Handle -fsyntax-only r=CohenArthur a=CohenArthur

Handle the -fsyntax-only properly from the rust frontend. This flag
allows checking for syntax and stopping after that, skipping further
passes of the pipeline.
The flag was accepted by the frontend, but was not used anywhere.

Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>
This commit is contained in:
bors[bot] 2022-03-17 13:15:45 +00:00 committed by GitHub
commit 1a14348afe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -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");

View File

@ -0,0 +1,6 @@
// { dg-additional-options "-fsyntax-only" }
fn main() {
let mut a = 15;
a = true;
}