1
Fork 0

Rollup merge of #116793 - WaffleLapkin:target_rules_the_backend, r=cjgillot

Allow targets to override default codegen backend

Implements https://github.com/rust-lang/compiler-team/issues/670.
This commit is contained in:
Jubilee 2024-03-11 09:29:32 -07:00 committed by GitHub
commit 86af4d25a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 117 additions and 59 deletions

View file

@ -193,6 +193,12 @@ pub fn sysroot_candidates() -> SmallVec<[PathBuf; 2]> {
return sysroot_candidates;
}
/// Returns the provided sysroot or calls [`get_or_default_sysroot`] if it's none.
/// Panics if [`get_or_default_sysroot`] returns an error.
pub fn materialize_sysroot(maybe_sysroot: Option<PathBuf>) -> PathBuf {
maybe_sysroot.unwrap_or_else(|| get_or_default_sysroot().expect("Failed finding sysroot"))
}
/// This function checks if sysroot is found using env::args().next(), and if it
/// is not found, finds sysroot from current rustc_driver dll.
pub fn get_or_default_sysroot() -> Result<PathBuf, String> {