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(|| ());
|
|
|
|
};
|
2023-06-12 03:55:36 -05:00
|
|
|
bar();
|
2020-06-22 07:57:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo(3u32, || {});
|
|
|
|
}
|