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

Rollup of 11 pull requests #129691

Merged
merged 28 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d7e7886
docs: correct panic conditions for rem_euclid and similar functions
lolbinarycat Aug 23, 2024
a772db4
ub_checks intrinsics: fall back to cfg(ub_checks)
RalfJung Aug 25, 2024
7ea2981
const-eval: do not make UbChecks behavior depend on current crate's f…
RalfJung Aug 26, 2024
7a290fc
interpret: do not make const-eval query result depend on tcx.sess
RalfJung Aug 26, 2024
a1746b4
rustdoc: fix missing resource suffix on `crates.js`
notriddle Aug 27, 2024
1ad218f
safe transmute: Rename `BikeshedIntrinsicFrom` to `TransmuteFrom`
jswrenn Aug 27, 2024
c3000ad
add repr to the allowlist for naked functions, and test that it works
jdonszelmann Aug 22, 2024
a507ec6
add uitest for naked functions and the repr attr on functions
jdonszelmann Aug 27, 2024
e17be95
interpret: add missing alignment check in raw_eq
RalfJung Aug 27, 2024
0d6c915
Fix Pin::set bounds regression
coolreader18 Aug 27, 2024
ddcb073
replace is_some() -> unwrap with if let
Aug 27, 2024
b218623
cleanup make_input
Aug 27, 2024
a007d34
clarify a few things
Aug 27, 2024
c35e01e
clarify what term can be
Aug 27, 2024
f61f34f
coverage: `CodeRegion` is never stored in an arena
Zalathar Aug 28, 2024
5e162a8
coverage: Simplify some debug logging
Zalathar Aug 28, 2024
46e1b5b
coverage: Rename `CodeRegion` to `SourceRegion`
Zalathar Aug 28, 2024
99453ce
Rollup merge of #129421 - jdonszelmann:naked-repr-align-functions, r=…
matthiaskrgr Aug 28, 2024
56ca2e2
Rollup merge of #129480 - lolbinarycat:euclid-docs, r=joboet
matthiaskrgr Aug 28, 2024
0156208
Rollup merge of #129551 - RalfJung:ub-checks-fallback, r=saethlin
matthiaskrgr Aug 28, 2024
3456b1d
Rollup merge of #129608 - RalfJung:const-eval-ub-checks, r=saethlin
matthiaskrgr Aug 28, 2024
39e840f
Rollup merge of #129613 - RalfJung:interpret-target-feat, r=saethlin
matthiaskrgr Aug 28, 2024
5725119
Rollup merge of #129641 - notriddle:notriddle/missing-crates-js-resou…
matthiaskrgr Aug 28, 2024
29188a5
Rollup merge of #129657 - jswrenn:transmute-name, r=compiler-errors
matthiaskrgr Aug 28, 2024
5c2996d
Rollup merge of #129666 - RalfJung:raw-eq-align, r=compiler-errors
matthiaskrgr Aug 28, 2024
472c964
Rollup merge of #129667 - dev-ardi:rustc_driver-cleanup, r=michaelwoe…
matthiaskrgr Aug 28, 2024
27d7fb0
Rollup merge of #129668 - coolreader18:fix-pin-set-regr, r=dtolnay
matthiaskrgr Aug 28, 2024
4854fa7
Rollup merge of #129686 - Zalathar:source-region, r=compiler-errors
matthiaskrgr Aug 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rustdoc: fix missing resource suffix on crates.js
Fixes a regression introduced in #128252.
  • Loading branch information
