Skip to content

Commit 479987b

Browse files
committed
Don't emit an error about failing to produce a file with a specific name
If user never gave an explicit name
1 parent 03994e4 commit 479987b

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

compiler/rustc_codegen_ssa/src/back/write.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ fn produce_final_output_artifacts(
592592
.unwrap()
593593
.to_owned();
594594

595-
if crate_output.outputs.contains_key(&output_type) {
595+
if crate_output.outputs.contains_explicit_name(&output_type) {
596596
// 2) Multiple codegen units, with `--emit foo=some_name`. We have
597597
// no good solution for this case, so warn the user.
598598
sess.dcx().emit_warn(errors::IgnoringEmitPath { extension });

compiler/rustc_session/src/config.rs

+5
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,11 @@ impl OutputTypes {
557557
self.0.contains_key(key)
558558
}
559559

560+
/// Returns `true` if user specified a name and not just produced type
561+
pub fn contains_explicit_name(&self, key: &OutputType) -> bool {
562+
self.0.get(key).map_or(false, |f| f.is_some())
563+
}
564+
560565
pub fn iter(&self) -> BTreeMapIter<'_, OutputType, Option<OutFileName>> {
561566
self.0.iter()
562567
}

0 commit comments

Comments
 (0)