about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-06-17 19:10:03 +0000
committerbors <bors@rust-lang.org>2024-06-17 19:10:03 +0000
commit04ab7b2be0db3e6787f5303285c6b2ee6279868d (patch)
tree708015dfa752126c900eba620ffd477578abb437 /src
parent11380368dc53d0b2fc3a627408818eff1973ce9a (diff)
parentd5f9117403ab281d8168f81a31ed6c2d9257d839 (diff)
downloadrust-04ab7b2be0db3e6787f5303285c6b2ee6279868d.tar.gz
rust-04ab7b2be0db3e6787f5303285c6b2ee6279868d.zip
Auto merge of #126605 - matthiaskrgr:rollup-plsaytq, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #126255 (fix checking git submodules during a commit hook)
 - #126355 (Pass target to some run-make tests)
 - #126567 (Rename `InstanceDef` -> `InstanceKind`)
 - #126579 (Fix broken documentation link)
 - #126596 (Add tracking issue number to async_drop APIs)
 - #126603 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/lib.rs37
-rw-r--r--src/bootstrap/src/utils/helpers.rs10
m---------src/doc/book0
m---------src/doc/edition-guide0
m---------src/doc/reference0
m---------src/doc/rust-by-example0
m---------src/doc/rustc-dev-guide0
-rw-r--r--src/tools/miri/src/intrinsics/mod.rs2
8 files changed, 28 insertions, 21 deletions
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index abf407ea91e..449d8c128ec 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -520,10 +520,12 @@ impl Build {
             return;
         }
 
-        // check_submodule
-        let checked_out_hash =
-            output(helpers::git(Some(&absolute_path)).args(["rev-parse", "HEAD"]));
-        // update_submodules
+        let submodule_git = || helpers::git(Some(&absolute_path));
+
+        // Determine commit checked out in submodule.
+        let checked_out_hash = output(submodule_git().args(["rev-parse", "HEAD"]));
+        let checked_out_hash = checked_out_hash.trim_end();
+        // Determine commit that the submodule *should* have.
         let recorded =
             output(helpers::git(Some(&self.src)).args(["ls-tree", "HEAD"]).arg(relative_path));
         let actual_hash = recorded
@@ -531,8 +533,7 @@ impl Build {
             .nth(2)
             .unwrap_or_else(|| panic!("unexpected output `{}`", recorded));
 
-        // update_submodule
-        if actual_hash == checked_out_hash.trim_end() {
+        if actual_hash == checked_out_hash {
             // already checked out
             return;
         }
@@ -581,26 +582,22 @@ impl Build {
         // Save any local changes, but avoid running `git stash pop` if there are none (since it will exit with an error).
         // diff-index reports the modifications through the exit status
         let has_local_modifications = !self.run_cmd(
-            BootstrapCommand::from(helpers::git(Some(&absolute_path)).args([
-                "diff-index",
-                "--quiet",
-                "HEAD",
-            ]))
-            .allow_failure()
-            .output_mode(match self.is_verbose() {
-                true => OutputMode::PrintAll,
-                false => OutputMode::PrintOutput,
-            }),
+            BootstrapCommand::from(submodule_git().args(["diff-index", "--quiet", "HEAD"]))
+                .allow_failure()
+                .output_mode(match self.is_verbose() {
+                    true => OutputMode::PrintAll,
+                    false => OutputMode::PrintOutput,
+                }),
         );
         if has_local_modifications {
-            self.run(helpers::git(Some(&absolute_path)).args(["stash", "push"]));
+            self.run(submodule_git().args(["stash", "push"]));
         }
 
-        self.run(helpers::git(Some(&absolute_path)).args(["reset", "-q", "--hard"]));
-        self.run(helpers::git(Some(&absolute_path)).args(["clean", "-qdfx"]));
+        self.run(submodule_git().args(["reset", "-q", "--hard"]));
+        self.run(submodule_git().args(["clean", "-qdfx"]));
 
         if has_local_modifications {
-            self.run(helpers::git(Some(&absolute_path)).args(["stash", "pop"]));
+            self.run(submodule_git().args(["stash", "pop"]));
         }
     }
 
diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs
index 13d1346b3d9..4b6dc45b436 100644
--- a/src/bootstrap/src/utils/helpers.rs
+++ b/src/bootstrap/src/utils/helpers.rs
@@ -501,6 +501,16 @@ pub fn git(source_dir: Option<&Path>) -> Command {
 
     if let Some(source_dir) = source_dir {
         git.current_dir(source_dir);
+        // If we are running inside git (e.g. via a hook), `GIT_DIR` is set and takes precedence
+        // over the current dir. Un-set it to make the current dir matter.
+        git.env_remove("GIT_DIR");
+        // Also un-set some other variables, to be on the safe side (based on cargo's
+        // `fetch_with_cli`). In particular un-setting `GIT_INDEX_FILE` is required to fix some odd
+        // misbehavior.
+        git.env_remove("GIT_WORK_TREE")
+            .env_remove("GIT_INDEX_FILE")
+            .env_remove("GIT_OBJECT_DIRECTORY")
+            .env_remove("GIT_ALTERNATE_OBJECT_DIRECTORIES");
     }
 
     git
diff --git a/src/doc/book b/src/doc/book
-Subproject 5228bfac8267ad24659a81b92ec5417976b5edb
+Subproject 45c1a6d69edfd1fc91fb7504cb73958dbd09441
diff --git a/src/doc/edition-guide b/src/doc/edition-guide
-Subproject bbaabbe088e21a81a0d9ae6757705020d5d7b41
+Subproject cb58c430b4e8054c2cb81d2d4434092c482a93d
diff --git a/src/doc/reference b/src/doc/reference
-Subproject 6019b76f5b28938565b251bbba0bf5cc5c43d86
+Subproject 0b805c65804019b0ac8f2fe3117afad82a6069b
diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example
-Subproject 4840dca06cadf48b305d3ce0aeafde7f80933f8
+Subproject b1d97bd6113aba732b2091ce093c76f2d05bb8a
diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide
-Subproject 6a7374bd87cbac0f8be4fd4877d8186d9c31398
+Subproject aec82168dd3121289a194b381f56076fc789a4d
diff --git a/src/tools/miri/src/intrinsics/mod.rs b/src/tools/miri/src/intrinsics/mod.rs
index 74e39ffd933..313eac36337 100644
--- a/src/tools/miri/src/intrinsics/mod.rs
+++ b/src/tools/miri/src/intrinsics/mod.rs
@@ -57,7 +57,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                     );
                 }
                 Ok(Some(ty::Instance {
-                    def: ty::InstanceDef::Item(instance.def_id()),
+                    def: ty::InstanceKind::Item(instance.def_id()),
                     args: instance.args,
                 }))
             }