@@ -332,6 +332,8 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
332
332
// Need a separate copy for the fresh closure.
333
333
let targets_fresh = targets. clone ( ) ;
334
334
335
+ let env_profile_name = unit. profile . name . to_uppercase ( ) ;
336
+
335
337
// Prepare the unit of "dirty work" which will actually run the custom build
336
338
// command.
337
339
//
@@ -406,15 +408,19 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
406
408
true ,
407
409
)
408
410
. with_context ( || {
409
- let mut build_error_context = format ! ( "failed to run custom build command for `{}`" , pkg_descr) ;
411
+ let mut build_error_context =
412
+ format ! ( "failed to run custom build command for `{}`" , pkg_descr) ;
410
413
411
414
// If we're opting into backtraces, mention that build dependencies' backtraces can
412
415
// be improved by setting a higher debuginfo level.
413
416
if let Ok ( show_backtraces) = std:: env:: var ( "RUST_BACKTRACE" ) {
414
417
if show_backtraces != "0" {
415
- build_error_context. push_str ( "\n \
416
- note: To improve backtraces for build dependencies, make sure full debug info is turned on. \
417
- More details at https://doc.rust-lang.org/cargo/reference/profiles.html#build-dependencies") ;
418
+ build_error_context. push_str ( & format ! (
419
+ "\n \
420
+ note: To improve backtraces for build dependencies, set the \
421
+ CARGO_PROFILE_{env_profile_name}_BUILD_OVERRIDE_DEBUG=true environment \
422
+ variable to enable debug information generation.",
423
+ ) ) ;
418
424
}
419
425
}
420
426
0 commit comments