-
-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Simplify doc meta mode #159473
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
Open
notriddle
wants to merge
11
commits into
rust-lang:main
Choose a base branch
from
notriddle:rename-parts-to-dep-meta
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Simplify doc meta mode #159473
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
91131bb
rustdoc: fix `--enable-index-page` with finalize
notriddle a36c898
rustdoc: move CCI tests to run-make
notriddle 6887d4d
rustdoc: write `rmake` scripts to test CCI
notriddle 32f1625
Document the changed doc meta features
notriddle 18d6ebf
Update src/doc/rustdoc/src/unstable-features.md
notriddle ac3994e
Update src/doc/rustdoc/src/unstable-features.md
notriddle c352016
rustdoc: clean up unused `@` build diectives
notriddle e03942b
rustdoc: no `--read-doc-meta-dir` and `--write-doc-meta-dir` at once
notriddle d0fec14
rustdoc: move CCI run-make tests into the directory
notriddle 9d136ed
rustdoc: stop constructing an unneeded synth Crate
notriddle f73cd1e
rustdoc: remove unused code from rmake tests
notriddle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
camelid marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,7 +77,7 @@ use rustc_errors::DiagCtxtHandle; | |
| use rustc_hir::def_id::LOCAL_CRATE; | ||
| use rustc_interface::interface; | ||
| use rustc_middle::ty::TyCtxt; | ||
| use rustc_session::config::{ErrorOutputType, RustcOptGroup, make_crate_type_option}; | ||
| use rustc_session::config::{ErrorOutputType, Input, RustcOptGroup, make_crate_type_option}; | ||
| use rustc_session::{EarlyDiagCtxt, getopts}; | ||
| use rustc_span::{BytePos, Span, SyntaxContext}; | ||
| use tracing::info; | ||
|
|
@@ -772,25 +772,40 @@ fn run_renderer< | |
| /// Renders and writes cross-crate info files, like the search index. This function exists so that | ||
| /// we can run rustdoc without a crate root in the `--merge=finalize` mode. Cross-crate info files | ||
| /// discovered via `--read-doc-meta-dir` are combined and written to the doc root. | ||
| fn run_merge_finalize(opt: config::RenderOptions) -> Result<(), error::Error> { | ||
| fn run_merge_finalize( | ||
| render_options: config::RenderOptions, | ||
| compiler: &interface::Compiler, | ||
| ) -> Result<(), error::Error> { | ||
| assert!( | ||
| opt.should_merge.write_rendered_cci, | ||
| render_options.should_merge.write_rendered_cci, | ||
| "config.rs only allows us to return InputMode::NoInputMergeFinalize if --merge=finalize" | ||
| ); | ||
| assert!( | ||
| !opt.should_merge.read_rendered_cci, | ||
| !render_options.should_merge.read_rendered_cci, | ||
| "config.rs only allows us to return InputMode::NoInputMergeFinalize if --merge=finalize" | ||
| ); | ||
| let crates = html::render::CrateInfo::read_many(&opt.include_parts_dir)?; | ||
| let include_sources = !opt.html_no_source; | ||
| let crates = html::render::CrateInfo::read_many(&render_options.include_parts_dir)?; | ||
| let include_sources = !render_options.html_no_source; | ||
|
|
||
| html::render::write_not_crate_specific( | ||
| &crates, | ||
| &opt.output, | ||
| &opt, | ||
| &opt.themes, | ||
| opt.extension_css.as_deref(), | ||
| &opt.resource_suffix, | ||
| &render_options.output, | ||
| &render_options, | ||
| &render_options.themes, | ||
| render_options.extension_css.as_deref(), | ||
| &render_options.resource_suffix, | ||
| include_sources, | ||
| &crate::html::layout::Layout { | ||
| logo: String::new(), | ||
| favicon: String::new(), | ||
| external_html: render_options.external_html.clone(), | ||
| default_settings: render_options.default_settings.clone(), | ||
| krate: String::new(), | ||
| krate_version: String::new(), | ||
| css_file_extension: render_options.extension_css.clone(), | ||
| scrape_examples_extension: false, | ||
| }, | ||
| &compiler.sess, | ||
| )?; | ||
| Ok(()) | ||
| } | ||
|
|
@@ -834,10 +849,18 @@ fn main_args(early_dcx: &mut EarlyDiagCtxt, at_args: &[String]) { | |
| let input = match input { | ||
| config::InputMode::HasFile(input) => input, | ||
| config::InputMode::NoInputMergeFinalize => { | ||
| let config = core::create_config( | ||
| Input::Str { | ||
| name: rustc_span::FileName::Custom(String::new()), | ||
| input: String::new(), | ||
| }, | ||
| options, | ||
| &render_options, | ||
| ); | ||
| return wrap_return( | ||
| dcx, | ||
| rustc_span::create_session_globals_then(options.edition, &[], None, || { | ||
| run_merge_finalize(render_options) | ||
| interface::run_compiler(config, |compiler| { | ||
| run_merge_finalize(render_options, compiler) | ||
|
Comment on lines
+852
to
+863
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto here, but getting rid of the fake |
||
| .map_err(|e| format!("could not write merged cross-crate info: {e}")) | ||
| }), | ||
| ); | ||
|
|
||
1 change: 1 addition & 0 deletions
1
tests/run-make/rustdoc/merge-cross-crate-info/cargo-transitive-read-write/quebec.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| pub struct Quebec; |
56 changes: 56 additions & 0 deletions
56
tests/run-make/rustdoc/merge-cross-crate-info/cargo-transitive-read-write/rmake.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| //@ needs-target-std | ||
|
|
||
| use run_make_support::{cwd, htmldocck, path, rust_lib_name, rustc, rustdoc}; | ||
|
|
||
| fn main() { | ||
| let parts_out_dir = path("parts"); | ||
| let out_dir = path("out"); | ||
|
|
||
| rustc().input("quebec.rs").crate_name("quebec").crate_type("rlib").run(); | ||
| rustdoc() | ||
| .input("quebec.rs") | ||
| .crate_name("quebec") | ||
| .out_dir(&out_dir) | ||
| .arg("-Zunstable-options") | ||
| .arg(format!("--write-doc-meta-dir={}", parts_out_dir.display())) | ||
| .run(); | ||
| assert!(parts_out_dir.join("quebec.json").exists()); | ||
|
|
||
| rustc() | ||
| .input("tango.rs") | ||
| .crate_name("tango") | ||
| .crate_type("rlib") | ||
| .extern_("quebec", rust_lib_name("quebec")) | ||
| .run(); | ||
| rustdoc() | ||
| .input("tango.rs") | ||
| .crate_name("tango") | ||
| .extern_("quebec", rust_lib_name("quebec")) | ||
| .out_dir(&out_dir) | ||
| .arg("-Zunstable-options") | ||
| .arg(format!("--write-doc-meta-dir={}", parts_out_dir.display())) | ||
| .run(); | ||
| assert!(parts_out_dir.join("tango.json").exists()); | ||
|
|
||
| rustdoc() | ||
| .input("sierra.rs") | ||
| .crate_name("sierra") | ||
| .extern_("tango", rust_lib_name("tango")) | ||
| .library_search_path(cwd()) | ||
| .out_dir(&out_dir) | ||
| .arg("-Zunstable-options") | ||
| .arg(format!("--write-doc-meta-dir={}", parts_out_dir.display())) | ||
| .run(); | ||
| assert!(parts_out_dir.join("sierra.json").exists()); | ||
|
|
||
| rustdoc() | ||
| .arg("-Zunstable-options") | ||
| .out_dir(&out_dir) | ||
| .arg(format!("--read-doc-meta-dir={}", parts_out_dir.display())) | ||
| .arg("--enable-index-page") | ||
| .run(); | ||
|
|
||
| htmldocck().arg(&out_dir).arg("tango.rs").run(); | ||
| htmldocck().arg(&out_dir).arg("quebec.rs").run(); | ||
| htmldocck().arg(&out_dir).arg("sierra.rs").run(); | ||
| } |
5 changes: 0 additions & 5 deletions
5
...nfo/cargo-transitive-read-write/sierra.rs → ...nfo/cargo-transitive-read-write/sierra.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
tests/run-make/rustdoc/merge-cross-crate-info/cargo-transitive-read-write/tango.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| extern crate quebec; | ||
| pub trait Tango {} |
12 changes: 0 additions & 12 deletions
12
...info/kitchen-sink-separate-dirs/indigo.rs → ...info/kitchen-sink-separate-dirs/indigo.rs
|
camelid marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
tests/run-make/rustdoc/merge-cross-crate-info/kitchen-sink-separate-dirs/quebec.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| pub struct Quebec; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.