notriddle committed Aug 27, 2024
commit a1746b42024685ac0bb1f4735a26735257a4f336
18 changes: 12 additions & 6 deletions src/librustdoc/html/render/write_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ pub(crate) fn write_shared(
let crate_name = krate.name(cx.tcx());
let crate_name = crate_name.as_str(); // rand
let crate_name_json = OrderedJson::serialize(crate_name).unwrap(); // "rand"
let external_crates = hack_get_external_crate_names(&cx.dst)?;
let external_crates = hack_get_external_crate_names(&cx.dst, &cx.shared.resource_suffix)?;
let info = CrateInfo {
src_files_js: SourcesPart::get(cx, &crate_name_json)?,
search_index_js: SearchIndexPart::get(index, &cx.shared.resource_suffix)?,
all_crates: AllCratesPart::get(crate_name_json.clone())?,
all_crates: AllCratesPart::get(crate_name_json.clone(), &cx.shared.resource_suffix)?,
crates_index: CratesIndexPart::get(&crate_name, &external_crates)?,
trait_impl: TraitAliasPart::get(cx, &crate_name_json)?,
type_impl: TypeAliasPart::get(cx, krate, &crate_name_json)?,
Expand Down Expand Up @@ -291,10 +291,13 @@ impl AllCratesPart {
SortedTemplate::from_before_after("window.ALL_CRATES = [", "];")
}

fn get(crate_name_json: OrderedJson) -> Result<PartsAndLocations<Self>, Error> {
fn get(
crate_name_json: OrderedJson,
resource_suffix: &str,
) -> Result<PartsAndLocations<Self>, Error> {
// external hack_get_external_crate_names not needed here, because
// there's no way that we write the search index but not crates.js
let path = PathBuf::from("crates.js");
let path = suffix_path("crates.js", resource_suffix);
Ok(PartsAndLocations::with(path, crate_name_json))
}
}
Expand All @@ -305,8 +308,11 @@ impl AllCratesPart {
///
/// This is to match the current behavior of rustdoc, which allows you to get all crates
/// on the index page, even if --enable-index-page is only passed to the last crate.
fn hack_get_external_crate_names(doc_root: &Path) -> Result<Vec<String>, Error> {
let path = doc_root.join("crates.js");
fn hack_get_external_crate_names(
doc_root: &Path,
resource_suffix: &str,
) -> Result<Vec<String>, Error> {
let path = doc_root.join(suffix_path("crates.js", resource_suffix));
let Ok(content) = fs::read_to_string(&path) else {
// they didn't emit invocation specific, so we just say there were no crates
return Ok(Vec::default());
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/html/render/write_shared/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ use crate::html::render::write_shared::*;
fn hack_external_crate_names() {
let path = tempfile::TempDir::new().unwrap();
let path = path.path();
let crates = hack_get_external_crate_names(&path).unwrap();
let crates = hack_get_external_crate_names(&path, "").unwrap();
assert!(crates.is_empty());
fs::write(path.join("crates.js"), r#"window.ALL_CRATES = ["a","b","c"];"#).unwrap();
let crates = hack_get_external_crate_names(&path).unwrap();
let crates = hack_get_external_crate_names(&path, "").unwrap();
assert_eq!(crates, ["a".to_string(), "b".to_string(), "c".to_string()]);
}

Expand Down Expand Up @@ -60,7 +60,7 @@ fn all_crates_template() {

#[test]
fn all_crates_parts() {
let parts = AllCratesPart::get(OrderedJson::serialize("crate").unwrap()).unwrap();
let parts = AllCratesPart::get(OrderedJson::serialize("crate").unwrap(), "").unwrap();
assert_eq!(&parts.parts[0].0, Path::new("crates.js"));
assert_eq!(&parts.parts[0].1.to_string(), r#""crate""#);
}
Expand Down
1 change: 1 addition & 0 deletions tests/run-make/emit-shared-files/rmake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn main() {
.input("x.rs")
.run();
assert!(Path::new("invocation-only/search-index-xxx.js").exists());
assert!(Path::new("invocation-only/crates-xxx.js").exists());
assert!(Path::new("invocation-only/settings.html").exists());
assert!(Path::new("invocation-only/x/all.html").exists());
assert!(Path::new("invocation-only/x/index.html").exists());
Expand Down
Loading