@@ -2670,3 +2670,150 @@ fn decouple_same_target_transitive_dep_from_artifact_dep_lib() {
2670
2670
)
2671
2671
. run ( ) ;
2672
2672
}
2673
+
2674
+ #[ cargo_test]
2675
+ fn issue_10525 ( ) {
2676
+ let target = rustc_host ( ) ;
2677
+ let p = project ( )
2678
+ . file (
2679
+ "Cargo.toml" ,
2680
+ & format ! (
2681
+ r#"
2682
+ [package]
2683
+ name = "mycrate"
2684
+ version = "0.0.0"
2685
+ edition = "2021"
2686
+
2687
+ [dependencies]
2688
+ structopt-derive = {{ path = "structopt-derive" }}
2689
+ mybindep = {{ path = "mybindep", artifact = "bin", target = "{target}" }}
2690
+ "#
2691
+ ) ,
2692
+ )
2693
+ . file (
2694
+ "src/main.rs" ,
2695
+ r#"
2696
+ fn main() {
2697
+ env!("CARGO_BIN_FILE_MYBINDEP");
2698
+ }
2699
+ "# ,
2700
+ )
2701
+ . file (
2702
+ "mybindep/Cargo.toml" ,
2703
+ r#"
2704
+ [package]
2705
+ name = "mybindep"
2706
+ version = "0.0.0"
2707
+ edition = "2021"
2708
+
2709
+ [dependencies]
2710
+ clap_derive = { path = "../clap_derive" }
2711
+ "# ,
2712
+ )
2713
+ . file ( "mybindep/src/main.rs" , "fn main() {}" )
2714
+ . file (
2715
+ "clap_derive/Cargo.toml" ,
2716
+ r#"
2717
+ [package]
2718
+ name = "clap_derive"
2719
+ version = "0.0.0"
2720
+ edition = "2021"
2721
+
2722
+ [dependencies]
2723
+ proc-macro-error = { path = "../proc-macro-error" }
2724
+
2725
+ [lib]
2726
+ proc-macro = true
2727
+ "# ,
2728
+ )
2729
+ . file ( "clap_derive/src/lib.rs" , "" )
2730
+ . file (
2731
+ "structopt-derive/Cargo.toml" ,
2732
+ r#"
2733
+ [package]
2734
+ name = "structopt-derive"
2735
+ version = "0.0.0"
2736
+ edition = "2021"
2737
+
2738
+ [dependencies]
2739
+ syn = { path = "../syn", features = ["parsing"] }
2740
+ proc-macro-error = { path = "../proc-macro-error" }
2741
+
2742
+ [lib]
2743
+ proc-macro = true
2744
+ "# ,
2745
+ )
2746
+ . file (
2747
+ "structopt-derive/src/lib.rs" ,
2748
+ r#"
2749
+ use proc_macro_error::ResultExt;
2750
+
2751
+ fn _parse_structopt_attributes() {
2752
+ Ok::<(), syn::Error>(()).unwrap_or_abort()
2753
+ }
2754
+ "# ,
2755
+ )
2756
+ . file (
2757
+ "proc-macro-error/Cargo.toml" ,
2758
+ r#"
2759
+ [package]
2760
+ name = "proc-macro-error"
2761
+ version = "0.0.0"
2762
+ edition = "2021"
2763
+
2764
+ [dependencies]
2765
+ syn = { path = "../syn" }
2766
+ "# ,
2767
+ )
2768
+ . file (
2769
+ "proc-macro-error/src/lib.rs" ,
2770
+ r#"
2771
+ pub trait ResultExt<T> {
2772
+ fn unwrap_or_abort(self) -> T;
2773
+ }
2774
+
2775
+ impl<T, E: Into<Diagnostic>> ResultExt<T> for Result<T, E> {
2776
+ fn unwrap_or_abort(self) -> T {
2777
+ panic!()
2778
+ }
2779
+ }
2780
+
2781
+ pub struct Diagnostic;
2782
+
2783
+ impl From<syn::Error> for Diagnostic {
2784
+ fn from(_: syn::Error) -> Self {
2785
+ panic!()
2786
+ }
2787
+ }
2788
+ "# ,
2789
+ )
2790
+ . file (
2791
+ "syn/Cargo.toml" ,
2792
+ r#"
2793
+ [package]
2794
+ name = "syn"
2795
+ version = "0.0.0"
2796
+ edition = "2021"
2797
+
2798
+ [features]
2799
+ parsing = []
2800
+ "# ,
2801
+ )
2802
+ . file ( "syn/src/lib.rs" , "pub struct Error;" )
2803
+ . build ( ) ;
2804
+
2805
+ p. cargo ( "build -Z bindeps" )
2806
+ . masquerade_as_nightly_cargo ( & [ "bindeps" ] )
2807
+ . with_stderr_unordered (
2808
+ "\
2809
+ [COMPILING] mycrate v0.0.0 ([CWD])
2810
+ [COMPILING] mybindep v0.0.0 ([CWD]/mybindep)
2811
+ [COMPILING] clap_derive v0.0.0 ([CWD]/clap_derive)
2812
+ [COMPILING] structopt-derive v0.0.0 ([CWD]/structopt-derive)
2813
+ [COMPILING] proc-macro-error v0.0.0 ([CWD]/proc-macro-error)
2814
+ [COMPILING] syn v0.0.0 ([CWD]/syn)
2815
+ [FINISHED] dev [..]
2816
+ " ,
2817
+ )
2818
+ . run ( ) ;
2819
+ }
0 commit comments