Skip to content

Commit 9b2188f

Browse files
committed
Test that having no return type on msg_send doesn't compile
1 parent b77e6f8 commit 9b2188f

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

objc2/tests/compile-tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ fn run_mode(mode: &'static str) {
1818

1919
#[test]
2020
fn compile_test() {
21+
run_mode("ui");
2122
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
use objc2::{class, msg_send};
2+
3+
fn main() {
4+
unsafe {
5+
let cls = class!(NSObject);
6+
let _obj = msg_send![cls, new];
7+
}
8+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0282]: type annotations needed
2+
--> $DIR/msg_send_no_return_type.rs:6:20
3+
|
4+
6 | let _obj = msg_send![cls, new];
5+
| ---- ^^^^^^^^^^^^^^^^^^^ cannot infer type
6+
| |
7+
| consider giving `_obj` a type
8+
|
9+
= note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info)
10+
11+
error: aborting due to previous error
12+
13+
For more information about this error, try `rustc --explain E0282`.

0 commit comments

Comments
 (0)