gccrs
gccrs copied to clipboard
Only allow compilation of one file at a time
I actually would like to add the following changes so that this assumption will always be true:
diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc
index 5ecd79b15..5f06862eb 100644
--- a/gcc/rust/rust-lang.cc
+++ b/gcc/rust/rust-lang.cc
@@ -168,6 +168,12 @@ grs_langhook_parse_file (void)
{
rust_debug ("Preparing to parse files. ");
+ /* Rust only allows the "root file" to be supplied */
+ if (num_in_fnames > 1) {
+ rust_error_at(Location(), "multiple input filenames provided");
+ return;
+ }
+
Rust::Session::get_instance ().parse_files (num_in_fnames, in_fnames);
}
Originally posted by @liushuyu in https://github.com/Rust-GCC/gccrs/pull/1088#discussion_r844624558
First of all, this is more of a question: Is it something we want to do? I think probably yes, but I'm curious about what everyone thinks.
Yeah the lang-hook interface expects to be able to handle multiple files, we need to change that. If we make this change can we should update the rust-session-manager::parse_files to be Parse and for it to just take a single path though does this have an interaction with stdin to think about? I remember @dkm added code for that at one point.
I would like to see the Session::parse_file function be changed into something like Session::compilation_pipeline(filename) just so that we signify that this is designed to run a pipeline on a single file.