Skip to content

Do not supply --crate-version flag to rustdoc if present in RUSTDOCFLAGS#8014

Merged
bors merged 1 commit intorust-lang:masterfrom
aleksator:crate_version_in_rustdocflags
Mar 18, 2020
Merged

Do not supply --crate-version flag to rustdoc if present in RUSTDOCFLAGS#8014
bors merged 1 commit intorust-lang:masterfrom
aleksator:crate_version_in_rustdocflags

Conversation

@aleksator
Copy link
Copy Markdown
Contributor

Checks for the flag in extra compiler arguments as well

@rust-highfive
Copy link
Copy Markdown

r? @ehuss

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

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 17, 2020
Comment thread src/cargo/core/compiler/mod.rs Outdated
Comment on lines 647 to 649
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this necessarily needs to be a separate function, I think it would be best just to put the check inline. I can appreciate having the function names clearly express what is being done, but wrapping single expressions like this tends to significantly increase the total lines of code.

Comment thread src/cargo/core/compiler/mod.rs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think these checks will need to be starts_with since you can have something like --crate-version=foo.

Comment thread tests/testsuite/doc.rs Outdated
Comment on lines 1572 to 1576
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
let mut doc_html = String::new();
File::open(&doc_file)
.unwrap()
.read_to_string(&mut doc_html)
.unwrap();
let doc_html = fs::read_to_string(&doc_file).unwrap();

Comment thread tests/testsuite/doc.rs Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think it is necessary to define a whole separate test. To avoid the repetition, at the bottom of the other test, call p.build_dir().rm_rf(); and then p.cargo("rustdoc …"), and then check the results again (can maybe put the asserts in a closure so they aren't repeated).

Comment thread src/cargo/core/compiler/mod.rs Outdated
Comment on lines 640 to 641
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm thinking it might be a little simpler just to check the args of the ProcessBuilder instead of re-fetching the extra args/rustdocflags.

So, move the call to add_crate_versions_if_requested after the args are added to the builder, and call something like this:

rustdoc.get_args().iter().any(|flag| {
    flag.to_str().map_or(false, |s| s.starts_with(RUSTDOC_CRATE_VERSION_FLAG))
})

@aleksator aleksator force-pushed the crate_version_in_rustdocflags branch from 010f77f to 3c11603 Compare March 18, 2020 08:52
@aleksator
Copy link
Copy Markdown
Contributor Author

Applied the suggestions as separate commits for easier reviewing, will squash after approval

Copy link
Copy Markdown
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

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

Thanks! Go ahead and squash! 😄

@aleksator aleksator force-pushed the crate_version_in_rustdocflags branch from 3c11603 to c9e3141 Compare March 18, 2020 18:27
@ehuss
Copy link
Copy Markdown
Contributor

ehuss commented Mar 18, 2020

@bors r+

@bors
Copy link
Copy Markdown
Contributor

bors commented Mar 18, 2020

📌 Commit c9e3141 has been approved by ehuss

@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 Mar 18, 2020
@bors
Copy link
Copy Markdown
Contributor

bors commented Mar 18, 2020

⌛ Testing commit c9e3141 with merge 526aacc...

@bors
Copy link
Copy Markdown
Contributor

bors commented Mar 18, 2020

☀️ Test successful - checks-azure
Approved by: ehuss
Pushing 526aacc to master...

@bors bors merged commit 526aacc into rust-lang:master Mar 18, 2020
@aleksator aleksator deleted the crate_version_in_rustdocflags branch March 18, 2020 19:41
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Mar 25, 2020
Update cargo.

8 commits in 7019b3ed3d539db7429d10a343b69be8c426b576..8a0d4d9c9abc74fd670353094387d62028b40ae9
2020-03-17 21:02:00 +0000 to 2020-03-24 17:57:04 +0000
- Re-implement proc-macro feature decoupling. (rust-lang/cargo#8028)
- Remove unused transitive dependencies: miniz_oxide, adler32 (rust-lang/cargo#8023)
- Fix bug with -Zfeatures=dev_dep and `check --profile=test`. (rust-lang/cargo#8027)
- Remove Config from CompileOptions. (rust-lang/cargo#8021)
- Add `rustless.org` to documented blocklist. (rust-lang/cargo#7922)
- Print colored warnings when build script panics (rust-lang/cargo#8017)
- Do not supply --crate-version flag to rustdoc if present in RUSTDOCFLAGS (rust-lang/cargo#8014)
- Add proc-macro to index, and new feature resolver. (rust-lang/cargo#8003)
Centril added a commit to Centril/rust that referenced this pull request Mar 26, 2020
Update cargo.

8 commits in 7019b3ed3d539db7429d10a343b69be8c426b576..8a0d4d9c9abc74fd670353094387d62028b40ae9
2020-03-17 21:02:00 +0000 to 2020-03-24 17:57:04 +0000
- Re-implement proc-macro feature decoupling. (rust-lang/cargo#8028)
- Remove unused transitive dependencies: miniz_oxide, adler32 (rust-lang/cargo#8023)
- Fix bug with -Zfeatures=dev_dep and `check --profile=test`. (rust-lang/cargo#8027)
- Remove Config from CompileOptions. (rust-lang/cargo#8021)
- Add `rustless.org` to documented blocklist. (rust-lang/cargo#7922)
- Print colored warnings when build script panics (rust-lang/cargo#8017)
- Do not supply --crate-version flag to rustdoc if present in RUSTDOCFLAGS (rust-lang/cargo#8014)
- Add proc-macro to index, and new feature resolver. (rust-lang/cargo#8003)
@ehuss ehuss added this to the 1.44.0 milestone Feb 6, 2022
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants