-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//! Test that return types that are not `Encode` are not accepted. | ||
use objc2::{class, msg_send}; | ||
|
||
fn main() { | ||
unsafe { | ||
let cls = class!(NSData); | ||
let _: Vec<u8> = msg_send![cls, new]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0277]: the trait bound `Vec<u8>: Encode` is not satisfied | ||
--> ui/msg_send_not_encode.rs:7:26 | ||
| | ||
7 | let _: Vec<u8> = msg_send![cls, new]; | ||
| ^^^^^^^^^^^^^^^^^^^ the trait `Encode` is not implemented for `Vec<u8>` | ||
| | ||
note: required by a bound in `send_message` | ||
--> $WORKSPACE/objc2/src/message/mod.rs | ||
| | ||
| R: Encode, | ||
| ^^^^^^ required by this bound in `send_message` | ||
= note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//! Test that messages can only be sent to objects. | ||
use objc2::msg_send; | ||
|
||
fn main() { | ||
unsafe { msg_send![1, new] }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
error[E0277]: the trait bound `{integer}: MessageReceiver` is not satisfied | ||
--> ui/msg_send_only_message.rs:5:14 | ||
| | ||
5 | unsafe { msg_send![1, new] }; | ||
| ^^^^^^^^^^^^^^^^^ the trait `MessageReceiver` is not implemented for `{integer}` | ||
| | ||
= help: the following implementations were found: | ||
<&'a T as MessageReceiver> | ||
<&'a mut T as MessageReceiver> | ||
<*const T as MessageReceiver> | ||
<*mut T as MessageReceiver> | ||
and 3 others | ||
= note: this error originates in the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) |