@@ -131,7 +131,7 @@ fn package_feature_unification() {
131
131
".cargo/config.toml" ,
132
132
r#"
133
133
[resolver]
134
- feature-unification = "selected "
134
+ feature-unification = "package "
135
135
"# ,
136
136
)
137
137
. file (
@@ -240,14 +240,21 @@ fn package_feature_unification() {
240
240
p. cargo ( "check -p a -p b" )
241
241
. arg ( "-Zfeature-unification" )
242
242
. masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
243
- . with_status ( 101 )
244
- . with_stderr_contains ( "[ERROR] features were unified" )
243
+ . with_stderr_data (
244
+ str![ [ r#"
245
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
246
+
247
+ "# ] ]
248
+ . unordered ( ) ,
249
+ )
245
250
. run ( ) ;
246
251
p. cargo ( "check" )
247
252
. arg ( "-Zfeature-unification" )
248
253
. masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
249
- . with_status ( 101 )
250
- . with_stderr_contains ( "[ERROR] features were unified" )
254
+ . with_stderr_data ( str![ [ r#"
255
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
256
+
257
+ "# ] ] )
251
258
. run ( ) ;
252
259
// Sanity check that compilation without package feature unification does not work
253
260
p. cargo ( "check -p a -p b" )
@@ -266,7 +273,7 @@ fn package_feature_unification_default_features() {
266
273
".cargo/config.toml" ,
267
274
r#"
268
275
[resolver]
269
- feature-unification = "selected "
276
+ feature-unification = "package "
270
277
"# ,
271
278
)
272
279
. file (
@@ -361,8 +368,13 @@ fn package_feature_unification_default_features() {
361
368
p. cargo ( "check" )
362
369
. arg ( "-Zfeature-unification" )
363
370
. masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
364
- . with_status ( 101 )
365
- . with_stderr_contains ( "[ERROR] features were unified" )
371
+ . with_stderr_data (
372
+ str![ [ r#"
373
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
374
+
375
+ "# ] ]
376
+ . unordered ( ) ,
377
+ )
366
378
. run ( ) ;
367
379
}
368
380
@@ -442,6 +454,30 @@ fn package_feature_unification_weak_dependencies() {
442
454
. file ( "b/src/lib.rs" , "pub use common::b;" )
443
455
. build ( ) ;
444
456
457
+ p. cargo ( "check -p a -p b" )
458
+ . arg ( "-Zfeature-unification" )
459
+ . masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
460
+ . with_stderr_data (
461
+ str![ [ r#"
462
+ [CHECKING] common v0.1.0 ([ROOT]/foo/common)
463
+ [CHECKING] a v0.1.0 ([ROOT]/foo/a)
464
+ [CHECKING] b v0.1.0 ([ROOT]/foo/b)
465
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
466
+
467
+ "# ] ]
468
+ . unordered ( ) ,
469
+ )
470
+ . run ( ) ;
471
+ p. cargo ( "check" )
472
+ . arg ( "-Zfeature-unification" )
473
+ . masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
474
+ . with_stderr_data ( str![ [ r#"
475
+ [CHECKING] common v0.1.0 ([ROOT]/foo/common)
476
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
477
+
478
+ "# ] ] )
479
+ . run ( ) ;
480
+
445
481
// Sanity check that compilation without package feature unification does not work
446
482
p. cargo ( "check -p a -p b" )
447
483
. arg ( "-Zfeature-unification" )
@@ -586,6 +622,34 @@ b v0.1.0 ([ROOT]/foo/b)
586
622
587
623
common v0.1.0 ([ROOT]/foo/common)
588
624
625
+ "# ] ] )
626
+ . run ( ) ;
627
+
628
+ p. cargo ( "tree -e features" )
629
+ . arg ( "-Zfeature-unification" )
630
+ . masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
631
+ . env ( "CARGO_RESOLVER_FEATURE_UNIFICATION" , "package" )
632
+ . with_stdout_data ( str![ [ r#"
633
+ common v0.1.0 ([ROOT]/foo/common)
634
+ a v0.1.0 ([ROOT]/foo/a)
635
+ ├── common feature "a"
636
+ │ └── common v0.1.0 ([ROOT]/foo/common)
637
+ ├── common feature "default"
638
+ │ └── common v0.1.0 ([ROOT]/foo/common)
639
+ ├── outside feature "a"
640
+ │ └── outside v0.1.0
641
+ └── outside feature "default"
642
+ └── outside v0.1.0
643
+ b v0.1.0 ([ROOT]/foo/b)
644
+ ├── common feature "b"
645
+ │ └── common v0.1.0 ([ROOT]/foo/common)
646
+ ├── common feature "default"
647
+ │ └── common v0.1.0 ([ROOT]/foo/common)
648
+ ├── outside feature "b"
649
+ │ └── outside v0.1.0
650
+ └── outside feature "default"
651
+ └── outside v0.1.0
652
+
589
653
"# ] ] )
590
654
. run ( ) ;
591
655
}
@@ -658,6 +722,20 @@ fn cargo_install_ignores_config() {
658
722
[INSTALLED] package `a v0.1.0 ([ROOT]/foo)` (executable `a[EXE]`)
659
723
[WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
660
724
725
+ "# ] ] )
726
+ . run ( ) ;
727
+ cargo_process ( "install --path" )
728
+ . arg ( p. root ( ) )
729
+ . arg ( "-Zfeature-unification" )
730
+ . masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
731
+ . env ( "CARGO_RESOLVER_FEATURE_UNIFICATION" , "package" )
732
+ . with_stderr_data ( str![ [ r#"
733
+ [INSTALLING] a v0.1.0 ([ROOT]/foo)
734
+ [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
735
+ [REPLACING] [ROOT]/home/.cargo/bin/a
736
+ [REPLACED] package `a v0.1.0 ([ROOT]/foo)` with `a v0.1.0 ([ROOT]/foo)` (executable `a`)
737
+ [WARNING] be sure to add `[ROOT]/home/.cargo/bin` to your PATH to be able to run the installed binaries
738
+
661
739
"# ] ] )
662
740
. run ( ) ;
663
741
}
@@ -706,6 +784,7 @@ edition = "2021"
706
784
. build ( ) ;
707
785
708
786
p. cargo ( "fix --edition --allow-no-vcs" )
787
+ . env ( "CARGO_RESOLVER_FEATURE_UNIFICATION" , "package" )
709
788
. arg ( "-Zfeature-unification" )
710
789
. masquerade_as_nightly_cargo ( & [ "feature-unification" ] )
711
790
. with_stderr_data ( str![ [ r#"
0 commit comments