-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate using
msg_send!
without comma between arguments
- Loading branch information
Showing
8 changed files
with
208 additions
and
5 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
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
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
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
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
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
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,19 @@ | ||
//! Test msg_send! syntax with missing commas. | ||
use icrate::Foundation::NSString; | ||
use objc2::rc::Id; | ||
use objc2::{msg_send, msg_send_bool, msg_send_id, ClassType}; | ||
|
||
fn main() { | ||
let obj: &NSString = &NSString::new(); | ||
|
||
let _: () = unsafe { msg_send![super(obj), a:obj b:obj] }; | ||
let _: () = unsafe { msg_send![super(obj, NSString::class()), a:obj b:obj] }; | ||
let _: () = unsafe { msg_send![obj, a:obj b:obj] }; | ||
|
||
unsafe { msg_send_bool![obj, c:obj d:obj] }; | ||
|
||
let _: Id<NSString> = unsafe { msg_send_id![obj, e:obj f:obj] }; | ||
|
||
// To make the example fail to compile | ||
let _: &'static _ = obj; | ||
} |
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,69 @@ | ||
warning: use of deprecated macro `msg_send_bool`: use a normal msg_send! instead, it will perform the conversion for you | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| unsafe { msg_send_bool![obj, c:obj d:obj] }; | ||
| ^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(deprecated)]` on by default | ||
|
||
warning: use of deprecated macro `objc2::msg_send_bool`: use a normal msg_send! instead, it will perform the conversion for you | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| use objc2::{msg_send, msg_send_bool, msg_send_id, ClassType}; | ||
| ^^^^^^^^^^^^^ | ||
|
||
warning: use of deprecated function `main::__msg_send_missing_comma`: using msg_send! without a comma between arguments is technically not valid macro syntax, and may break in a future version of Rust. You should use the following instead: | ||
msg_send![super(obj), a: obj, b: obj] | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| let _: () = unsafe { msg_send![super(obj), a:obj b:obj] }; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this warning originates in the macro `$crate::__comma_between_args` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
warning: use of deprecated function `main::__msg_send_missing_comma`: using msg_send! without a comma between arguments is technically not valid macro syntax, and may break in a future version of Rust. You should use the following instead: | ||
msg_send![super(obj, NSString::class()), a: obj, b: obj] | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| let _: () = unsafe { msg_send![super(obj, NSString::class()), a:obj b:obj] }; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this warning originates in the macro `$crate::__comma_between_args` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
warning: use of deprecated function `main::__msg_send_missing_comma`: using msg_send! without a comma between arguments is technically not valid macro syntax, and may break in a future version of Rust. You should use the following instead: | ||
msg_send![obj, a: obj, b: obj] | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| let _: () = unsafe { msg_send![obj, a:obj b:obj] }; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this warning originates in the macro `$crate::__comma_between_args` which comes from the expansion of the macro `msg_send` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
warning: use of deprecated function `main::__msg_send_missing_comma`: using msg_send! without a comma between arguments is technically not valid macro syntax, and may break in a future version of Rust. You should use the following instead: | ||
msg_send![obj, c: obj, d: obj] | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| unsafe { msg_send_bool![obj, c:obj d:obj] }; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this warning originates in the macro `$crate::__comma_between_args` which comes from the expansion of the macro `msg_send_bool` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
warning: use of deprecated function `main::__msg_send_missing_comma`: using msg_send_id! without a comma between arguments is technically not valid macro syntax, and may break in a future version of Rust. You should use the following instead: | ||
msg_send_id![obj, e: obj, f: obj] | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| let _: Id<NSString> = unsafe { msg_send_id![obj, e:obj f:obj] }; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: this warning originates in the macro `$crate::__comma_between_args` which comes from the expansion of the macro `msg_send_id` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error[E0716]: temporary value dropped while borrowed | ||
--> ui/msg_send_missing_comma.rs | ||
| | ||
| let obj: &NSString = &NSString::new(); | ||
| ^^^^^^^^^^^^^^^ creates a temporary value which is freed while still in use | ||
... | ||
| let _: &'static _ = obj; | ||
| ---------- type annotation requires that borrow lasts for `'static` | ||
| } | ||
| - temporary value is freed at the end of this statement |