1 // Test cases where a changing struct appears in the signature of fns
4 // compile-flags: -Z query-dep-graph -C incremental=tmp/dep-graph-struct-signature
6 #![feature(rustc_attrs)]
8 #![allow(unused_variables)]
12 #[rustc_if_this_changed]
23 // these are valid dependencies
27 #[rustc_then_this_would_need(type_of)] //~ ERROR no path
28 #[rustc_then_this_would_need(associated_item)] //~ ERROR no path
29 #[rustc_then_this_would_need(trait_def)] //~ ERROR no path
31 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
32 fn do_something(x: WillChange);
35 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
36 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
37 fn some_fn(x: WillChange) { }
39 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
40 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
41 fn new_foo(x: u32, y: u32) -> WillChange {
42 WillChange { x: x, y: y }
45 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
47 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
48 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
49 fn new(x: u32, y: u32) -> WillChange { loop { } }
52 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
54 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
55 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
56 fn method(&self, x: u32) { }
60 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
62 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
66 // The fields change, not the type itself.
67 #[rustc_then_this_would_need(type_of)] //~ ERROR no path
68 fn indirect(x: WillChanges) { }
71 mod invalid_signatures {
74 #[rustc_then_this_would_need(type_of)] //~ ERROR no path
76 #[rustc_then_this_would_need(fn_sig)] //~ ERROR no path
77 fn do_something_else_twice(x: WontChange);
80 #[rustc_then_this_would_need(fn_sig)] //~ ERROR no path
81 fn b(x: WontChange) { }
83 #[rustc_then_this_would_need(fn_sig)] //~ ERROR no path from `WillChange`
84 #[rustc_then_this_would_need(typeck)] //~ ERROR no path from `WillChange`