Skip to content

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jun 21, 2021

  • Remove unnecessary reallocation
  • Remove unnecessary messing around with queries for the crate name; it's simpler and faster to go through the TyCtxt instead
  • Rename cratename -> crate_name for consistency with the rest of the compiler

@jyn514 jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-doctests Area: Documentation tests, run by rustdoc labels Jun 21, 2021
@rust-highfive
Copy link
Contributor

r? @CraftSpider

(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 Jun 21, 2021
@rust-log-analyzer

This comment has been minimized.

@jyn514 jyn514 force-pushed the doctest-cleanup branch from dfde76d to 615198d Compare June 21, 2021 01:05
@CraftSpider
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 21, 2021

📌 Commit 615198d97f833ff84065e44d7fc12009700883a4 has been approved by CraftSpider

@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 Jun 21, 2021
let mut global_ctxt = queries.global_ctxt()?.take();

let collector = global_ctxt.enter(|tcx| {
let krate = tcx.hir().krate();
let crate_attrs = tcx.hir().attrs(CRATE_HIR_ID);

let mut opts = scrape_test_config(crate_attrs);
opts.display_warnings |= options.display_warnings;
let opts = scrape_test_config(crate_attrs);
Copy link
Member Author

Choose a reason for hiding this comment

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

Err. I accidentally removed this line.

Copy link
Contributor

Choose a reason for hiding this comment

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

Whoops, my fault for missing that. Honestly, I thought it was part of your changes to name handling at first.

Copy link
Member Author

Choose a reason for hiding this comment

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

No big deal, I missed it too 😆

@jyn514
Copy link
Member Author

jyn514 commented Jun 21, 2021

@bors r- until I fix the bug

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 21, 2021
jyn514 added 3 commits June 21, 2021 19:48
It's much more complicated than just going through the TyCtxt.
This makes it consistent with rustc_session::Options.
@jyn514 jyn514 force-pushed the doctest-cleanup branch from 615198d to ff0e046 Compare June 21, 2021 23:49
@jyn514
Copy link
Member Author

jyn514 commented Jun 21, 2021

@bors r=CraftSpider

Thanks for the review!

@bors
Copy link
Collaborator

bors commented Jun 21, 2021

📌 Commit ff0e046 has been approved by CraftSpider

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 21, 2021
fee1-dead added a commit to fee1-dead-contrib/rust that referenced this pull request Jun 22, 2021
Cleanup handling of `crate_name` for doctests

- Remove unnecessary reallocation
- Remove unnecessary messing around with `queries` for the crate name; it's simpler and faster to go through the TyCtxt instead
- Rename `cratename` -> `crate_name` for consistency with the rest of the compiler
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Jun 22, 2021
Cleanup handling of `crate_name` for doctests

- Remove unnecessary reallocation
- Remove unnecessary messing around with `queries` for the crate name; it's simpler and faster to go through the TyCtxt instead
- Rename `cratename` -> `crate_name` for consistency with the rest of the compiler
This was referenced Jun 22, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 22, 2021
Rollup of 6 pull requests

Successful merges:

 - rust-lang#86393 (Add regression test for issue rust-lang#52025)
 - rust-lang#86402 (rustdoc: add optional woff2 versions of Source Serif and Source Code)
 - rust-lang#86451 (Resolve intra-doc links in summary desc)
 - rust-lang#86501 (Cleanup handling of `crate_name` for doctests)
 - rust-lang#86517 (Fix `unused_unsafe` around `await`)
 - rust-lang#86537 (Mark some edition tests as check-pass)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8af9339 into rust-lang:master Jun 22, 2021
@rustbot rustbot added this to the 1.55.0 milestone Jun 22, 2021
@jyn514 jyn514 deleted the doctest-cleanup branch June 22, 2021 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-doctests Area: Documentation tests, run by rustdoc C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

6 participants