@@ -1062,7 +1062,7 @@ fn cargo_to_crate_graph(
10621062 proc_macros,
10631063 cargo,
10641064 pkg_data,
1065- build_data,
1065+ build_data. zip ( Some ( build_scripts . error ( ) . is_some ( ) ) ) ,
10661066 cfg_options. clone ( ) ,
10671067 file_id,
10681068 name,
@@ -1285,7 +1285,7 @@ fn handle_rustc_crates(
12851285 proc_macros,
12861286 rustc_workspace,
12871287 & rustc_workspace[ pkg] ,
1288- build_scripts. get_output ( pkg) ,
1288+ build_scripts. get_output ( pkg) . zip ( Some ( build_scripts . error ( ) . is_some ( ) ) ) ,
12891289 cfg_options. clone ( ) ,
12901290 file_id,
12911291 & rustc_workspace[ tgt] . name ,
@@ -1345,7 +1345,7 @@ fn add_target_crate_root(
13451345 proc_macros : & mut ProcMacroPaths ,
13461346 cargo : & CargoWorkspace ,
13471347 pkg : & PackageData ,
1348- build_data : Option < & BuildScriptOutput > ,
1348+ build_data : Option < ( & BuildScriptOutput , bool ) > ,
13491349 cfg_options : CfgOptions ,
13501350 file_id : FileId ,
13511351 cargo_name : & str ,
@@ -1368,7 +1368,7 @@ fn add_target_crate_root(
13681368 for feature in pkg. active_features . iter ( ) {
13691369 opts. insert_key_value ( sym:: feature. clone ( ) , Symbol :: intern ( feature) ) ;
13701370 }
1371- if let Some ( cfgs) = build_data. as_ref ( ) . map ( |it | & it. cfgs ) {
1371+ if let Some ( cfgs) = build_data. map ( |( it , _ ) | & it. cfgs ) {
13721372 opts. extend ( cfgs. iter ( ) . cloned ( ) ) ;
13731373 }
13741374 opts
@@ -1379,7 +1379,7 @@ fn add_target_crate_root(
13791379 inject_cargo_env ( & mut env) ;
13801380 inject_rustc_tool_env ( & mut env, cargo, cargo_name, kind) ;
13811381
1382- if let Some ( envs) = build_data. map ( |it | & it. envs ) {
1382+ if let Some ( envs) = build_data. map ( |( it , _ ) | & it. envs ) {
13831383 for ( k, v) in envs {
13841384 env. set ( k, v. clone ( ) ) ;
13851385 }
@@ -1396,11 +1396,14 @@ fn add_target_crate_root(
13961396 origin,
13971397 ) ;
13981398 if let TargetKind :: Lib { is_proc_macro : true } = kind {
1399- let proc_macro = match build_data. as_ref ( ) . map ( |it| it. proc_macro_dylib_path . as_ref ( ) ) {
1400- Some ( it) => match it {
1401- Some ( path) => Ok ( ( cargo_name. to_owned ( ) , path. clone ( ) ) ) ,
1402- None => Err ( "proc-macro crate build data is missing dylib path" . to_owned ( ) ) ,
1403- } ,
1399+ let proc_macro = match build_data {
1400+ Some ( ( BuildScriptOutput { proc_macro_dylib_path, .. } , has_errors) ) => {
1401+ match proc_macro_dylib_path {
1402+ Some ( path) => Ok ( ( cargo_name. to_owned ( ) , path. clone ( ) ) ) ,
1403+ None if has_errors => Err ( "failed to build proc-macro" . to_owned ( ) ) ,
1404+ None => Err ( "proc-macro crate build data is missing dylib path" . to_owned ( ) ) ,
1405+ }
1406+ }
14041407 None => Err ( "proc-macro crate is missing its build data" . to_owned ( ) ) ,
14051408 } ;
14061409 proc_macros. insert ( crate_id, proc_macro) ;
0 commit comments