]> git.lizzy.rs Git - rust.git/blob - tests/incremental/issue-42602.rs
Migrate `rustc_parse` to derive diagnostics
[rust.git] / tests / incremental / issue-42602.rs
1 // Regression test for #42602. It used to be that we had
2 // a dep-graph like
3 //
4 //     typeck(foo) -> FnOnce -> typeck(bar)
5 //
6 // This was fixed by improving the resolution of the `FnOnce` trait
7 // selection node.
8
9 // revisions:cfail1 cfail2 cfail3
10 // compile-flags:-Zquery-dep-graph
11 // build-pass (FIXME(62277): could be check-pass?)
12
13 #![feature(rustc_attrs)]
14
15 fn main() {
16     a::foo();
17     b::bar();
18 }
19
20 mod a {
21     #[cfg(cfail1)]
22     pub fn foo() {
23         let x = vec![1, 2, 3];
24         let v = || ::std::mem::drop(x);
25         v();
26     }
27
28     #[cfg(not(cfail1))]
29     pub fn foo() {
30         let x = vec![1, 2, 3, 4];
31         let v = || ::std::mem::drop(x);
32         v();
33     }
34 }
35
36 mod b {
37     #[rustc_clean(cfg="cfail2")]
38     #[rustc_clean(cfg="cfail3")]
39     pub fn bar() {
40         let x = vec![1, 2, 3];
41         let v = || ::std::mem::drop(x);
42         v();
43     }
44 }