@@ -6,8 +6,10 @@ LL | struct Obj<F> where F: FnOnce() -> u32 {
66...
77LL | o_closure.closure();
88 | ^^^^^^^ field, not a method
9+ help: to call the function stored in `closure`, surround the field access with parentheses
910 |
10- = help: use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field
11+ LL | (o_closure.closure)();
12+ | ^ ^
1113
1214error[E0599]: no method named `not_closure` found for type `Obj<[closure@$DIR/issue-2392.rs:39:36: 39:41]>` in the current scope
1315 --> $DIR/issue-2392.rs:42:15
@@ -16,9 +18,9 @@ LL | struct Obj<F> where F: FnOnce() -> u32 {
1618 | -------------------------------------- method `not_closure` not found for this
1719...
1820LL | o_closure.not_closure();
19- | ^^^^^^^^^^^ field, not a method
20- |
21- = help: did you mean to write `o_closure.not_closure` instead of `o_closure.not_closure(...)`?
21+ | ^^^^^^^^^^^-- help: remove the arguments
22+ | |
23+ | field, not a method
2224
2325error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
2426 --> $DIR/issue-2392.rs:46:12
@@ -28,8 +30,10 @@ LL | struct Obj<F> where F: FnOnce() -> u32 {
2830...
2931LL | o_func.closure();
3032 | ^^^^^^^ field, not a method
33+ help: to call the function stored in `closure`, surround the field access with parentheses
3134 |
32- = help: use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field
35+ LL | (o_func.closure)();
36+ | ^ ^
3337
3438error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
3539 --> $DIR/issue-2392.rs:49:14
@@ -39,8 +43,10 @@ LL | struct BoxedObj {
3943...
4044LL | boxed_fn.boxed_closure();
4145 | ^^^^^^^^^^^^^ field, not a method
46+ help: to call the function stored in `boxed_closure`, surround the field access with parentheses
4247 |
43- = help: use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
48+ LL | (boxed_fn.boxed_closure)();
49+ | ^ ^
4450
4551error[E0599]: no method named `boxed_closure` found for type `BoxedObj` in the current scope
4652 --> $DIR/issue-2392.rs:52:19
@@ -50,8 +56,10 @@ LL | struct BoxedObj {
5056...
5157LL | boxed_closure.boxed_closure();
5258 | ^^^^^^^^^^^^^ field, not a method
59+ help: to call the function stored in `boxed_closure`, surround the field access with parentheses
5360 |
54- = help: use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
61+ LL | (boxed_closure.boxed_closure)();
62+ | ^ ^
5563
5664error[E0599]: no method named `closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
5765 --> $DIR/issue-2392.rs:57:12
@@ -61,8 +69,10 @@ LL | struct Obj<F> where F: FnOnce() -> u32 {
6169...
6270LL | w.wrap.closure();
6371 | ^^^^^^^ field, not a method
72+ help: to call the function stored in `closure`, surround the field access with parentheses
6473 |
65- = help: use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field
74+ LL | (w.wrap.closure)();
75+ | ^ ^
6676
6777error[E0599]: no method named `not_closure` found for type `Obj<fn() -> u32 {func}>` in the current scope
6878 --> $DIR/issue-2392.rs:59:12
@@ -71,9 +81,9 @@ LL | struct Obj<F> where F: FnOnce() -> u32 {
7181 | -------------------------------------- method `not_closure` not found for this
7282...
7383LL | w.wrap.not_closure();
74- | ^^^^^^^^^^^ field, not a method
75- |
76- = help: did you mean to write `w.wrap.not_closure` instead of `w.wrap.not_closure(...)`?
84+ | ^^^^^^^^^^^-- help: remove the arguments
85+ | |
86+ | field, not a method
7787
7888error[E0599]: no method named `closure` found for type `Obj<std::boxed::Box<(dyn std::boxed::FnBox<(), Output = u32> + 'static)>>` in the current scope
7989 --> $DIR/issue-2392.rs:62:24
@@ -83,8 +93,10 @@ LL | struct Obj<F> where F: FnOnce() -> u32 {
8393...
8494LL | check_expression().closure();
8595 | ^^^^^^^ field, not a method
96+ help: to call the function stored in `closure`, surround the field access with parentheses
8697 |
87- = help: use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field
98+ LL | (check_expression().closure)();
99+ | ^ ^
88100
89101error[E0599]: no method named `f1` found for type `FuncContainer` in the current scope
90102 --> $DIR/issue-2392.rs:68:31
@@ -94,8 +106,10 @@ LL | struct FuncContainer {
94106...
95107LL | (*self.container).f1(1);
96108 | ^^ field, not a method
109+ help: to call the function stored in `f1`, surround the field access with parentheses
97110 |
98- = help: use `((*self.container).f1)(...)` if you meant to call the function stored in the `f1` field
111+ LL | ((*self.container).f1)(1);
112+ | ^ ^
99113
100114error[E0599]: no method named `f2` found for type `FuncContainer` in the current scope
101115 --> $DIR/issue-2392.rs:69:31
@@ -105,8 +119,10 @@ LL | struct FuncContainer {
105119...
106120LL | (*self.container).f2(1);
107121 | ^^ field, not a method
122+ help: to call the function stored in `f2`, surround the field access with parentheses
108123 |
109- = help: use `((*self.container).f2)(...)` if you meant to call the function stored in the `f2` field
124+ LL | ((*self.container).f2)(1);
125+ | ^ ^
110126
111127error[E0599]: no method named `f3` found for type `FuncContainer` in the current scope
112128 --> $DIR/issue-2392.rs:70:31
@@ -116,8 +132,10 @@ LL | struct FuncContainer {
116132...
117133LL | (*self.container).f3(1);
118134 | ^^ field, not a method
135+ help: to call the function stored in `f3`, surround the field access with parentheses
119136 |
120- = help: use `((*self.container).f3)(...)` if you meant to call the function stored in the `f3` field
137+ LL | ((*self.container).f3)(1);
138+ | ^ ^
121139
122140error: aborting due to 11 previous errors
123141
0 commit comments