From 0c082b7fa918be945712f8510ad2f9135cf26748 Mon Sep 17 00:00:00 2001 From: 823984418 <823984418@qq.com> Date: Mon, 26 Feb 2024 22:37:04 +0800 Subject: [PATCH] remove useless lifetime of ArchiveBuilder --- compiler/rustc_codegen_cranelift/src/archive.rs | 2 +- compiler/rustc_codegen_gcc/src/archive.rs | 2 +- compiler/rustc_codegen_llvm/src/back/archive.rs | 4 ++-- compiler/rustc_codegen_ssa/src/back/archive.rs | 6 +++--- compiler/rustc_codegen_ssa/src/back/link.rs | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/archive.rs b/compiler/rustc_codegen_cranelift/src/archive.rs index 5a29bc18def..414d3db1c51 100644 --- a/compiler/rustc_codegen_cranelift/src/archive.rs +++ b/compiler/rustc_codegen_cranelift/src/archive.rs @@ -8,7 +8,7 @@ pub(crate) struct ArArchiveBuilderBuilder; impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder { - fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box + 'a> { + fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box { Box::new(ArArchiveBuilder::new(sess, get_native_object_symbols)) } diff --git a/compiler/rustc_codegen_gcc/src/archive.rs b/compiler/rustc_codegen_gcc/src/archive.rs index 11fa074f5ac..73ff0c37b66 100644 --- a/compiler/rustc_codegen_gcc/src/archive.rs +++ b/compiler/rustc_codegen_gcc/src/archive.rs @@ -10,7 +10,7 @@ pub(crate) struct ArArchiveBuilderBuilder; impl ArchiveBuilderBuilder for ArArchiveBuilderBuilder { - fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box + 'a> { + fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box { Box::new(ArArchiveBuilder::new(sess, get_native_object_symbols)) } diff --git a/compiler/rustc_codegen_llvm/src/back/archive.rs b/compiler/rustc_codegen_llvm/src/back/archive.rs index 67bc86e4c90..f4ddb533d2b 100644 --- a/compiler/rustc_codegen_llvm/src/back/archive.rs +++ b/compiler/rustc_codegen_llvm/src/back/archive.rs @@ -60,7 +60,7 @@ fn llvm_machine_type(cpu: &str) -> LLVMMachineType { } } -impl<'a> ArchiveBuilder<'a> for LlvmArchiveBuilder<'a> { +impl<'a> ArchiveBuilder for LlvmArchiveBuilder<'a> { fn add_archive( &mut self, archive: &Path, @@ -107,7 +107,7 @@ fn build(mut self: Box, output: &Path) -> bool { pub struct LlvmArchiveBuilderBuilder; impl ArchiveBuilderBuilder for LlvmArchiveBuilderBuilder { - fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box + 'a> { + fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box { // FIXME use ArArchiveBuilder on most targets again once reading thin archives is // implemented if true { diff --git a/compiler/rustc_codegen_ssa/src/back/archive.rs b/compiler/rustc_codegen_ssa/src/back/archive.rs index 0dadd047c9a..22b58c13949 100644 --- a/compiler/rustc_codegen_ssa/src/back/archive.rs +++ b/compiler/rustc_codegen_ssa/src/back/archive.rs @@ -21,7 +21,7 @@ pub use crate::errors::{ArchiveBuildFailure, ExtractBundledLibsError, UnknownArchiveKind}; pub trait ArchiveBuilderBuilder { - fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box + 'a>; + fn new_archive_builder<'a>(&self, sess: &'a Session) -> Box; /// Creates a DLL Import Library . /// and returns the path on disk to that import library. @@ -74,7 +74,7 @@ fn extract_bundled_libs<'a>( } } -pub trait ArchiveBuilder<'a> { +pub trait ArchiveBuilder { fn add_file(&mut self, path: &Path); fn add_archive( @@ -167,7 +167,7 @@ pub fn try_extract_macho_fat_archive( } } -impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> { +impl<'a> ArchiveBuilder for ArArchiveBuilder<'a> { fn add_archive( &mut self, archive_path: &Path, diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 1ad0dec0640..e4a050dcfc9 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -308,7 +308,7 @@ fn link_rlib<'a>( codegen_results: &CodegenResults, flavor: RlibFlavor, tmpdir: &MaybeTempDir, -) -> Result + 'a>, ErrorGuaranteed> { +) -> Result, ErrorGuaranteed> { let lib_search_paths = archive_search_paths(sess); let mut ab = archive_builder_builder.new_archive_builder(sess);