diff --git a/objc2/tests/ui/msg_send_no_return_type.rs b/objc2/tests/ui/msg_send_no_return_type.rs new file mode 100644 index 000000000..0e51e5a95 --- /dev/null +++ b/objc2/tests/ui/msg_send_no_return_type.rs @@ -0,0 +1,8 @@ +use objc2::{class, msg_send}; + +fn main() { + unsafe { + let cls = class!(NSObject); + let _obj = msg_send![cls, new]; + } +} diff --git a/objc2/tests/ui/msg_send_no_return_type.stderr b/objc2/tests/ui/msg_send_no_return_type.stderr new file mode 100644 index 000000000..ba69aa6d1 --- /dev/null +++ b/objc2/tests/ui/msg_send_no_return_type.stderr @@ -0,0 +1,9 @@ +error[E0282]: type annotations needed + --> $DIR/msg_send_no_return_type.rs:6:20 + | +6 | let _obj = msg_send![cls, new]; + | ---- ^^^^^^^^^^^^^^^^^^^ cannot infer type + | | + | consider giving `_obj` a type + | + = note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info)