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