@@ -175,6 +175,7 @@ fn compile<'cfg>(
175
175
let work = if unit. show_warnings ( bcx. config ) {
176
176
replay_output_cache (
177
177
unit. pkg . package_id ( ) ,
178
+ PathBuf :: from ( unit. pkg . manifest_path ( ) ) ,
178
179
& unit. target ,
179
180
cx. files ( ) . message_cache_path ( unit) ,
180
181
cx. bcx . build_config . message_format ,
@@ -219,6 +220,7 @@ fn rustc(cx: &mut Context<'_, '_>, unit: &Unit, exec: &Arc<dyn Executor>) -> Car
219
220
// Prepare the native lib state (extra `-L` and `-l` flags).
220
221
let build_script_outputs = Arc :: clone ( & cx. build_script_outputs ) ;
221
222
let current_id = unit. pkg . package_id ( ) ;
223
+ let manifest_path = PathBuf :: from ( unit. pkg . manifest_path ( ) ) ;
222
224
let build_scripts = cx. build_scripts . get ( unit) . cloned ( ) ;
223
225
224
226
// If we are a binary and the package also contains a library, then we
@@ -316,7 +318,16 @@ fn rustc(cx: &mut Context<'_, '_>, unit: &Unit, exec: &Arc<dyn Executor>) -> Car
316
318
& target,
317
319
mode,
318
320
& mut |line| on_stdout_line ( state, line, package_id, & target) ,
319
- & mut |line| on_stderr_line ( state, line, package_id, & target, & mut output_options) ,
321
+ & mut |line| {
322
+ on_stderr_line (
323
+ state,
324
+ line,
325
+ package_id,
326
+ & manifest_path,
327
+ & target,
328
+ & mut output_options,
329
+ )
330
+ } ,
320
331
)
321
332
. map_err ( verbose_if_simple_exit_code)
322
333
. chain_err ( || format ! ( "could not compile `{}`" , name) ) ?;
@@ -414,6 +425,7 @@ fn link_targets(cx: &mut Context<'_, '_>, unit: &Unit, fresh: bool) -> CargoResu
414
425
let outputs = cx. outputs ( unit) ?;
415
426
let export_dir = cx. files ( ) . export_dir ( ) ;
416
427
let package_id = unit. pkg . package_id ( ) ;
428
+ let manifest_path = PathBuf :: from ( unit. pkg . manifest_path ( ) ) ;
417
429
let profile = unit. profile ;
418
430
let unit_mode = unit. mode ;
419
431
let features = unit. features . iter ( ) . map ( |s| s. to_string ( ) ) . collect ( ) ;
@@ -467,6 +479,7 @@ fn link_targets(cx: &mut Context<'_, '_>, unit: &Unit, fresh: bool) -> CargoResu
467
479
468
480
let msg = machine_message:: Artifact {
469
481
package_id,
482
+ manifest_path,
470
483
target : & target,
471
484
profile : art_profile,
472
485
features,
@@ -618,10 +631,10 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Work> {
618
631
let name = unit. pkg . name ( ) . to_string ( ) ;
619
632
let build_script_outputs = Arc :: clone ( & cx. build_script_outputs ) ;
620
633
let package_id = unit. pkg . package_id ( ) ;
634
+ let manifest_path = PathBuf :: from ( unit. pkg . manifest_path ( ) ) ;
621
635
let target = Target :: clone ( & unit. target ) ;
622
636
let mut output_options = OutputOptions :: new ( cx, unit) ;
623
637
let script_metadata = cx. find_build_script_metadata ( unit) ;
624
-
625
638
Ok ( Work :: new ( move |state| {
626
639
if let Some ( script_metadata) = script_metadata {
627
640
if let Some ( output) = build_script_outputs. lock ( ) . unwrap ( ) . get ( script_metadata) {
@@ -638,7 +651,16 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Work> {
638
651
rustdoc
639
652
. exec_with_streaming (
640
653
& mut |line| on_stdout_line ( state, line, package_id, & target) ,
641
- & mut |line| on_stderr_line ( state, line, package_id, & target, & mut output_options) ,
654
+ & mut |line| {
655
+ on_stderr_line (
656
+ state,
657
+ line,
658
+ package_id,
659
+ & manifest_path,
660
+ & target,
661
+ & mut output_options,
662
+ )
663
+ } ,
642
664
false ,
643
665
)
644
666
. chain_err ( || format ! ( "could not document `{}`" , name) ) ?;
@@ -1139,10 +1161,11 @@ fn on_stderr_line(
1139
1161
state : & JobState < ' _ > ,
1140
1162
line : & str ,
1141
1163
package_id : PackageId ,
1164
+ manifest_path : & std:: path:: Path ,
1142
1165
target : & Target ,
1143
1166
options : & mut OutputOptions ,
1144
1167
) -> CargoResult < ( ) > {
1145
- if on_stderr_line_inner ( state, line, package_id, target, options) ? {
1168
+ if on_stderr_line_inner ( state, line, package_id, manifest_path , target, options) ? {
1146
1169
// Check if caching is enabled.
1147
1170
if let Some ( ( path, cell) ) = & mut options. cache_cell {
1148
1171
// Cache the output, which will be replayed later when Fresh.
@@ -1160,6 +1183,7 @@ fn on_stderr_line_inner(
1160
1183
state : & JobState < ' _ > ,
1161
1184
line : & str ,
1162
1185
package_id : PackageId ,
1186
+ manifest_path : & std:: path:: Path ,
1163
1187
target : & Target ,
1164
1188
options : & mut OutputOptions ,
1165
1189
) -> CargoResult < bool > {
@@ -1300,6 +1324,7 @@ fn on_stderr_line_inner(
1300
1324
// indicating which package it came from and then emit it.
1301
1325
let msg = machine_message:: FromCompiler {
1302
1326
package_id,
1327
+ manifest_path,
1303
1328
target,
1304
1329
message : compiler_message,
1305
1330
}
@@ -1314,6 +1339,7 @@ fn on_stderr_line_inner(
1314
1339
1315
1340
fn replay_output_cache (
1316
1341
package_id : PackageId ,
1342
+ manifest_path : PathBuf ,
1317
1343
target : & Target ,
1318
1344
path : PathBuf ,
1319
1345
format : MessageFormat ,
@@ -1343,7 +1369,14 @@ fn replay_output_cache(
1343
1369
break ;
1344
1370
}
1345
1371
let trimmed = line. trim_end_matches ( & [ '\n' , '\r' ] [ ..] ) ;
1346
- on_stderr_line ( state, trimmed, package_id, & target, & mut options) ?;
1372
+ on_stderr_line (
1373
+ state,
1374
+ trimmed,
1375
+ package_id,
1376
+ & manifest_path,
1377
+ & target,
1378
+ & mut options,
1379
+ ) ?;
1347
1380
line. clear ( ) ;
1348
1381
}
1349
1382
Ok ( ( ) )
0 commit comments