@@ -360,7 +360,7 @@ fn conflicting_usage() {
360360 authors = []
361361 "# ,
362362 )
363- . file ( "src/lib .rs" , "" )
363+ . file ( "src/main .rs" , "fn main() {} " )
364364 . build ( ) ;
365365
366366 p. cargo ( "build --profile=dev --release" )
@@ -381,6 +381,82 @@ Remove one flag or the other to continue.
381381 error: conflicting usage of --profile=release and --debug
382382The `--debug` flag is the same as `--profile=dev`.
383383Remove one flag or the other to continue.
384+ " ,
385+ )
386+ . run ( ) ;
387+
388+ p. cargo ( "rustc --profile=dev --release" )
389+ . with_stderr (
390+ "\
391+ warning: the `--release` flag should not be specified with the `--profile` flag
392+ The `--release` flag will be ignored.
393+ This was historically accepted, but will become an error in a future release.
394+ [COMPILING] foo [..]
395+ [FINISHED] dev [..]
396+ " ,
397+ )
398+ . run ( ) ;
399+
400+ p. cargo ( "check --profile=dev --release" )
401+ . with_status ( 101 )
402+ . with_stderr (
403+ "\
404+ error: conflicting usage of --profile=dev and --release
405+ The `--release` flag is the same as `--profile=release`.
406+ Remove one flag or the other to continue.
407+ " ,
408+ )
409+ . run ( ) ;
410+
411+ p. cargo ( "check --profile=test --release" )
412+ . with_stderr (
413+ "\
414+ warning: the `--release` flag should not be specified with the `--profile` flag
415+ The `--release` flag will be ignored.
416+ This was historically accepted, but will become an error in a future release.
417+ [CHECKING] foo [..]
418+ [FINISHED] test [..]
419+ " ,
420+ )
421+ . run ( ) ;
422+
423+ // This is OK since the two are the same.
424+ p. cargo ( "rustc --profile=release --release" )
425+ . with_stderr (
426+ "\
427+ [COMPILING] foo [..]
428+ [FINISHED] release [..]
429+ " ,
430+ )
431+ . run ( ) ;
432+
433+ p. cargo ( "build --profile=release --release" )
434+ . with_stderr (
435+ "\
436+ [FINISHED] release [..]
437+ " ,
438+ )
439+ . run ( ) ;
440+
441+ p. cargo ( "install --path . --profile=dev --debug" )
442+ . with_stderr (
443+ "\
444+ [INSTALLING] foo [..]
445+ [FINISHED] dev [..]
446+ [INSTALLING] [..]
447+ [INSTALLED] [..]
448+ [WARNING] be sure to add [..]
449+ " ,
450+ )
451+ . run ( ) ;
452+
453+ p. cargo ( "install --path . --profile=release --debug" )
454+ . with_status ( 101 )
455+ . with_stderr (
456+ "\
457+ error: conflicting usage of --profile=release and --debug
458+ The `--debug` flag is the same as `--profile=dev`.
459+ Remove one flag or the other to continue.
384460" ,
385461 )
386462 . run ( ) ;
0 commit comments