Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with "verify_message" feature #8

Closed
boozook opened this issue Jul 17, 2018 · 1 comment
Closed

Not compatible with "verify_message" feature #8

boozook opened this issue Jul 17, 2018 · 1 comment

Comments

@boozook
Copy link

boozook commented Jul 17, 2018

Not compatible with verify_message feature of rust-objc crate.

To reproduce:

[dependencies.objc]
version = "^0.2"
default-features = false
features = ["verify_message"]

Compilation error example:

error[E0277]: the trait bound `&<Self as value::INSValue>::Value: objc::Encode` is not satisfied
  --> ~/.cargo/registry/src/github.com-1ecc6299db9ec823/objc-foundation-0.1.1/src/value.rs:40:34
   |
40 |               let obj: *mut Self = msg_send![obj, initWithBytes:&value
   |  __________________________________^
41 | |                                                      objCType:encoding.as_ptr()];
   | |________________________________________________________________________________^ the trait `objc::Encode` is not implemented for `&<Self as value::INSValue>::Value`
   |
   = help: consider adding a `where &<Self as value::INSValue>::Value: objc::Encode` bound
   = note: required because of the requirements on the impl of `objc::EncodeArguments` for `(&<Self as value::INSValue>::Value, *const i8)`
   = note: required by `objc::send_message`
   = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
@SSheldon
Copy link
Owner

Hey @fzzr-, I'm not too surprised by this. Message verification is super rough and not ready for wide usage. In this case, it looks like the problem is that we haven't told Rust what the encoding is for pointer types. There's a bit more detail about this in SSheldon/rust-objc#26. Unfortunately, I don't see any way to solve this without specialization.

(#2 is another example of an encoding issue that will trip up message verification.)

I'll close this out because I think it's a bigger issue than for just this crate, but if you have any ideas of how to solve it please comment on SSheldon/rust-objc#26!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants