-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow targets to override default codegen backend #116793
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ pub use crate::options::*; | |
use crate::errors::FileWriteFail; | ||
use crate::search_paths::SearchPath; | ||
use crate::utils::{CanonicalizedPath, NativeLib, NativeLibKind}; | ||
use crate::{lint, HashStableContext}; | ||
use crate::{filesearch, lint, HashStableContext}; | ||
use crate::{EarlyDiagCtxt, Session}; | ||
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet}; | ||
use rustc_data_structures::stable_hasher::{StableOrd, ToStableHashKey}; | ||
|
@@ -1558,7 +1558,7 @@ pub fn build_configuration(sess: &Session, mut user_cfg: Cfg) -> Cfg { | |
user_cfg | ||
} | ||
|
||
pub(super) fn build_target_config( | ||
pub fn build_target_config( | ||
early_dcx: &EarlyDiagCtxt, | ||
opts: &Options, | ||
target_override: Option<Target>, | ||
|
@@ -2856,16 +2856,8 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M | |
|
||
let logical_env = parse_logical_env(early_dcx, matches); | ||
|
||
// Try to find a directory containing the Rust `src`, for more details see | ||
// the doc comment on the `real_rust_source_base_dir` field. | ||
let tmp_buf; | ||
let sysroot = match &sysroot_opt { | ||
Some(s) => s, | ||
None => { | ||
tmp_buf = crate::filesearch::get_or_default_sysroot().expect("Failed finding sysroot"); | ||
&tmp_buf | ||
} | ||
}; | ||
let sysroot = filesearch::materialize_sysroot(sysroot_opt); | ||
|
||
let real_rust_source_base_dir = { | ||
// This is the location used by the `rust-src` `rustup` component. | ||
let mut candidate = sysroot.join("lib/rustlib/src/rust"); | ||
|
@@ -2909,7 +2901,7 @@ pub fn build_session_options(early_dcx: &mut EarlyDiagCtxt, matches: &getopts::M | |
describe_lints, | ||
output_types, | ||
search_paths, | ||
maybe_sysroot: sysroot_opt, | ||
maybe_sysroot: Some(sysroot), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This made it impossible for the |
||
target_triple, | ||
test, | ||
incremental, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't really do the same thing as before, or rather it assumes custom codegen backends require
config.make_codegen_backend
, whereasconfig.opts.unstable_opts.codegen_backend
is also possible.The new version calls
config::build_target_config
once, without the override, which means the backend cannot add new targets, only at most slightly tweak existing ones.To be clear, none of this really matters anymore due to:
target_override
#122810(but I ran into it while trying to update Rust-GPU to
nightly-2024-03-21
, just before #122810, just so I can get everything else out of the way before tackling thetarget_override
removal itself)