@@ -15,12 +15,8 @@ LL | fn f1<F>(_: F) where F: Fn(&(), &()) {}
1515 | ^^^^^^^^^^^^ required by this bound in `f1`
1616help: consider borrowing the argument
1717 |
18- LL | f1(|_: &(), _: ()| {});
19- | ~~~
20- help: consider borrowing the argument
21- |
22- LL | f1(|_: (), _: &()| {});
23- | ~~~
18+ LL | f1(|_: &(), _: &()| {});
19+ | ~~~ ~~~
2420
2521error[E0631]: type mismatch in closure arguments
2622 --> $DIR/anonymous-higher-ranked-lifetime.rs:3:5
@@ -39,12 +35,8 @@ LL | fn f2<F>(_: F) where F: for<'a> Fn(&'a (), &()) {}
3935 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f2`
4036help: consider borrowing the argument
4137 |
42- LL | f2(|_: &'a (), _: ()| {});
43- | ~~~~~~
44- help: consider borrowing the argument
45- |
46- LL | f2(|_: (), _: &()| {});
47- | ~~~
38+ LL | f2(|_: &'a (), _: &()| {});
39+ | ~~~~~~ ~~~
4840
4941error[E0631]: type mismatch in closure arguments
5042 --> $DIR/anonymous-higher-ranked-lifetime.rs:4:5
@@ -63,12 +55,8 @@ LL | fn f3<'a, F>(_: F) where F: Fn(&'a (), &()) {}
6355 | ^^^^^^^^^^^^^^^ required by this bound in `f3`
6456help: consider borrowing the argument
6557 |
66- LL | f3(|_: &(), _: ()| {});
67- | ~~~
68- help: consider borrowing the argument
69- |
70- LL | f3(|_: (), _: &()| {});
71- | ~~~
58+ LL | f3(|_: &(), _: &()| {});
59+ | ~~~ ~~~
7260
7361error[E0631]: type mismatch in closure arguments
7462 --> $DIR/anonymous-higher-ranked-lifetime.rs:5:5
@@ -87,12 +75,8 @@ LL | fn f4<F>(_: F) where F: for<'r> Fn(&(), &'r ()) {}
8775 | ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f4`
8876help: consider borrowing the argument
8977 |
90- LL | f4(|_: &(), _: ()| {});
91- | ~~~
92- help: consider borrowing the argument
93- |
94- LL | f4(|_: (), _: &'r ()| {});
95- | ~~~~~~
78+ LL | f4(|_: &(), _: &'r ()| {});
79+ | ~~~ ~~~~~~
9680
9781error[E0631]: type mismatch in closure arguments
9882 --> $DIR/anonymous-higher-ranked-lifetime.rs:6:5
@@ -111,19 +95,17 @@ LL | fn f5<F>(_: F) where F: for<'r> Fn(&'r (), &'r ()) {}
11195 | ^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `f5`
11296help: consider borrowing the argument
11397 |
114- LL | f5(|_: &'r (), _: ()| {});
115- | ~~~~~~
116- help: consider borrowing the argument
117- |
118- LL | f5(|_: (), _: &'r ()| {});
119- | ~~~~~~
98+ LL | f5(|_: &'r (), _: &'r ()| {});
99+ | ~~~~~~ ~~~~~~
120100
121101error[E0631]: type mismatch in closure arguments
122102 --> $DIR/anonymous-higher-ranked-lifetime.rs:7:5
123103 |
124104LL | g1(|_: (), _: ()| {});
125- | ^^ -------------- found signature defined here
126- | |
105+ | ^^ --------------
106+ | | | |
107+ | | | help: consider borrowing the argument: `&()`
108+ | | found signature defined here
127109 | expected due to this
128110 |
129111 = note: expected closure signature `for<'a> fn(&'a (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _`
@@ -133,17 +115,15 @@ note: required by a bound in `g1`
133115 |
134116LL | fn g1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>) {}
135117 | ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g1`
136- help: consider borrowing the argument
137- |
138- LL | g1(|_: &(), _: ()| {});
139- | ~~~
140118
141119error[E0631]: type mismatch in closure arguments
142120 --> $DIR/anonymous-higher-ranked-lifetime.rs:8:5
143121 |
144122LL | g2(|_: (), _: ()| {});
145- | ^^ -------------- found signature defined here
146- | |
123+ | ^^ --------------
124+ | | | |
125+ | | | help: consider borrowing the argument: `&()`
126+ | | found signature defined here
147127 | expected due to this
148128 |
149129 = note: expected closure signature `for<'a> fn(&'a (), for<'a> fn(&'a ())) -> _`
@@ -153,17 +133,15 @@ note: required by a bound in `g2`
153133 |
154134LL | fn g2<F>(_: F) where F: Fn(&(), fn(&())) {}
155135 | ^^^^^^^^^^^^^^^^ required by this bound in `g2`
156- help: consider borrowing the argument
157- |
158- LL | g2(|_: &(), _: ()| {});
159- | ~~~
160136
161137error[E0631]: type mismatch in closure arguments
162138 --> $DIR/anonymous-higher-ranked-lifetime.rs:9:5
163139 |
164140LL | g3(|_: (), _: ()| {});
165- | ^^ -------------- found signature defined here
166- | |
141+ | ^^ --------------
142+ | | | |
143+ | | | help: consider borrowing the argument: `&'s ()`
144+ | | found signature defined here
167145 | expected due to this
168146 |
169147 = note: expected closure signature `for<'s> fn(&'s (), Box<(dyn for<'a> Fn(&'a ()) + 'static)>) -> _`
@@ -173,17 +151,15 @@ note: required by a bound in `g3`
173151 |
174152LL | fn g3<F>(_: F) where F: for<'s> Fn(&'s (), Box<dyn Fn(&())>) {}
175153 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g3`
176- help: consider borrowing the argument
177- |
178- LL | g3(|_: &'s (), _: ()| {});
179- | ~~~~~~
180154
181155error[E0631]: type mismatch in closure arguments
182156 --> $DIR/anonymous-higher-ranked-lifetime.rs:10:5
183157 |
184158LL | g4(|_: (), _: ()| {});
185- | ^^ -------------- found signature defined here
186- | |
159+ | ^^ --------------
160+ | | | |
161+ | | | help: consider borrowing the argument: `&()`
162+ | | found signature defined here
187163 | expected due to this
188164 |
189165 = note: expected closure signature `for<'a> fn(&'a (), for<'r> fn(&'r ())) -> _`
@@ -193,10 +169,6 @@ note: required by a bound in `g4`
193169 |
194170LL | fn g4<F>(_: F) where F: Fn(&(), for<'r> fn(&'r ())) {}
195171 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `g4`
196- help: consider borrowing the argument
197- |
198- LL | g4(|_: &(), _: ()| {});
199- | ~~~
200172
201173error[E0631]: type mismatch in closure arguments
202174 --> $DIR/anonymous-higher-ranked-lifetime.rs:11:5
@@ -215,12 +187,8 @@ LL | fn h1<F>(_: F) where F: Fn(&(), Box<dyn Fn(&())>, &(), fn(&(), &())) {}
215187 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h1`
216188help: consider borrowing the argument
217189 |
218- LL | h1(|_: &(), _: (), _: (), _: ()| {});
219- | ~~~
220- help: consider borrowing the argument
221- |
222- LL | h1(|_: (), _: (), _: &(), _: ()| {});
223- | ~~~
190+ LL | h1(|_: &(), _: (), _: &(), _: ()| {});
191+ | ~~~ ~~~
224192
225193error[E0631]: type mismatch in closure arguments
226194 --> $DIR/anonymous-higher-ranked-lifetime.rs:12:5
@@ -239,12 +207,8 @@ LL | fn h2<F>(_: F) where F: for<'t0> Fn(&(), Box<dyn Fn(&())>, &'t0 (), fn(&(),
239207 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `h2`
240208help: consider borrowing the argument
241209 |
242- LL | h2(|_: &(), _: (), _: (), _: ()| {});
243- | ~~~
244- help: consider borrowing the argument
245- |
246- LL | h2(|_: (), _: (), _: &'t0 (), _: ()| {});
247- | ~~~~~~~
210+ LL | h2(|_: &(), _: (), _: &'t0 (), _: ()| {});
211+ | ~~~ ~~~~~~~
248212
249213error: aborting due to 11 previous errors
250214
0 commit comments