Don't emit an error about failing to produce a file with a specific name
If user never gave an explicit name
This commit is contained in:
parent
03994e498d
commit
bf12aa49e7
@ -592,7 +592,7 @@ fn produce_final_output_artifacts(
|
||||
.unwrap()
|
||||
.to_owned();
|
||||
|
||||
if crate_output.outputs.contains_key(&output_type) {
|
||||
if crate_output.outputs.contains_explicit_name(&output_type) {
|
||||
// 2) Multiple codegen units, with `--emit foo=some_name`. We have
|
||||
// no good solution for this case, so warn the user.
|
||||
sess.dcx().emit_warn(errors::IgnoringEmitPath { extension });
|
||||
|
@ -557,6 +557,11 @@ pub fn contains_key(&self, key: &OutputType) -> bool {
|
||||
self.0.contains_key(key)
|
||||
}
|
||||
|
||||
/// Returns `true` if user specified a name and not just produced type
|
||||
pub fn contains_explicit_name(&self, key: &OutputType) -> bool {
|
||||
self.0.get(key).map_or(false, |f| f.is_some())
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> BTreeMapIter<'_, OutputType, Option<OutFileName>> {
|
||||
self.0.iter()
|
||||
}
|
||||
|
23
tests/ui/issues/no-explicit-path-issue-122509.rs
Normal file
23
tests/ui/issues/no-explicit-path-issue-122509.rs
Normal file
@ -0,0 +1,23 @@
|
||||
//@ build-pass
|
||||
//@ compile-flags: -C codegen-units=2 --emit asm
|
||||
|
||||
fn one() -> usize {
|
||||
1
|
||||
}
|
||||
|
||||
pub mod a {
|
||||
pub fn two() -> usize {
|
||||
::one() + ::one()
|
||||
}
|
||||
}
|
||||
|
||||
pub mod b {
|
||||
pub fn three() -> usize {
|
||||
::one() + ::a::two()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
a::two();
|
||||
b::three();
|
||||
}
|
Loading…
Reference in New Issue
Block a user