Remove redundant input_path field from Config

This commit is contained in:
Oli Scherer 2022-12-06 18:56:28 +00:00
parent 6b1a789fb6
commit f5c601492e
6 changed files with 25 additions and 15 deletions

View file

@ -36,7 +36,6 @@ pub struct Compiler {
pub(crate) sess: Lrc<Session>,
codegen_backend: Lrc<Box<dyn CodegenBackend>>,
pub(crate) input: Input,
pub(crate) input_path: Option<PathBuf>,
pub(crate) output_dir: Option<PathBuf>,
pub(crate) output_file: Option<PathBuf>,
pub(crate) temps_dir: Option<PathBuf>,
@ -244,7 +243,6 @@ pub struct Config {
pub crate_check_cfg: CheckCfg,
pub input: Input,
pub input_path: Option<PathBuf>,
pub output_dir: Option<PathBuf>,
pub output_file: Option<PathBuf>,
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
@ -292,7 +290,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
config.crate_cfg,
config.crate_check_cfg,
config.file_loader,
config.input_path.clone(),
config.input.opt_path(),
config.lint_caps,
config.make_codegen_backend,
registry.clone(),
@ -308,7 +306,6 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
sess: Lrc::new(sess),
codegen_backend: Lrc::new(codegen_backend),
input: config.input,
input_path: config.input_path,
output_dir: config.output_dir,
output_file: config.output_file,
temps_dir,

View file

@ -686,7 +686,7 @@ pub fn prepare_outputs(
generated_output_paths(sess, &outputs, compiler.output_file.is_some(), crate_name);
// Ensure the source file isn't accidentally overwritten during compilation.
if let Some(ref input_path) = compiler.input_path {
if let Some(ref input_path) = compiler.input.opt_path() {
if sess.opts.will_create_output_file() {
if output_contains_path(&output_paths, input_path) {
let reported = sess.emit_err(InputFileWouldBeOverWritten { path: input_path });