Skip to content

Commit 0230a53

Browse files
committed
fixup! Finished implementing proper function check (through FnOnce) and moved tests to new file and updated tests
1 parent 9932870 commit 0230a53

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/test/compile-fail/issue-2392.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,32 +34,35 @@ fn check_expression() -> Obj<Box<FnBox() -> u32>> {
3434

3535
fn main() {
3636
// test variations of function
37+
3738
let o_closure = Obj { closure: || 42, not_closure: 42 };
3839
o_closure.closure(); //~ ERROR no method named `closure` found
39-
//~^ NOTE use `(o_closure.closure)(...)` if you meant to call the function stored in the `closure` field
40+
//~^ NOTE use `(o_closure.closure)(...)` if you meant to call the function stored
4041

4142
o_closure.not_closure(); //~ ERROR no method named `not_closure` found
4243
//~^ NOTE did you mean to write `o_closure.not_closure`?
4344

4445
let o_func = Obj { closure: func, not_closure: 5 };
4546
o_func.closure(); //~ ERROR no method named `closure` found
46-
//~^ NOTE use `(o_func.closure)(...)` if you meant to call the function stored in the `closure` field
47+
//~^ NOTE use `(o_func.closure)(...)` if you meant to call the function stored
4748

4849
let boxed_fn = BoxedObj { boxed_closure: Box::new(func) };
4950
boxed_fn.boxed_closure();//~ ERROR no method named `boxed_closure` found
50-
//~^ NOTE use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
51+
//~^ NOTE use `(boxed_fn.boxed_closure)(...)` if you meant to call the function stored
5152

5253
let boxed_closure = BoxedObj { boxed_closure: Box::new(|| 42_u32) as Box<FnBox() -> u32> };
5354
boxed_closure.boxed_closure();//~ ERROR no method named `boxed_closure` found
54-
//~^ NOTE use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored in the `boxed_closure` field
55+
//~^ NOTE use `(boxed_closure.boxed_closure)(...)` if you meant to call the function stored
5556

5657
// test expression writing in the notes
58+
5759
let w = Wrapper { wrap: o_func };
5860
w.wrap.closure();//~ ERROR no method named `closure` found
59-
//~^ NOTE use `(w.wrap.closure)(...)` if you meant to call the function stored in the `closure` field
61+
//~^ NOTE use `(w.wrap.closure)(...)` if you meant to call the function stored
62+
6063
w.wrap.not_closure();//~ ERROR no method named `not_closure` found
6164
//~^ NOTE did you mean to write `w.wrap.not_closure`?
6265

6366
check_expression().closure();//~ ERROR no method named `closure` found
64-
//~^ NOTE use `(check_expression().closure)(...)` if you meant to call the function stored in the `closure` field
67+
//~^ NOTE use `(check_expression().closure)(...)` if you meant to call the function stored
6568
}

0 commit comments

Comments
 (0)