1 // Test cases where a changing struct appears in the signature of fns
5 // compile-flags: -Z query-dep-graph
7 #![feature(rustc_attrs)]
9 #![allow(unused_variables)]
13 #[rustc_if_this_changed]
24 // these are valid dependencies
28 #[rustc_then_this_would_need(type_of)] //~ ERROR no path
29 #[rustc_then_this_would_need(associated_item)] //~ ERROR no path
30 #[rustc_then_this_would_need(trait_def)] //~ ERROR no path
32 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
33 fn do_something(x: WillChange);
36 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
37 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
38 fn some_fn(x: WillChange) { }
40 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
41 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
42 fn new_foo(x: u32, y: u32) -> WillChange {
43 WillChange { x: x, y: y }
46 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
48 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
49 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
50 fn new(x: u32, y: u32) -> WillChange { loop { } }
53 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
55 #[rustc_then_this_would_need(fn_sig)] //~ ERROR OK
56 #[rustc_then_this_would_need(typeck)] //~ ERROR OK
57 fn method(&self, x: u32) { }
61 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
63 #[rustc_then_this_would_need(type_of)] //~ ERROR OK
67 // The fields change, not the type itself.
68 #[rustc_then_this_would_need(type_of)] //~ ERROR no path
69 fn indirect(x: WillChanges) { }
72 mod invalid_signatures {
75 #[rustc_then_this_would_need(type_of)] //~ ERROR no path
77 #[rustc_then_this_would_need(fn_sig)] //~ ERROR no path
78 fn do_something_else_twice(x: WontChange);
81 #[rustc_then_this_would_need(fn_sig)] //~ ERROR no path
82 fn b(x: WontChange) { }
84 #[rustc_then_this_would_need(fn_sig)] //~ ERROR no path from `WillChange`
85 #[rustc_then_this_would_need(typeck)] //~ ERROR no path from `WillChange`