about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-11-05 11:47:38 +0000
committerbors <bors@rust-lang.org>2023-11-05 11:47:38 +0000
commit04817ff00cfa1ec00a9babcb2ade1e3f2874d9bd (patch)
tree0b6bfd85de61c1dd13923e235636a37757653b8e /src
parent513a48517ed80cb979d88e7eb7fbcf761a35620b (diff)
parenta6605163346d7680502d8e2c1e5aaf1dc3229e41 (diff)
downloadrust-04817ff00cfa1ec00a9babcb2ade1e3f2874d9bd.tar.gz
rust-04817ff00cfa1ec00a9babcb2ade1e3f2874d9bd.zip
Auto merge of #117608 - matthiaskrgr:rollup-g9fagmv, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #116017 (Don't pass `-stdlib=libc++` when building C files on macOS)
 - #117524 (bootstrap/setup: create hooks directory if non-existing)
 - #117588 (Remove unused LoadResult::DecodeIncrCache variant)
 - #117596 (Add diagnostic items for a few of core's builtin macros)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs7
-rw-r--r--src/bootstrap/src/lib.rs7
2 files changed, 9 insertions, 5 deletions
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 435ebb6df90..b4540641bfa 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -469,7 +469,8 @@ fn install_git_hook_maybe(config: &Config) -> io::Result<()> {
         assert!(output.status.success(), "failed to run `git`");
         PathBuf::from(t!(String::from_utf8(output.stdout)).trim())
     }));
-    let dst = git.join("hooks").join("pre-push");
+    let hooks_dir = git.join("hooks");
+    let dst = hooks_dir.join("pre-push");
     if dst.exists() {
         // The git hook has already been set up, or the user already has a custom hook.
         return Ok(());
@@ -486,6 +487,10 @@ undesirable, simply delete the `pre-push` file from .git/hooks."
         println!("Ok, skipping installation!");
         return Ok(());
     }
+    if !hooks_dir.exists() {
+        // We need to (try to) create the hooks directory first.
+        let _ = fs::create_dir(hooks_dir);
+    }
     let src = config.src.join("src").join("etc").join("pre-push.sh");
     match fs::hard_link(src, &dst) {
         Err(e) => {
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index d7f49a6d11b..303c910d49f 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -1197,11 +1197,10 @@ impl Build {
             .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
             .collect::<Vec<String>>();
 
-        // If we're compiling on macOS then we add a few unconditional flags
-        // indicating that we want libc++ (more filled out than libstdc++) and
-        // we want to compile for 10.7. This way we can ensure that
+        // If we're compiling C++ on macOS then we add a flag indicating that
+        // we want libc++ (more filled out than libstdc++), ensuring that
         // LLVM/etc are all properly compiled.
-        if target.contains("apple-darwin") {
+        if matches!(c, CLang::Cxx) && target.contains("apple-darwin") {
             base.push("-stdlib=libc++".into());
         }