diff --git a/.sqlx/query-aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42.json b/.sqlx/query-aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42.json new file mode 100644 index 000000000..d6ea91543 --- /dev/null +++ b/.sqlx/query-aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT cov.total_items\n FROM\n crates as c\n INNER JOIN releases AS r ON c.id = r.crate_id\n LEFT OUTER JOIN doc_coverage AS cov ON r.id = cov.release_id\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "total_items", + "type_info": "Int4", + "origin": { + "Table": { + "table": "doc_coverage", + "name": "total_items" + } + } + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + true + ] + }, + "hash": "aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42" +} diff --git a/crates/bin/docs_rs_builder/.sqlx/query-aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42.json b/crates/bin/docs_rs_builder/.sqlx/query-aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42.json new file mode 100644 index 000000000..d6ea91543 --- /dev/null +++ b/crates/bin/docs_rs_builder/.sqlx/query-aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42.json @@ -0,0 +1,26 @@ +{ + "db_name": "PostgreSQL", + "query": "SELECT cov.total_items\n FROM\n crates as c\n INNER JOIN releases AS r ON c.id = r.crate_id\n LEFT OUTER JOIN doc_coverage AS cov ON r.id = cov.release_id\n ", + "describe": { + "columns": [ + { + "ordinal": 0, + "name": "total_items", + "type_info": "Int4", + "origin": { + "Table": { + "table": "doc_coverage", + "name": "total_items" + } + } + } + ], + "parameters": { + "Left": [] + }, + "nullable": [ + true + ] + }, + "hash": "aad790aa7ef85357e7f57c83b21621d5a82ef6a5333a617b1d2fb8631ebe9b42" +} diff --git a/crates/bin/docs_rs_builder/src/docbuilder/rustwide_builder.rs b/crates/bin/docs_rs_builder/src/docbuilder/rustwide_builder.rs index 5ee801d12..80991e406 100644 --- a/crates/bin/docs_rs_builder/src/docbuilder/rustwide_builder.rs +++ b/crates/bin/docs_rs_builder/src/docbuilder/rustwide_builder.rs @@ -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()?; @@ -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 @@ -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(()) } diff --git a/crates/lib/metadata/lib.rs b/crates/lib/metadata/lib.rs index bdc29c2cb..4faad7d2c 100644 --- a/crates/lib/metadata/lib.rs +++ b/crates/lib/metadata/lib.rs @@ -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());