Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions crates/bin/docs_rs_builder/src/docbuilder/rustwide_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1891,6 +1891,7 @@ mod tests {
#[test_case("scsys-macros", Version::new(0, 2, 6))]
#[test_case("scsys-derive", Version::new(0, 2, 6))]
#[test_case("thiserror-impl", Version::new(1, 0, 26))]
#[test_case("contained-macros", Version::new(0, 2, 5))]
#[ignore]
fn test_proc_macro(crate_: &'static str, version: Version) -> Result<()> {
let env = TestEnvironment::new()?;
Expand All @@ -1905,6 +1906,23 @@ mod tests {
.successful
);

// check coverage
let row = block_on_async_with_conn!(env, |mut conn| async {
sqlx::query!(
r#"SELECT cov.total_items
FROM
crates as c
INNER JOIN releases AS r ON c.id = r.crate_id
LEFT OUTER JOIN doc_coverage AS cov ON r.id = cov.release_id
"#
)
.fetch_one(&mut *conn)
.await
.map_err(Into::into)
})?;

assert!(row.total_items.unwrap() > 0);

let storage = env.blocking_storage()?;

// doc archive exists
Expand All @@ -1915,6 +1933,23 @@ mod tests {
let source_archive = source_archive_path(&crate_, &version);
assert!(storage.exists(&source_archive)?);

// test if rustdoc json was created
assert!(
storage
.list_prefix(&format!(
"rustdoc-json/{}/{}/x86_64-unknown-linux-gnu/",
crate_, version
))
.filter_map(|res| res.ok())
.find(|path| {
path.ends_with(&format!(
"{}_{}_x86_64-unknown-linux-gnu_latest.json.zst",
crate_, version
))
})
.is_some()
);

Ok(())
}

Expand Down
14 changes: 10 additions & 4 deletions crates/lib/metadata/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,16 @@ impl Metadata {
.expect("serializing a string should never fail")
.to_string();
cargo_args.push(format!("build.rustflags={rustflags}"));
cargo_args.push("-Zhost-config".into());
cargo_args.push("-Ztarget-applies-to-host".into());
cargo_args.push("--config".into());
cargo_args.push(format!("host.rustflags={rustflags}"));
if !self.proc_macro {
// Proc-macro crates are built only for the host and we deliberately omits
// --target for them, so Cargo already applies build.rustflags to their build.
// Enabling host config instead suppresses build.rustdocflags for that host build,
// dropping custom rustdoc flags and JSON output.
cargo_args.push("-Zhost-config".into());
cargo_args.push("-Ztarget-applies-to-host".into());
cargo_args.push("--config".into());
cargo_args.push(format!("host.rustflags={rustflags}"));
}
}

cargo_args.push("--config".into());
Expand Down
Loading