Skip to content

Can't compile tests/expectations on macOS version 10.12.6 #1004

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

Closed
alexeyzab opened this issue Sep 19, 2017 · 5 comments
Closed

Can't compile tests/expectations on macOS version 10.12.6 #1004

alexeyzab opened this issue Sep 19, 2017 · 5 comments

Comments

@alexeyzab
Copy link
Contributor

After running

cd tests/expectations
cargo test

I get the following error:

error: no rules expected the token `,`
  --> tests/objc_class_method.rs:61:60
   |
61 |             methodWithArg1: intvalue: ::std::os::raw::c_int,
   |                                                            ^

error: aborting due to previous error

error: Could not compile `tests_expectations`.
@fitzgen
Copy link
Member

fitzgen commented Sep 19, 2017

It looks like this is trying to define two properties or something: <prop1>: <prop2>: <type>, or something like that. Probably fall out from the move off of syntex to quote.

Check out the objc related things in src/codegen/mod.rs.

Should be a fairly easy fix for someone with with a mac.

@alexeyzab
Copy link
Contributor Author

@highfive: assign me

@highfive
Copy link

Hey @alexeyzab! Thanks for your interest in working on this issue. It's now assigned to you!

@alexeyzab
Copy link
Contributor Author

The expectations tests compile after I manually do the following edits:

Add !#[feature(type_ascription)] to objc_class_method.rs, objc_method.rs, objc_property_fnptr.rs.
Remove several commas from objc_method.rs, objc_class_method.

As you've mentioned, the commas are added because of something in src/codegen/mod.rs, how about the !#[feature(type_ascription)] part? I am a little bit lost here.

@fitzgen
Copy link
Member

fitzgen commented Sep 21, 2017

Ok, I didn't realize that this was inside the objc crate's msg_send! macro, so ignore everything I said.

It looks like msg_send! doesn't expect any commas between arguments: http://sasheldon.com/rust-objc/objc/macro.msg_send.html

Yet, inside the objc::format_method_call function in src/codegen/mod.rs, we are joining each argument with a comma:

        quote! {
            #( #args ),*
        }

The #(...),* means join with comma, #(...);* would be join with semicolon, #(...)* would be join with no separator.

I think we can just remove that , and join without any separator and then the tests should pass.

alexeyzab added a commit to alexeyzab/rust-bindgen that referenced this issue Sep 23, 2017
WIP, fixes rust-lang#1004.

After looking at how `msg_send!` is supposed to be used, I realized that
we were erroneously passing type signatures to it.

The expectations compile now, but some of them are not formatted properly.
My guess is that `rustfmt` does not know how to format the following:

```
msg_send!(obj, arg1:1 arg2:2 arg3:3)
```

Notice the lack of separatros between `arg`s.
bors-servo pushed a commit that referenced this issue Sep 25, 2017
…itzgen

Make objc-related expectations compile

Fixes #1004.

After looking at how `msg_send!` is supposed to be used, I realized that
we were erroneously passing type signatures to it.

The expectations compile now, but some of them are not formatted properly.
My guess is that `rustfmt` does not know how to format the following:

```
msg_send!(obj, arg1:1 arg2:2 arg3:3)
```

Notice the lack of separatros between the `arg`s.

Any advice on how to proceed here is appreciated.

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

No branches or pull requests

3 participants