diff options
| author | bors <bors@rust-lang.org> | 2023-08-10 15:46:39 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-10 15:46:39 +0000 |
| commit | faee636ebfff793ea9dcff17960a611b580e3cd5 (patch) | |
| tree | 0478de42ca247b79996e8425b9516d4504fa5ee7 /src | |
| parent | 9fa6bdd764a1f7bdf69eccceeace6d13f38cb2e1 (diff) | |
| parent | 5f0d5855cb6ebeab871646cee8448281b4ad1fcc (diff) | |
| download | rust-faee636ebfff793ea9dcff17960a611b580e3cd5.tar.gz rust-faee636ebfff793ea9dcff17960a611b580e3cd5.zip | |
Auto merge of #114697 - matthiaskrgr:rollup-ywooy8x, r=matthiaskrgr
Rollup of 5 pull requests Successful merges: - #114278 (better error handling for `rust.codegen-backends` on deserialization) - #114674 (Add clubby789 to `users_on_vacation`) - #114678 (`Expr::can_have_side_effects()` is incorrect for struct/enum/array/tuple literals) - #114681 (doc (unstable-book): fix a typo) - #114684 (Remove redundant calls to `resolve_vars_with_obligations`) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/compile.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/config.rs | 18 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/profile_sample_use.md | 2 |
3 files changed, 18 insertions, 4 deletions
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 62c7b96b5be..cad370ad756 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -1129,7 +1129,7 @@ fn needs_codegen_config(run: &RunConfig<'_>) -> bool { needs_codegen_cfg } -const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; +pub(crate) const CODEGEN_BACKEND_PREFIX: &str = "rustc_codegen_"; fn is_codegen_cfg_needed(path: &TaskPath, run: &RunConfig<'_>) -> bool { if path.path.to_str().unwrap().contains(&CODEGEN_BACKEND_PREFIX) { diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index cdb34f99164..830c1a3b846 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -20,6 +20,7 @@ use std::str::FromStr; use crate::cache::{Interned, INTERNER}; use crate::cc_detect::{ndk_compiler, Language}; use crate::channel::{self, GitInfo}; +use crate::compile::CODEGEN_BACKEND_PREFIX; pub use crate::flags::Subcommand; use crate::flags::{Color, Flags, Warnings}; use crate::util::{exe, output, t}; @@ -1443,8 +1444,21 @@ impl Config { .map(|v| v.parse().expect("failed to parse rust.llvm-libunwind")); if let Some(ref backends) = rust.codegen_backends { - config.rust_codegen_backends = - backends.iter().map(|s| INTERNER.intern_str(s)).collect(); + let available_backends = vec!["llvm", "cranelift", "gcc"]; + + config.rust_codegen_backends = backends.iter().map(|s| { + if let Some(backend) = s.strip_prefix(CODEGEN_BACKEND_PREFIX) { + if available_backends.contains(&backend) { + panic!("Invalid value '{s}' for 'rust.codegen-backends'. Instead, please use '{backend}'."); + } else { + println!("help: '{s}' for 'rust.codegen-backends' might fail. \ + Codegen backends are mostly defined without the '{CODEGEN_BACKEND_PREFIX}' prefix. \ + In this case, it would be referred to as '{backend}'."); + } + } + + INTERNER.intern_str(s) + }).collect(); } config.rust_codegen_units = rust.codegen_units.map(threads_from_config); diff --git a/src/doc/unstable-book/src/compiler-flags/profile_sample_use.md b/src/doc/unstable-book/src/compiler-flags/profile_sample_use.md index ce894ce6ac7..2dd1f6f8e1a 100644 --- a/src/doc/unstable-book/src/compiler-flags/profile_sample_use.md +++ b/src/doc/unstable-book/src/compiler-flags/profile_sample_use.md @@ -1,4 +1,4 @@ -# `profile-sample-use +# `profile-sample-use` --- |
