File tree Expand file tree Collapse file tree 2 files changed +21
-26
lines changed Expand file tree Collapse file tree 2 files changed +21
-26
lines changed Original file line number Diff line number Diff line change @@ -381,30 +381,25 @@ fn get_sysroot_target_libdir(
381
381
bcx. all_kinds
382
382
. iter ( )
383
383
. map ( |& kind| {
384
- Ok ( (
385
- kind,
386
- bcx. target_data
387
- . get_info ( kind)
388
- . ok_or_else ( || {
389
- let target = match kind {
390
- CompileKind :: Host => "host" . to_owned ( ) ,
391
- CompileKind :: Target ( s) => s. short_name ( ) . to_owned ( ) ,
392
- } ;
393
-
394
- let dependency = bcx
395
- . unit_graph
396
- . iter ( )
397
- . find_map ( |( u, _) | ( unit. kind == kind) . then_some ( unit. pkg . summary ( ) . package_id ( ) ) )
398
- . unwrap ( ) ;
399
-
400
- anyhow:: anyhow!(
401
- "could not find specification for target `{target}`.\n \
402
- Dependency `{dependency}` requires to build for target `{target}`."
403
- )
404
- } ) ?
405
- . sysroot_target_libdir
406
- . clone ( ) ,
407
- ) )
384
+ let Some ( info) = bcx. target_data . get_info ( kind) else {
385
+ let target = match kind {
386
+ CompileKind :: Host => "host" . to_owned ( ) ,
387
+ CompileKind :: Target ( s) => s. short_name ( ) . to_owned ( ) ,
388
+ } ;
389
+
390
+ let dependency = bcx
391
+ . unit_graph
392
+ . iter ( )
393
+ . find_map ( |( u, _) | ( u. kind == kind) . then_some ( u. pkg . summary ( ) . package_id ( ) ) )
394
+ . unwrap ( ) ;
395
+
396
+ anyhow:: bail!(
397
+ "could not find specification for target `{target}`.\n \
398
+ Dependency `{dependency}` requires to build for target `{target}`."
399
+ )
400
+ } ;
401
+
402
+ Ok ( ( kind, info. sysroot_target_libdir . clone ( ) ) )
408
403
} )
409
404
. collect ( )
410
405
}
Original file line number Diff line number Diff line change @@ -2900,8 +2900,8 @@ fn check_transitive_artifact_dependency_with_different_target() {
2900
2900
p. cargo ( "check -Z bindeps" )
2901
2901
. masquerade_as_nightly_cargo ( & [ "bindeps" ] )
2902
2902
. with_stderr_contains (
2903
- "error: could not find specification for target \" custom-target\" .\n \
2904
- Dependency `baz v0.0.0` requires to build for target \" custom-target\" .",
2903
+ "error: could not find specification for target ` custom-target` .\n \
2904
+ Dependency `baz v0.0.0 [..] ` requires to build for target ` custom-target` .",
2905
2905
)
2906
2906
. with_status ( 101 )
2907
2907
. run ( ) ;
You can’t perform that action at this time.
0 commit comments