diff options
| author | bors <bors@rust-lang.org> | 2025-08-06 23:23:26 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-08-06 23:23:26 +0000 |
| commit | 6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd (patch) | |
| tree | 7404b3b99695ca9e1343e7ae067f38a3aae59a2a /src | |
| parent | 7d82b83ed57d188ab3f2441a765a6419685a88a3 (diff) | |
| parent | d369a1fe5e7fbf17cc3ed74057928b875fe40ce7 (diff) | |
| download | rust-6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd.tar.gz rust-6bcdcc73bd11568fd85f5a38b58e1eda054ad1cd.zip | |
Auto merge of #145020 - GuillaumeGomez:rollup-5prs9kw, r=GuillaumeGomez
Rollup of 15 pull requests Successful merges: - rust-lang/rust#144195 (Parser: Recover from attributes applied to types and generic args) - rust-lang/rust#144794 (Port `#[coroutine]` to the new attribute system) - rust-lang/rust#144835 (Anonymize binders in tail call sig) - rust-lang/rust#144861 (Stabilize `panic_payload_as_str` feature) - rust-lang/rust#144917 (Enforce tail call type is related to body return type in borrowck) - rust-lang/rust#144948 (we only merge candidates for trait and normalizes-to goals) - rust-lang/rust#144956 (Gate const trait syntax) - rust-lang/rust#144970 (rustdoc: fix caching of intra-doc links on reexports) - rust-lang/rust#144972 (add code example showing that file_prefix treats dotfiles as the name of a file, not an extension) - rust-lang/rust#144975 (`File::set_times`: Update documentation and example to support setting timestamps on directories) - rust-lang/rust#144977 (Fortify generic param default checks) - rust-lang/rust#144996 (simplifycfg: Mark as changed when start is modified in collapse goto chain) - rust-lang/rust#144998 (mir: Do not modify NonUse in `super_projection_elem`) - rust-lang/rust#145000 (Remove unneeded `stage` parameter when setting up stdlib Cargo) - rust-lang/rust#145008 (Fix rustdoc scrape examples crash) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
| -rw-r--r-- | src/bootstrap/src/core/build_steps/check.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/clippy.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 12 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/doc.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/clean/types.rs | 20 | ||||
| -rw-r--r-- | src/librustdoc/config.rs | 3 | ||||
| -rw-r--r-- | src/librustdoc/passes/collect_intra_doc_links.rs | 7 | ||||
| -rw-r--r-- | src/librustdoc/scrape_examples.rs | 7 |
9 files changed, 40 insertions, 19 deletions
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs index f6653ed899b..f931aae3c2e 100644 --- a/src/bootstrap/src/core/build_steps/check.rs +++ b/src/bootstrap/src/core/build_steps/check.rs @@ -84,7 +84,7 @@ impl Step for Std { Kind::Check, ); - std_cargo(builder, target, stage, &mut cargo); + std_cargo(builder, target, &mut cargo); if matches!(builder.config.cmd, Subcommand::Fix) { // By default, cargo tries to fix all targets. Tell it not to fix tests until we've added `test` to the sysroot. cargo.arg("--lib"); @@ -125,7 +125,7 @@ impl Step for Std { Kind::Check, ); - std_cargo(builder, target, build_compiler.stage, &mut cargo); + std_cargo(builder, target, &mut cargo); // Explicitly pass -p for all dependencies krates -- this will force cargo // to also check the tests/benches/examples for these crates, rather diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs index b119f2dc3ce..93c767bdd25 100644 --- a/src/bootstrap/src/core/build_steps/clippy.rs +++ b/src/bootstrap/src/core/build_steps/clippy.rs @@ -154,7 +154,7 @@ impl Step for Std { Kind::Clippy, ); - std_cargo(builder, target, compiler.stage, &mut cargo); + std_cargo(builder, target, &mut cargo); for krate in &*self.crates { cargo.arg("-p").arg(krate); diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 95707e37018..7039f31cdde 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -269,7 +269,7 @@ impl Step for Std { target, Kind::Build, ); - std_cargo(builder, target, compiler.stage, &mut cargo); + std_cargo(builder, target, &mut cargo); for krate in &*self.crates { cargo.arg("-p").arg(krate); } @@ -497,7 +497,7 @@ fn compiler_rt_for_profiler(builder: &Builder<'_>) -> PathBuf { /// Configure cargo to compile the standard library, adding appropriate env vars /// and such. -pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, cargo: &mut Cargo) { +pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, cargo: &mut Cargo) { // rustc already ensures that it builds with the minimum deployment // target, so ideally we shouldn't need to do anything here. // @@ -645,12 +645,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car // built with bitcode so that the produced rlibs can be used for both LTO // builds (which use bitcode) and non-LTO builds (which use object code). // So we override the override here! - // - // But we don't bother for the stage 0 compiler because it's never used - // with LTO. - if stage >= 1 { - cargo.rustflag("-Cembed-bitcode=yes"); - } + cargo.rustflag("-Cembed-bitcode=yes"); + if builder.config.rust_lto == RustcLto::Off { cargo.rustflag("-Clto=off"); } diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs index d4539a0eb34..9f3524905d7 100644 --- a/src/bootstrap/src/core/build_steps/doc.rs +++ b/src/bootstrap/src/core/build_steps/doc.rs @@ -722,7 +722,7 @@ fn doc_std( let mut cargo = builder::Cargo::new(builder, compiler, Mode::Std, SourceType::InTree, target, Kind::Doc); - compile::std_cargo(builder, target, compiler.stage, &mut cargo); + compile::std_cargo(builder, target, &mut cargo); cargo .arg("--no-deps") .arg("--target-dir") diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 09d2657b666..b6199c74fb1 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -2858,7 +2858,7 @@ impl Step for Crate { .arg("--manifest-path") .arg(builder.src.join("library/sysroot/Cargo.toml")); } else { - compile::std_cargo(builder, target, compiler.stage, &mut cargo); + compile::std_cargo(builder, target, &mut cargo); } } Mode::Rustc => { diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 782311e593b..26b087feb16 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -480,10 +480,28 @@ impl Item { } } + /// If the item has doc comments from a reexport, returns the item id of that reexport, + /// otherwise returns returns the item id. + /// + /// This is used as a key for caching intra-doc link resolution, + /// to prevent two reexports of the same item from using the same cache. + pub(crate) fn item_or_reexport_id(&self) -> ItemId { + // added documentation on a reexport is always prepended. + self.attrs + .doc_strings + .first() + .map(|x| x.item_id) + .flatten() + .map(ItemId::from) + .unwrap_or(self.item_id) + } + pub(crate) fn links(&self, cx: &Context<'_>) -> Vec<RenderedLink> { use crate::html::format::{href, link_tooltip}; - let Some(links) = cx.cache().intra_doc_links.get(&self.item_id) else { return vec![] }; + let Some(links) = cx.cache().intra_doc_links.get(&self.item_or_reexport_id()) else { + return vec![]; + }; links .iter() .filter_map(|ItemLink { link: s, link_text, page_id: id, fragment }| { diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index fed4296fa22..c52c7236883 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -804,8 +804,7 @@ impl Options { let scrape_examples_options = ScrapeExamplesOptions::new(matches, dcx); let with_examples = matches.opt_strs("with-examples"); - let call_locations = - crate::scrape_examples::load_call_locations(with_examples, dcx, &mut loaded_paths); + let call_locations = crate::scrape_examples::load_call_locations(with_examples, dcx); let doctest_build_args = matches.opt_strs("doctest-build-arg"); let unstable_features = diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index c9fa3a4837f..bcb676cd1f1 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1082,7 +1082,12 @@ impl LinkCollector<'_, '_> { for md_link in preprocessed_markdown_links(&doc) { let link = self.resolve_link(&doc, item, item_id, module_id, &md_link); if let Some(link) = link { - self.cx.cache.intra_doc_links.entry(item.item_id).or_default().insert(link); + self.cx + .cache + .intra_doc_links + .entry(item.item_or_reexport_id()) + .or_default() + .insert(link); } } } diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs index 4d29c74e1eb..9f71d6ae789 100644 --- a/src/librustdoc/scrape_examples.rs +++ b/src/librustdoc/scrape_examples.rs @@ -333,11 +333,14 @@ pub(crate) fn run( pub(crate) fn load_call_locations( with_examples: Vec<String>, dcx: DiagCtxtHandle<'_>, - loaded_paths: &mut Vec<PathBuf>, ) -> AllCallLocations { let mut all_calls: AllCallLocations = FxIndexMap::default(); for path in with_examples { - loaded_paths.push(path.clone().into()); + // FIXME: Figure out why this line is causing this feature to crash in specific contexts. + // Full issue backlog is available here: <https://github.com/rust-lang/rust/pull/144600>. + // + // Can be checked with `tests/run-make/rustdoc-scrape-examples-paths`. + // loaded_paths.push(path.clone().into()); let bytes = match fs::read(&path) { Ok(bytes) => bytes, Err(e) => dcx.fatal(format!("failed to load examples: {e}")), |
