File tree 1 file changed +59
-0
lines changed
1 file changed +59
-0
lines changed Original file line number Diff line number Diff line change @@ -2795,3 +2795,62 @@ fn decouple_same_target_transitive_dep_from_artifact_dep_and_proc_macro() {
2795
2795
)
2796
2796
. run ( ) ;
2797
2797
}
2798
+
2799
+ #[ cargo_test]
2800
+ fn same_target_artifact_dep_sharing ( ) {
2801
+ let target = rustc_host ( ) ;
2802
+ let p = project ( )
2803
+ . file (
2804
+ "Cargo.toml" ,
2805
+ & format ! (
2806
+ r#"
2807
+ [package]
2808
+ name = "foo"
2809
+ version = "0.1.0"
2810
+
2811
+ [dependencies]
2812
+ a = {{ path = "a" }}
2813
+ bar = {{ path = "bar", artifact = "bin", target = "{target}" }}
2814
+ "#
2815
+ ) ,
2816
+ )
2817
+ . file ( "src/lib.rs" , "" )
2818
+ . file (
2819
+ "bar/Cargo.toml" ,
2820
+ r#"
2821
+ [package]
2822
+ name = "bar"
2823
+ version = "0.1.0"
2824
+
2825
+ [dependencies]
2826
+ a = { path = "../a" }
2827
+ "# ,
2828
+ )
2829
+ . file (
2830
+ "bar/src/main.rs" ,
2831
+ r#"
2832
+ fn main() {}
2833
+ "# ,
2834
+ )
2835
+ . file (
2836
+ "a/Cargo.toml" ,
2837
+ r#"
2838
+ [package]
2839
+ name = "a"
2840
+ version = "0.1.0"
2841
+ "# ,
2842
+ )
2843
+ . file ( "a/src/lib.rs" , "" )
2844
+ . build ( ) ;
2845
+ p. cargo ( & format ! ( "build -Z bindeps --target {target}" ) )
2846
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
2847
+ . with_stderr (
2848
+ "\
2849
+ [COMPILING] a v0.1.0 ([CWD]/a)
2850
+ [COMPILING] bar v0.1.0 ([CWD]/bar)
2851
+ [COMPILING] foo v0.1.0 ([CWD])
2852
+ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
2853
+ " ,
2854
+ )
2855
+ . run ( ) ;
2856
+ }
You can’t perform that action at this time.
0 commit comments