We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed61c13 commit 2423ea2Copy full SHA for 2423ea2
src/test/ui/borrowck/issue-103095.rs
@@ -0,0 +1,30 @@
1
+// check-pass
2
+
3
+trait FnOnceForGenericRef<T>: FnOnce(&T) -> Self::FnOutput {
4
+ type FnOutput;
5
+}
6
7
+impl<T, R, F: FnOnce(&T) -> R> FnOnceForGenericRef<T> for F {
8
+ type FnOutput = R;
9
10
11
+struct Data<T, D: FnOnceForGenericRef<T>> {
12
+ value: Option<T>,
13
+ output: Option<D::FnOutput>,
14
15
16
+impl<T, D: FnOnceForGenericRef<T>> Data<T, D> {
17
+ fn new(value: T, f: D) -> Self {
18
+ let output = f(&value);
19
+ Self {
20
+ value: Some(value),
21
+ output: Some(output),
22
+ }
23
24
25
26
+fn test() {
27
+ Data::new(String::new(), |_| {});
28
29
30
+fn main() {}
0 commit comments