2020-06-22 07:57:03 -05:00
|
|
|
// check-pass
|
2020-07-22 09:03:56 -05:00
|
|
|
// compile-flags:-Zpolymorphize=on
|
2020-06-22 07:57:03 -05:00
|
|
|
|
|
|
|
pub struct OnDrop<F: Fn()>(pub F);
|
|
|
|
|
|
|
|
impl<F: Fn()> Drop for OnDrop<F> {
|
|
|
|
fn drop(&mut self) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn foo<R, S: FnOnce()>(
|
|
|
|
_: R,
|
|
|
|
_: S,
|
|
|
|
) {
|
|
|
|
let bar = || {
|
|
|
|
let _ = OnDrop(|| ());
|
|
|
|
};
|
|
|
|
let _ = bar();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo(3u32, || {});
|
|
|
|
}
|