diff options
| author | Miguel Ojeda <ojeda@kernel.org> | 2021-01-17 15:06:47 +0100 |
|---|---|---|
| committer | Miguel Ojeda <ojeda@kernel.org> | 2021-01-17 15:44:42 +0100 |
| commit | f9275e1092232fcb8ec117fc4acca990f57cba15 (patch) | |
| tree | cd4c20d7812548bfb8fadc8a292131696f8a16aa /compiler/rustc_session/src | |
| parent | fc9944fe84a683f0450c0921a935456e51b1c3ae (diff) | |
| download | rust-f9275e1092232fcb8ec117fc4acca990f57cba15.tar.gz rust-f9275e1092232fcb8ec117fc4acca990f57cba15.zip | |
Skip linking if it is not required
This allows to use `--emit=metadata,obj` and other metadata + non-link combinations. Fixes #81117. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'compiler/rustc_session/src')
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 0cafdec1495..49833601c9e 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -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. |
