2017-06-12 14:56:01 -05:00
|
|
|
// Regression test for #42602. It used to be that we had
|
|
|
|
// a dep-graph like
|
|
|
|
//
|
|
|
|
// typeck(foo) -> FnOnce -> typeck(bar)
|
|
|
|
//
|
|
|
|
// This was fixed by improving the resolution of the `FnOnce` trait
|
|
|
|
// selection node.
|
|
|
|
|
2017-11-23 07:05:58 -06:00
|
|
|
// revisions:cfail1 cfail2 cfail3
|
2017-06-12 14:56:01 -05:00
|
|
|
// compile-flags:-Zquery-dep-graph
|
2019-07-02 16:30:28 -05:00
|
|
|
// build-pass (FIXME(62277): could be check-pass?)
|
2017-06-12 14:56:01 -05:00
|
|
|
|
|
|
|
#![feature(rustc_attrs)]
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
a::foo();
|
|
|
|
b::bar();
|
|
|
|
}
|
|
|
|
|
|
|
|
mod a {
|
2017-11-23 07:05:58 -06:00
|
|
|
#[cfg(cfail1)]
|
2017-06-12 14:56:01 -05:00
|
|
|
pub fn foo() {
|
|
|
|
let x = vec![1, 2, 3];
|
|
|
|
let v = || ::std::mem::drop(x);
|
|
|
|
v();
|
|
|
|
}
|
2017-11-23 07:05:58 -06:00
|
|
|
|
|
|
|
#[cfg(not(cfail1))]
|
|
|
|
pub fn foo() {
|
|
|
|
let x = vec![1, 2, 3, 4];
|
|
|
|
let v = || ::std::mem::drop(x);
|
|
|
|
v();
|
|
|
|
}
|
2017-06-12 14:56:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
mod b {
|
2017-11-23 07:05:58 -06:00
|
|
|
#[rustc_clean(cfg="cfail2")]
|
|
|
|
#[rustc_clean(cfg="cfail3")]
|
2017-06-12 14:56:01 -05:00
|
|
|
pub fn bar() {
|
|
|
|
let x = vec![1, 2, 3];
|
|
|
|
let v = || ::std::mem::drop(x);
|
|
|
|
v();
|
|
|
|
}
|
|
|
|
}
|