@@ -5,6 +5,7 @@ use crate::core::compiler::job_queue::JobState;
55use crate :: core:: nightly_features_allowed;
66use crate :: core:: { profiles:: ProfileRoot , PackageId } ;
77use crate :: util:: errors:: { CargoResult , CargoResultExt } ;
8+ use crate :: util:: interning:: InternedString ;
89use crate :: util:: machine_message:: { self , Message } ;
910use crate :: util:: { self , internal, paths, profile} ;
1011use cargo_platform:: Cfg ;
@@ -268,7 +269,8 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
268269 }
269270 } )
270271 . collect :: < Vec < _ > > ( ) ;
271- let pkg_name = unit. pkg . to_string ( ) ;
272+ let pkg_name = unit. pkg . name ( ) ;
273+ let pkg_descr = unit. pkg . to_string ( ) ;
272274 let build_script_outputs = Arc :: clone ( & cx. build_script_outputs ) ;
273275 let id = unit. pkg . package_id ( ) ;
274276 let output_file = script_run_dir. join ( "output" ) ;
@@ -277,7 +279,8 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
277279 let host_target_root = cx. files ( ) . host_dest ( ) . to_path_buf ( ) ;
278280 let all = (
279281 id,
280- pkg_name. clone ( ) ,
282+ pkg_name,
283+ pkg_descr. clone ( ) ,
281284 Arc :: clone ( & build_script_outputs) ,
282285 output_file. clone ( ) ,
283286 script_out_dir. clone ( ) ,
@@ -395,7 +398,8 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
395398 paths:: write ( & root_output_file, util:: path2bytes ( & script_out_dir) ?) ?;
396399 let parsed_output = BuildOutput :: parse (
397400 & output. stdout ,
398- & pkg_name,
401+ pkg_name,
402+ & pkg_descr,
399403 & script_out_dir,
400404 & script_out_dir,
401405 extra_link_arg,
@@ -415,12 +419,13 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
415419 // itself to run when we actually end up just discarding what we calculated
416420 // above.
417421 let fresh = Work :: new ( move |state| {
418- let ( id, pkg_name, build_script_outputs, output_file, script_out_dir) = all;
422+ let ( id, pkg_name, pkg_descr , build_script_outputs, output_file, script_out_dir) = all;
419423 let output = match prev_output {
420424 Some ( output) => output,
421425 None => BuildOutput :: parse_file (
422426 & output_file,
423- & pkg_name,
427+ pkg_name,
428+ & pkg_descr,
424429 & prev_script_out_dir,
425430 & script_out_dir,
426431 extra_link_arg,
@@ -470,7 +475,8 @@ fn insert_warnings_in_build_outputs(
470475impl BuildOutput {
471476 pub fn parse_file (
472477 path : & Path ,
473- pkg_name : & str ,
478+ pkg_name : InternedString ,
479+ pkg_descr : & str ,
474480 script_out_dir_when_generated : & Path ,
475481 script_out_dir : & Path ,
476482 extra_link_arg : bool ,
@@ -479,6 +485,7 @@ impl BuildOutput {
479485 BuildOutput :: parse (
480486 & contents,
481487 pkg_name,
488+ pkg_descr,
482489 script_out_dir_when_generated,
483490 script_out_dir,
484491 extra_link_arg,
@@ -489,7 +496,8 @@ impl BuildOutput {
489496 // The `pkg_name` is used for error messages.
490497 pub fn parse (
491498 input : & [ u8 ] ,
492- pkg_name : & str ,
499+ pkg_name : InternedString ,
500+ pkg_descr : & str ,
493501 script_out_dir_when_generated : & Path ,
494502 script_out_dir : & Path ,
495503 extra_link_arg : bool ,
@@ -503,7 +511,7 @@ impl BuildOutput {
503511 let mut rerun_if_changed = Vec :: new ( ) ;
504512 let mut rerun_if_env_changed = Vec :: new ( ) ;
505513 let mut warnings = Vec :: new ( ) ;
506- let whence = format ! ( "build script of `{}`" , pkg_name ) ;
514+ let whence = format ! ( "build script of `{}`" , pkg_descr ) ;
507515
508516 for line in input. split ( |b| * b == b'\n' ) {
509517 let line = match str:: from_utf8 ( line) {
@@ -585,10 +593,11 @@ impl BuildOutput {
585593 // Abort with an error.
586594 anyhow:: bail!( "Cannot set `RUSTC_BOOTSTRAP={}` from {}.\n \
587595 note: Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project.\n \
588- help: If you're sure you want to do this in your project, use `RUSTC_BOOTSTRAP=1 cargo build` instead.\n \
596+ help: If you're sure you want to do this in your project, use `RUSTC_BOOTSTRAP={} cargo build` instead.\n \
589597 help: See https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-env for details.",
590598 val,
591- whence
599+ whence,
600+ pkg_name,
592601 ) ;
593602 }
594603 } else {
@@ -845,6 +854,7 @@ fn prev_build_output(cx: &mut Context<'_, '_>, unit: &Unit) -> (Option<BuildOutp
845854 (
846855 BuildOutput :: parse_file (
847856 & output_file,
857+ unit. pkg . name ( ) ,
848858 & unit. pkg . to_string ( ) ,
849859 & prev_script_out_dir,
850860 & script_out_dir,
0 commit comments