Skip to content

JSWhyMagic problems in Stylo #425

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
nnethercote opened this issue Jan 24, 2017 · 5 comments
Closed

JSWhyMagic problems in Stylo #425

nnethercote opened this issue Jan 24, 2017 · 5 comments

Comments

@nnethercote
Copy link

I tried to build Stylo on my Ubuntu 16.10 box. I get the following error:

 0:30.51 error[E0412]: type name `root::JS::JSWhyMagic` is undefined or not in scope
 0:30.51     --> /home/njn/moz/stylo/o64sty/toolkit/library/gtest/rust/./x86_64-unknown-linux-gnu/release/build/style-e7c956a890a30050/out/gecko/structs_release.rs:5896:48
 0:30.51      |
 0:30.51 5896 |             pub why: root::__BindgenUnionField<root::JS::JSWhyMagic>,
 0:30.51      |                                                ^^^^^^^^^^^^^^^^^^^^ undefined or not in scope
 0:30.51      |
 0:30.51      = help: you can import it into scope: `use gecko_bindings::structs::root::JSWhyMagic;`.
 0:30.51
 0:32.79 libdom_media_webm.a.desc
 0:34.31 error[E0204]: the trait `Copy` may not be implemented for this type
 0:34.31     --> /home/njn/moz/stylo/o64sty/toolkit/library/gtest/rust/./x86_64-unknown-linux-gnu/release/build/style-e7c956a890a30050/out/gecko/structs_release.rs:5892:25
 0:34.31      |
 0:34.31 5892 |         #[derive(Debug, Copy)]
 0:34.32      |                         ^^^^ field `why` does not implement `Copy`
 0:34.32
 0:34.66 error: aborting due to previous error

@heycam looked at my generated structs_debug.rs file. He suspects the following problem: "If stylo tries to bindgen types that reference JSWhyMagic, it can fail by generating the JSWhyMagic under the root mod, but trying to reference root::JS::JSWhyMagic."

CC @emilio

@emilio
Copy link
Contributor

emilio commented Jan 24, 2017

Oh, interesting, I'll look into it.

As far as I know we shouldn't be using nothing JSValue related, so as a workaround you can add it to the opaque type list. Indeed, you can pretty much add JS::.* to it I think.

@emilio
Copy link
Contributor

emilio commented Jan 24, 2017

I fixed this drive-by in #436

@fitzgen
Copy link
Member

fitzgen commented Jan 24, 2017

Ha! I was creducing this exact issue over night.

@fitzgen
Copy link
Member

fitzgen commented Jan 24, 2017

And here is the reduced test case:

namespace JS {
class Value;
}
typedef enum JSWhyMagic {} JSWhyMagic;
namespace JS {
class Value {
public:
  void a(JSWhyMagic);
};
}

@emilio
Copy link
Contributor

emilio commented Jan 24, 2017 via email

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

3 participants