@@ -5,6 +5,7 @@ use crate::core::compiler::job_queue::JobState;
5
5
use crate :: core:: nightly_features_allowed;
6
6
use crate :: core:: { profiles:: ProfileRoot , PackageId } ;
7
7
use crate :: util:: errors:: { CargoResult , CargoResultExt } ;
8
+ use crate :: util:: interning:: InternedString ;
8
9
use crate :: util:: machine_message:: { self , Message } ;
9
10
use crate :: util:: { self , internal, paths, profile} ;
10
11
use cargo_platform:: Cfg ;
@@ -268,7 +269,8 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
268
269
}
269
270
} )
270
271
. 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 ( ) ;
272
274
let build_script_outputs = Arc :: clone ( & cx. build_script_outputs ) ;
273
275
let id = unit. pkg . package_id ( ) ;
274
276
let output_file = script_run_dir. join ( "output" ) ;
@@ -277,7 +279,8 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
277
279
let host_target_root = cx. files ( ) . host_dest ( ) . to_path_buf ( ) ;
278
280
let all = (
279
281
id,
280
- pkg_name. clone ( ) ,
282
+ pkg_name,
283
+ pkg_descr. clone ( ) ,
281
284
Arc :: clone ( & build_script_outputs) ,
282
285
output_file. clone ( ) ,
283
286
script_out_dir. clone ( ) ,
@@ -395,7 +398,8 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
395
398
paths:: write ( & root_output_file, util:: path2bytes ( & script_out_dir) ?) ?;
396
399
let parsed_output = BuildOutput :: parse (
397
400
& output. stdout ,
398
- & pkg_name,
401
+ pkg_name,
402
+ & pkg_descr,
399
403
& script_out_dir,
400
404
& script_out_dir,
401
405
extra_link_arg,
@@ -415,12 +419,13 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
415
419
// itself to run when we actually end up just discarding what we calculated
416
420
// above.
417
421
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;
419
423
let output = match prev_output {
420
424
Some ( output) => output,
421
425
None => BuildOutput :: parse_file (
422
426
& output_file,
423
- & pkg_name,
427
+ pkg_name,
428
+ & pkg_descr,
424
429
& prev_script_out_dir,
425
430
& script_out_dir,
426
431
extra_link_arg,
@@ -470,7 +475,8 @@ fn insert_warnings_in_build_outputs(
470
475
impl BuildOutput {
471
476
pub fn parse_file (
472
477
path : & Path ,
473
- pkg_name : & str ,
478
+ pkg_name : InternedString ,
479
+ pkg_descr : & str ,
474
480
script_out_dir_when_generated : & Path ,
475
481
script_out_dir : & Path ,
476
482
extra_link_arg : bool ,
@@ -479,6 +485,7 @@ impl BuildOutput {
479
485
BuildOutput :: parse (
480
486
& contents,
481
487
pkg_name,
488
+ pkg_descr,
482
489
script_out_dir_when_generated,
483
490
script_out_dir,
484
491
extra_link_arg,
@@ -489,7 +496,8 @@ impl BuildOutput {
489
496
// The `pkg_name` is used for error messages.
490
497
pub fn parse (
491
498
input : & [ u8 ] ,
492
- pkg_name : & str ,
499
+ pkg_name : InternedString ,
500
+ pkg_descr : & str ,
493
501
script_out_dir_when_generated : & Path ,
494
502
script_out_dir : & Path ,
495
503
extra_link_arg : bool ,
@@ -503,7 +511,7 @@ impl BuildOutput {
503
511
let mut rerun_if_changed = Vec :: new ( ) ;
504
512
let mut rerun_if_env_changed = Vec :: new ( ) ;
505
513
let mut warnings = Vec :: new ( ) ;
506
- let whence = format ! ( "build script of `{}`" , pkg_name ) ;
514
+ let whence = format ! ( "build script of `{}`" , pkg_descr ) ;
507
515
508
516
for line in input. split ( |b| * b == b'\n' ) {
509
517
let line = match str:: from_utf8 ( line) {
@@ -585,10 +593,11 @@ impl BuildOutput {
585
593
// Abort with an error.
586
594
anyhow:: bail!( "Cannot set `RUSTC_BOOTSTRAP={}` from {}.\n \
587
595
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 \
589
597
help: See https://doc.rust-lang.org/cargo/reference/build-scripts.html#rustc-env for details.",
590
598
val,
591
- whence
599
+ whence,
600
+ pkg_name,
592
601
) ;
593
602
}
594
603
} else {
@@ -845,6 +854,7 @@ fn prev_build_output(cx: &mut Context<'_, '_>, unit: &Unit) -> (Option<BuildOutp
845
854
(
846
855
BuildOutput :: parse_file (
847
856
& output_file,
857
+ unit. pkg . name ( ) ,
848
858
& unit. pkg . to_string ( ) ,
849
859
& prev_script_out_dir,
850
860
& script_out_dir,
0 commit comments