1
Fork 0

Auto merge of #81118 - ojeda:metadata-obj, r=nagisa

Skip linking if it is not required

This allows to use `--emit=metadata,obj` and other metadata + non-link combinations.

Fixes #81117.
This commit is contained in:
bors 2021-01-20 07:15:40 +00:00
commit a4cbb44ae2
3 changed files with 23 additions and 4 deletions

View file

@ -403,6 +403,20 @@ impl OutputTypes {
OutputType::Metadata | OutputType::DepInfo => false,
})
}
// Returns `true` if any of the output types require linking.
pub fn should_link(&self) -> bool {
self.0.keys().any(|k| match *k {
OutputType::Bitcode
| OutputType::Assembly
| OutputType::LlvmAssembly
| OutputType::Mir
| OutputType::Metadata
| OutputType::Object
| OutputType::DepInfo => false,
OutputType::Exe => true,
})
}
}
/// Use tree-based collections to cheaply get a deterministic `Hash` implementation.