@@ -4180,6 +4180,7 @@ fn doc_direct_deps_always_documented() {
41804180#[ cargo_test( nightly, reason = "public-dependency feature is unstable" ) ]
41814181fn doc_with_transitive_private_dependency ( ) {
41824182 // foo -> bar (direct dep) -> baz (private dep of bar, transitive to foo)
4183+ // baz should NOT be documented because it is a private transitive dep.
41834184
41844185 Package :: new ( "baz" , "0.0.1" )
41854186 . file ( "src/lib.rs" , "pub fn baz() {}" )
@@ -4218,7 +4219,6 @@ fn doc_with_transitive_private_dependency() {
42184219[DOWNLOADING] crates ...
42194220[DOWNLOADED] baz v0.0.1 (registry `dummy-registry`)
42204221[DOWNLOADED] bar v0.0.1 (registry `dummy-registry`)
4221- [DOCUMENTING] baz v0.0.1
42224222[CHECKING] baz v0.0.1
42234223[DOCUMENTING] bar v0.0.1
42244224[CHECKING] bar v0.0.1
@@ -4233,7 +4233,7 @@ fn doc_with_transitive_private_dependency() {
42334233
42344234 assert ! ( p. root( ) . join( "target/doc/foo/index.html" ) . is_file( ) ) ;
42354235 assert ! ( p. root( ) . join( "target/doc/bar/index.html" ) . is_file( ) ) ;
4236- assert ! ( p. root( ) . join( "target/doc/baz/index.html" ) . is_file( ) ) ;
4236+ assert ! ( ! p. root( ) . join( "target/doc/baz/index.html" ) . is_file( ) ) ;
42374237}
42384238
42394239#[ cargo_test( nightly, reason = "public-dependency feature is unstable" ) ]
@@ -4290,17 +4290,19 @@ fn doc_mixed_public_private_deps() {
42904290 . join( "target/doc/priv_dep_with_dep/index.html" )
42914291 . is_file( )
42924292 ) ;
4293- assert ! ( p. root( ) . join( "target/doc/transitive/index.html" ) . is_file( ) ) ;
4293+ assert ! ( ! p. root( ) . join( "target/doc/transitive/index.html" ) . is_file( ) ) ;
42944294}
42954295
42964296#[ cargo_test( nightly, reason = "public-dependency feature is unstable" ) ]
42974297fn doc_workspace_member_private_dep ( ) {
42984298 // selected and skipped are both workspace members.
42994299 // selected has a private dep on skipped.
43004300 // skipped has a dep on transitive (a registry crate).
4301- // Running `cargo doc -p selected` currently documents all of them,
4302- // including transitive, because the public-dependency filter treats
4303- // workspace members the same as roots.
4301+ //
4302+ // Running `cargo doc -p selected`, selected is the root so all its
4303+ // direct deps (skipped) are documented. But skipped is not a root,
4304+ // so the public-dependency filter applies: transitive is not marked
4305+ // public by skipped, so it should not be documented.
43044306
43054307 Package :: new ( "transitive" , "0.0.1" )
43064308 . file ( "src/lib.rs" , "pub fn transitive() {}" )
@@ -4350,6 +4352,7 @@ fn doc_workspace_member_private_dep() {
43504352
43514353 assert ! ( p. root( ) . join( "target/doc/selected/index.html" ) . is_file( ) ) ;
43524354 assert ! ( p. root( ) . join( "target/doc/skipped/index.html" ) . is_file( ) ) ;
4353- // transitive is documented under the current behavior
4354- assert ! ( p. root( ) . join( "target/doc/transitive/index.html" ) . is_file( ) ) ;
4355+ // transitive is not documented: skipped is not a root, so the
4356+ // public-dependency filter kicks in and transitive is not public
4357+ assert ! ( !p. root( ) . join( "target/doc/transitive/index.html" ) . is_file( ) ) ;
43554358}
0 commit comments