Skip to content
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

Fix rustdoc --version when used with download-rustc #104184

Merged
merged 1 commit into from
Nov 10, 2022

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Nov 9, 2022

Previously, rustdoc would unconditionally report the version that rustc was compiled with. That showed things like nightly-2022-10-30, which wasn't right, since this was a dev build compiled from source.

Fix it by changing rustc_driver::version to a macro expanded at invocation time.

cc #103206 (comment)

Previously, rustdoc would unconditionally report the version that *rustc* was compiled with.
That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source.

Fix it by changing `rustc_driver::version` to a macro expanded at invocation time.
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2022

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 9, 2022
@rustbot
Copy link
Collaborator

rustbot commented Nov 9, 2022

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@jyn514 jyn514 added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 9, 2022
@jyn514
Copy link
Member Author

jyn514 commented Nov 9, 2022

I am not sure how to test this ahead of time, modifying rustc means that both rustdoc and rustc are now reporting -dev locally. I guess I can download a try build and use that with download-rustc? Not sure if it's supported though.

@bors try

@bors
Copy link
Contributor

bors commented Nov 9, 2022

⌛ Trying commit a68ec22 with merge a7cd917db3301da14641b8794327a9a4499838d8...

Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation LGTM, though I hadn't seen decl_macro used before, so r=me once you're happy this does what you want.

@bors
Copy link
Contributor

bors commented Nov 9, 2022

☀️ Try build successful - checks-actions
Build commit: a7cd917db3301da14641b8794327a9a4499838d8 (a7cd917db3301da14641b8794327a9a4499838d8)

@jyn514
Copy link
Member Author

jyn514 commented Nov 9, 2022

Ok yes, this works :)

; git diff
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 21dc11c4808..610536ff3d3 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -1595,23 +1595,7 @@ fn download_ci_rustc_commit(
     let compiler = format!("{top_level}/compiler/");
     let library = format!("{top_level}/library/");
 
-    // Look for a version to compare to based on the current commit.
-    // Only commits merged by bors will have CI artifacts.
-    let merge_base = output(
-        config
-            .git()
-            .arg("rev-list")
-            .arg(format!("--author={}", config.stage0_metadata.config.git_merge_commit_email))
-            .args(&["-n1", "--first-parent", "HEAD"]),
-    );
-    let commit = merge_base.trim_end();
-    if commit.is_empty() {
-        println!("error: could not find commit hash for downloading rustc");
-        println!("help: maybe your repository history is too shallow?");
-        println!("help: consider disabling `download-rustc`");
-        println!("help: or fetch enough history to include one upstream commit");
-        crate::detail_exit(1);
-    }
+    let commit = "a7cd917db3301da14641b8794327a9a4499838d8";
 
     // Warn if there were changes to the compiler or standard library since the ancestor commit.
     let has_changes = !t!(config
; x build
# ...
; /home/jnelson/rust-lang/rust2/build/x86_64-unknown-linux-gnu/ci-rustc-sysroot/bin/rustdoc --version
rustdoc 1.67.0-dev
; /home/jnelson/rust-lang/rust2/build/x86_64-unknown-linux-gnu/ci-rustc-sysroot/bin/rustc --version
rustc 1.67.0-nightly (a7cd917db 2022-11-09)

@jyn514
Copy link
Member Author

jyn514 commented Nov 9, 2022

@bors r=davidtwco rollup

@bors
Copy link
Contributor

bors commented Nov 9, 2022

📌 Commit a68ec22 has been approved by davidtwco

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 9, 2022
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 9, 2022
Fix `rustdoc --version` when used with download-rustc

Previously, rustdoc would unconditionally report the version that *rustc* was compiled with. That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source.

Fix it by changing `rustc_driver::version` to a macro expanded at invocation time.

cc rust-lang#103206 (comment)
Manishearth added a commit to Manishearth/rust that referenced this pull request Nov 9, 2022
Fix `rustdoc --version` when used with download-rustc

Previously, rustdoc would unconditionally report the version that *rustc* was compiled with. That showed things like `nightly-2022-10-30`, which wasn't right, since this was a `dev` build compiled from source.

Fix it by changing `rustc_driver::version` to a macro expanded at invocation time.

cc rust-lang#103206 (comment)
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 9, 2022
…earth

Rollup of 9 pull requests

Successful merges:

 - rust-lang#101005 (Migrate rustc_codegen_llvm to SessionDiagnostics)
 - rust-lang#103307 (Add context to compiler error message)
 - rust-lang#103464 (Add support for custom mir)
 - rust-lang#103929 (Cleanup Apple-related code in rustc_target)
 - rust-lang#104015 (Remove linuxkernel targets)
 - rust-lang#104020 (Limit efiapi calling convention to supported arches)
 - rust-lang#104156 (Cleanups in autoderef impl)
 - rust-lang#104171 (Update books)
 - rust-lang#104184 (Fix `rustdoc --version` when used with download-rustc)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 70c04a2 into rust-lang:master Nov 10, 2022
@rustbot rustbot added this to the 1.67.0 milestone Nov 10, 2022
@jyn514 jyn514 deleted the rustdoc-version branch December 10, 2022 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants