@@ -223,9 +223,15 @@ fn doc_multiple_targets_same_name_lib() {
223223
224224 p. cargo ( "doc --workspace" )
225225 . with_status ( 101 )
226- . with_stderr_contains ( "[..] library `foo_lib` is specified [..]" )
227- . with_stderr_contains ( "[..] `foo v0.1.0[..]` [..]" )
228- . with_stderr_contains ( "[..] `bar v0.1.0[..]` [..]" )
226+ . with_stderr (
227+ "\
228+ error: document output filename collision
229+ The lib `foo_lib` in package `foo v0.1.0 ([ROOT]/foo/foo)` has the same name as \
230+ the lib `foo_lib` in package `bar v0.1.0 ([ROOT]/foo/bar)`.
231+ Only one may be documented at once since they output to the same path.
232+ Consider documenting only one, renaming one, or marking one with `doc = false` in Cargo.toml.
233+ " ,
234+ )
229235 . run ( ) ;
230236}
231237
@@ -265,13 +271,17 @@ fn doc_multiple_targets_same_name() {
265271 . build ( ) ;
266272
267273 p. cargo ( "doc --workspace" )
268- . with_stderr_contains ( "[DOCUMENTING] foo v0.1.0 ([CWD]/foo)" )
269- . with_stderr_contains ( "[DOCUMENTING] bar v0.1.0 ([CWD]/bar)" )
270- . with_stderr_contains ( "[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]" )
274+ . with_status ( 101 )
275+ . with_stderr (
276+ "\
277+ error: document output filename collision
278+ The bin `foo_lib` in package `foo v0.1.0 ([ROOT]/foo/foo)` has the same name as \
279+ the lib `foo_lib` in package `bar v0.1.0 ([ROOT]/foo/bar)`.
280+ Only one may be documented at once since they output to the same path.
281+ Consider documenting only one, renaming one, or marking one with `doc = false` in Cargo.toml.
282+ " ,
283+ )
271284 . run ( ) ;
272- assert ! ( p. root( ) . join( "target/doc" ) . is_dir( ) ) ;
273- let doc_file = p. root ( ) . join ( "target/doc/foo_lib/index.html" ) ;
274- assert ! ( doc_file. is_file( ) ) ;
275285}
276286
277287#[ cargo_test]
@@ -290,29 +300,31 @@ fn doc_multiple_targets_same_name_bin() {
290300 [package]
291301 name = "foo"
292302 version = "0.1.0"
293- [[bin]]
294- name = "foo-cli"
295303 "# ,
296304 )
297- . file ( "foo/src/foo-cli.rs" , "" )
305+ . file ( "foo/src/bin/ foo-cli.rs" , "" )
298306 . file (
299307 "bar/Cargo.toml" ,
300308 r#"
301309 [package]
302310 name = "bar"
303311 version = "0.1.0"
304- [[bin]]
305- name = "foo-cli"
306312 "# ,
307313 )
308- . file ( "bar/src/foo-cli.rs" , "" )
314+ . file ( "bar/src/bin/ foo-cli.rs" , "" )
309315 . build ( ) ;
310316
311317 p. cargo ( "doc --workspace" )
312318 . with_status ( 101 )
313- . with_stderr_contains ( "[..] binary `foo_cli` is specified [..]" )
314- . with_stderr_contains ( "[..] `foo v0.1.0[..]` [..]" )
315- . with_stderr_contains ( "[..] `bar v0.1.0[..]` [..]" )
319+ . with_stderr (
320+ "\
321+ error: document output filename collision
322+ The bin `foo-cli` in package `foo v0.1.0 ([ROOT]/foo/foo)` has the same name as \
323+ the bin `foo-cli` in package `bar v0.1.0 ([ROOT]/foo/bar)`.
324+ Only one may be documented at once since they output to the same path.
325+ Consider documenting only one, renaming one, or marking one with `doc = false` in Cargo.toml.
326+ " ,
327+ )
316328 . run ( ) ;
317329}
318330
@@ -1152,7 +1164,7 @@ fn doc_workspace_open_help_message() {
11521164 . env ( "BROWSER" , "echo" )
11531165 . with_stderr_contains ( "[..] Documenting bar v0.1.0 ([..])" )
11541166 . with_stderr_contains ( "[..] Documenting foo v0.1.0 ([..])" )
1155- . with_stderr_contains ( "[..] Opening [..]/foo /index.html" )
1167+ . with_stderr_contains ( "[..] Opening [..]/bar /index.html" )
11561168 . run ( ) ;
11571169}
11581170
@@ -1378,7 +1390,7 @@ fn doc_private_ws() {
13781390 . file ( "a/src/lib.rs" , "fn p() {}" )
13791391 . file ( "b/Cargo.toml" , & basic_manifest ( "b" , "0.0.1" ) )
13801392 . file ( "b/src/lib.rs" , "fn p2() {}" )
1381- . file ( "b/src/main .rs" , "fn main() {}" )
1393+ . file ( "b/src/bin/b-cli .rs" , "fn main() {}" )
13821394 . build ( ) ;
13831395 p. cargo ( "doc --workspace --bins --lib --document-private-items -v" )
13841396 . with_stderr_contains (
@@ -1388,7 +1400,7 @@ fn doc_private_ws() {
13881400 "[RUNNING] `rustdoc [..] b/src/lib.rs [..]--document-private-items[..]" ,
13891401 )
13901402 . with_stderr_contains (
1391- "[RUNNING] `rustdoc [..] b/src/main .rs [..]--document-private-items[..]" ,
1403+ "[RUNNING] `rustdoc [..] b/src/bin/b-cli .rs [..]--document-private-items[..]" ,
13921404 )
13931405 . run ( ) ;
13941406}
0 commit comments