//@ check-pass trait FnOnceForGenericRef: FnOnce(&T) -> Self::FnOutput { type FnOutput; } impl R> FnOnceForGenericRef for F { type FnOutput = R; } struct Data> { value: Option, output: Option, } impl> Data { fn new(value: T, f: D) -> Self { let output = f(&value); Self { value: Some(value), output: Some(output), } } } fn test() { Data::new(String::new(), |_| {}); } fn main() {}