diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc index 1088845497e..e77644e8bc7 100644 --- a/gcc/rust/rust-lang.cc +++ b/gcc/rust/rust-lang.cc @@ -286,6 +286,10 @@ grs_langhook_post_options (const char **pfilename ATTRIBUTE_UNUSED) { // can be used to override other options if required + // check for input file + if (!*pfilename && num_in_fnames == 0) + *pfilename = "-"; + // satisfies an assert in init_excess_precision in toplev.cc if (flag_excess_precision /*_cmdline*/ == EXCESS_PRECISION_DEFAULT) flag_excess_precision /*_cmdline*/ = EXCESS_PRECISION_STANDARD; diff --git a/gcc/rust/rust-session-manager.cc b/gcc/rust/rust-session-manager.cc index 64181184683..272279db0e7 100644 --- a/gcc/rust/rust-session-manager.cc +++ b/gcc/rust/rust-session-manager.cc @@ -399,6 +399,12 @@ Session::enable_dump (std::string arg) void Session::handle_input_files (int num_files, const char **files) { + static const char *stdin_file[] = {"-"}; + if (num_files == 0) + { + files = stdin_file; + num_files = 1; + } if (num_files != 1) rust_fatal_error (UNDEF_LOCATION, "only one file may be specified on the command line");