rust-objc
rust-objc copied to clipboard
sel! can no longer be specifically macro_used in versions 0.2.3+
The version 0.2.3 has introduced some changes in the way sel!() is implemented, along with the new sel_impl macro. The changes are indeed backward compatible, but only if the crate which uses objc import all macros. However if the library uses objc and imports the macros in the following way:
#[macro_use(msg_send, sel)]
extern crate objc;
then an update from 0.2.2 to 0.2.3 will produce a compile-time error (sel_impl cannot be found).
Could we consider that the change introduced in 0.2.3 is a breaking change and does it make sense to bump the minor version instead of a patch version, so that if somebody does not experience an unexpected compile time error after updating 0.2.2 to 0.2.3?
@application-developer-DA hmm that's a case I hadn't considered. Is this impacting your project? Do you know of any others and how widespread this is?
From a quick github search, I found this case: https://github.com/meh/cancer/blob/97829c41f0d677cf964f788b548feed38a7ffc56/src/main.rs#L62
@SSheldon the issue affected the project on which I work in the company, I spot the issue and fixed it (the fix was trivial after I checked the repository, changelog and commits for 2.2.3), but I decided to inform you about the issue so that you can decide whether or not to "fix" it and also as a reference for the ones who might have the same problem.
Thanks for the heads up :)
I could look into refactoring the macro to remove the need for sel_impl!, but if you've added it to your macro_use list, that'd just be a breaking change for you again! Wish there was a nicer way to share code in macros...
Sounds like the damage might be done already. Will keep an eye out for it in the future, and knowing about this should make it easy to help out if anyone else runs into the issue.
@SSheldon Read through https://github.com/rust-lang/rust/issues/35896#issuecomment-407836572
From what I understand, you want to mark internal macros as #[macro_export(local_inner_macros)]. This will let #[macro_use(sel)] work as expected in Rust2015 and as expected in Rust2018 as use objc::sel.