From 23ee523ea61355c332481566bb5a093f29cdce59 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 21 Mar 2024 10:35:19 +1100 Subject: Remove `CodegenBackend::target_override`. Backend and target selection is a mess: the target can override the backend (via `Target::default_codegen_backend`), *and* the backend can override the target (via `CodegenBackend::target_override`). The code that handles this is ugly. It calls `build_target_config` twice, once before getting the backend and once again afterward. It also must check that both overrides aren't triggering at the same time. This commit removes the latter override. It's used in rust-gpu but @eddyb said via Zulip that removing it would be ok. This simplifies the code greatly, and will allow some nice follow-up refactorings. --- compiler/rustc_codegen_ssa/src/traits/backend.rs | 7 ------- 1 file changed, 7 deletions(-) (limited to 'compiler/rustc_codegen_ssa/src') diff --git a/compiler/rustc_codegen_ssa/src/traits/backend.rs b/compiler/rustc_codegen_ssa/src/traits/backend.rs index e6d42c596d2..e8b9490d401 100644 --- a/compiler/rustc_codegen_ssa/src/traits/backend.rs +++ b/compiler/rustc_codegen_ssa/src/traits/backend.rs @@ -21,7 +21,6 @@ use rustc_session::{ }; use rustc_span::symbol::Symbol; use rustc_target::abi::call::FnAbi; -use rustc_target::spec::Target; use std::fmt; @@ -70,12 +69,6 @@ pub trait CodegenBackend { fn print_passes(&self) {} fn print_version(&self) {} - /// If this plugin provides additional builtin targets, provide the one enabled by the options here. - /// Be careful: this is called *before* init() is called. - fn target_override(&self, _opts: &config::Options) -> Option { - None - } - /// The metadata loader used to load rlib and dylib metadata. /// /// Alternative codegen backends may want to use different rlib or dylib formats than the -- cgit 1.4.1-3-g733a5