diff options
| author | Mads Marquart <mads@marquart.dk> | 2024-11-24 01:23:19 +0100 |
|---|---|---|
| committer | Mads Marquart <mads@marquart.dk> | 2024-11-24 01:23:19 +0100 |
| commit | 6bbf832cf266e48c1e8773e5d64a7e90bd866c7b (patch) | |
| tree | 3e46a6c91ced5c022a0e7a395cc3e279d1e105ec /compiler/rustc_codegen_ssa/src/back | |
| parent | cb6f8fa422ce14b82b60af79d0f0d0ad80936ecd (diff) | |
| download | rust-6bbf832cf266e48c1e8773e5d64a7e90bd866c7b.tar.gz rust-6bbf832cf266e48c1e8773e5d64a7e90bd866c7b.zip | |
Remove unnecessary 0 link args optimization
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/linker.rs | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/linker.rs b/compiler/rustc_codegen_ssa/src/back/linker.rs index 162ea38dfd5..05dfbd40a0a 100644 --- a/compiler/rustc_codegen_ssa/src/back/linker.rs +++ b/compiler/rustc_codegen_ssa/src/back/linker.rs @@ -183,15 +183,7 @@ fn verbatim_args<L: Linker + ?Sized>( } /// Add underlying linker arguments to C compiler command, by wrapping them in /// `-Wl` or `-Xlinker`. -fn convert_link_args_to_cc_args( - cmd: &mut Command, - args: impl IntoIterator<Item: AsRef<OsStr>, IntoIter: ExactSizeIterator>, -) { - let args = args.into_iter(); - if args.len() == 0 { - return; - } - +fn convert_link_args_to_cc_args(cmd: &mut Command, args: impl IntoIterator<Item: AsRef<OsStr>>) { let mut combined_arg = OsString::from("-Wl"); for arg in args { // If the argument itself contains a comma, we need to emit it @@ -220,10 +212,7 @@ fn convert_link_args_to_cc_args( } /// Arguments for the underlying linker. /// Add options to pass them through cc wrapper if `Linker` is a cc wrapper. -fn link_args<L: Linker + ?Sized>( - l: &mut L, - args: impl IntoIterator<Item: AsRef<OsStr>, IntoIter: ExactSizeIterator>, -) -> &mut L { +fn link_args<L: Linker + ?Sized>(l: &mut L, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut L { if !l.is_cc() { verbatim_args(l, args); } else { @@ -257,7 +246,7 @@ macro_rules! generate_arg_methods { verbatim_args(self, iter::once(arg)) } #[allow(unused)] - pub(crate) fn link_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>, IntoIter: ExactSizeIterator>) -> &mut Self { + pub(crate) fn link_args(&mut self, args: impl IntoIterator<Item: AsRef<OsStr>>) -> &mut Self { link_args(self, args) } #[allow(unused)] |
