1 // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Test cases where a changing struct appears in the signature of fns
14 // compile-flags: -Z query-dep-graph
16 #![feature(rustc_attrs)]
18 #![allow(unused_variables)]
22 #[rustc_if_this_changed]
33 // these are valid dependencies
37 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
38 #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path
40 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
41 #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
42 fn do_something(x: WillChange);
45 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
46 #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
47 fn some_fn(x: WillChange) { }
49 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
50 #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
51 fn new_foo(x: u32, y: u32) -> WillChange {
52 WillChange { x: x, y: y }
55 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
56 #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
58 fn new(x: u32, y: u32) -> WillChange { loop { } }
61 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
62 #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
64 fn method(&self, x: u32) { }
67 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
68 #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
74 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR OK
75 #[rustc_then_this_would_need(CollectItem)] //~ ERROR OK
76 fn indirect(x: WillChanges) { }
79 mod invalid_signatures {
82 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
83 #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path
85 fn do_something_else_twice(x: WontChange);
88 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path
89 #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path
90 fn b(x: WontChange) { }
92 #[rustc_then_this_would_need(ItemSignature)] //~ ERROR no path from `WillChange`
93 #[rustc_then_this_would_need(CollectItem)] //~ ERROR no path from `WillChange`