@@ -641,7 +641,7 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Work> {
641641 rustdoc. arg ( "--cfg" ) . arg ( & format ! ( "feature=\" {}\" " , feat) ) ;
642642 }
643643
644- add_error_format_and_color ( cx, & mut rustdoc, false ) ;
644+ add_error_format_and_color ( cx, & mut rustdoc, unit , false ) ;
645645 add_allow_features ( cx, & mut rustdoc) ;
646646
647647 if let Some ( args) = cx. bcx . extra_args_for ( unit) {
@@ -790,14 +790,29 @@ fn add_allow_features(cx: &Context<'_, '_>, cmd: &mut ProcessBuilder) {
790790/// intercepting messages like rmeta artifacts, etc. rustc includes a
791791/// "rendered" field in the JSON message with the message properly formatted,
792792/// which Cargo will extract and display to the user.
793- fn add_error_format_and_color ( cx : & Context < ' _ , ' _ > , cmd : & mut ProcessBuilder , pipelined : bool ) {
793+ fn add_error_format_and_color (
794+ cx : & Context < ' _ , ' _ > ,
795+ cmd : & mut ProcessBuilder ,
796+ unit : & Unit ,
797+ pipelined : bool ,
798+ ) {
794799 cmd. arg ( "--error-format=json" ) ;
795800 let mut json = String :: from ( "--json=diagnostic-rendered-ansi" ) ;
796801 if pipelined {
797802 // Pipelining needs to know when rmeta files are finished. Tell rustc
798803 // to emit a message that cargo will intercept.
799804 json. push_str ( ",artifacts" ) ;
800805 }
806+ if cx
807+ . bcx
808+ . target_data
809+ . info ( unit. kind )
810+ . supports_json_future_incompat
811+ {
812+ // Emit a future-incompat report (when supported by rustc), so we can report
813+ // future-incompat dependencies to the user
814+ json. push_str ( ",future-incompat" ) ;
815+ }
801816
802817 match cx. bcx . build_config . message_format {
803818 MessageFormat :: Short | MessageFormat :: Json { short : true , .. } => {
@@ -858,7 +873,7 @@ fn build_base_args(
858873 edition. cmd_edition_arg ( cmd) ;
859874
860875 add_path_args ( bcx. ws , unit, cmd) ;
861- add_error_format_and_color ( cx, cmd, cx. rmeta_required ( unit) ) ;
876+ add_error_format_and_color ( cx, cmd, unit , cx. rmeta_required ( unit) ) ;
862877 add_allow_features ( cx, cmd) ;
863878
864879 let mut contains_dy_lib = false ;
@@ -1022,10 +1037,6 @@ fn build_base_args(
10221037 . env ( "RUSTC_BOOTSTRAP" , "1" ) ;
10231038 }
10241039
1025- if bcx. config . cli_unstable ( ) . future_incompat_report {
1026- cmd. arg ( "-Z" ) . arg ( "emit-future-incompat-report" ) ;
1027- }
1028-
10291040 // Add `CARGO_BIN_` environment variables for building tests.
10301041 if unit. target . is_test ( ) || unit. target . is_bench ( ) {
10311042 for bin_target in unit
0 commit comments