Skip to content

Fail to generate stylo bindings on Windows #364

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
upsuper opened this issue Dec 27, 2016 · 3 comments · Fixed by #365
Closed

Fail to generate stylo bindings on Windows #364

upsuper opened this issue Dec 27, 2016 · 3 comments · Fixed by #365

Comments

@upsuper
Copy link
Contributor

upsuper commented Dec 27, 2016

RUST_BACKTRACE gave me:

thread '<unnamed>' panicked at 'Couldn't find deduced type', c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\ty.rs:780
stack backtrace:
   0:     0x7ff65fc1738e - _<std..rand..OsRng as rand..Rng>::fill_bytes::h1d3cb513034d245d
   1:     0x7ff65fc14593 - std::panicking::Location::line::h885c12f456fada50
   2:     0x7ff65fc1542d - std::panicking::rust_panic_with_hook::h4cbd7ca63ce1aee9
   3:     0x7ff65ea2e167 - {{inlined-root}}::begin_panic<&str>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:384
   4:     0x7ff65eb80670 - libbindgen::ir::ty::Type::from_clang_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\ty.rs:3
   5:     0x7ff65eb7604b - libbindgen::ir::item::{{impl}}::from_ty_with_id
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1112
   6:     0x7ff65eb75605 - libbindgen::ir::item::{{impl}}::from_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1044
   7:     0x7ff65eb6a498 - libbindgen::ir::function::FunctionSig::from_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\function.rs:215
   8:     0x7ff65eb8099b - libbindgen::ir::ty::Type::from_clang_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\ty.rs:826
   9:     0x7ff65eb7604b - libbindgen::ir::item::{{impl}}::from_ty_with_id
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1112
  10:     0x7ff65eb75605 - libbindgen::ir::item::{{impl}}::from_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1044
  11:     0x7ff65eb72f04 - libbindgen::ir::item::{{impl}}::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:930
  12:     0x7ff65ebd0096 - libbindgen::parse_one
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:675
  13:     0x7ff65ebdbe78 - libbindgen::ir::module::{{impl}}::parse::{{closure}}::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\module.rs:52
  14:     0x7ff65eb4b6d0 - libbindgen::clang::visit_children<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:510
  15:     0x7ffd5de63070 - clang_disposeTranslationUnit
  16:     0x7ffd5de65701 - clang_isTranslationUnit
  17:     0x7ffd5de657b3 - clang_isTranslationUnit
  18:     0x7ffd5de64c7b - clang_isReference
  19:     0x7ffd5de6395b - clang_isDeclaration
  20:     0x7ffd5de6f588 - clang_visitChildren
  21:     0x7ff65edfcdcd - clang_sys::clang_visitChildren
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\clang-sys-0.12.0\src\link.rs:94
  22:     0x7ff65eb4a090 - libbindgen::clang::Cursor::visit<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:327
  23:     0x7ff65ebde8b9 - libbindgen::ir::module::{{impl}}::parse::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\module.rs:51
  24:     0x7ff65eb65d01 - libbindgen::ir::context::BindgenContext::with_module<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\context.rs:979
  25:     0x7ff65eb79db8 - libbindgen::ir::module::{{impl}}::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\module.rs:50
  26:     0x7ff65eb721f4 - libbindgen::ir::item::{{impl}}::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:914
  27:     0x7ff65ebd0096 - libbindgen::parse_one
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:675
  28:     0x7ff65ebdcb91 - libbindgen::parse::{{closure}}::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:708
  29:     0x7ff65eb4c8d0 - libbindgen::clang::visit_children<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:510
  30:     0x7ffd5de63070 - clang_disposeTranslationUnit
  31:     0x7ffd5de65701 - clang_isTranslationUnit
  32:     0x7ffd5de657b3 - clang_isTranslationUnit
  33:     0x7ffd5de63d19 - clang_isDeclaration
  34:     0x7ffd5de6f588 - clang_visitChildren
  35:     0x7ff65edfcdcd - clang_sys::clang_visitChildren
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\clang-sys-0.12.0\src\link.rs:94
  36:     0x7ff65eb498d9 - libbindgen::clang::Cursor::visit<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:327
  37:     0x7ff65ebde842 - libbindgen::parse::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:708
  38:     0x7ff65eb65b68 - libbindgen::ir::context::BindgenContext::with_module<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\context.rs:979
  39:     0x7ff65ebd0486 - libbindgen::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:707
  40:     0x7ff65ebcd9d0 - libbindgen::Bindings::generate
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:572
  41:     0x7ff65ebcb5c9 - libbindgen::Builder::generate
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:355
  42:     0x7ff65e9a18bb - build_script_build::build_gecko::bindings::write_binding_file
                        at C:\mozilla-source\servo\components\style\build_gecko.rs:182
  43:     0x7ff65e9a6981 - build_script_build::build_gecko::bindings::generate_bindings
                        at C:\mozilla-source\servo\components\style\build_gecko.rs:591
  44:     0x7ff65e9abcee - build_script_build::build_gecko::generate::{{closure}}
                        at C:\mozilla-source\servo\components\style\build_gecko.rs:627
  45:     0x7ff65e99a336 - {{inlined-root}}::call_once<(),closure>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panic.rs:256
  46:     0x7ff65e93f1e9 - {{inlined-root}}::do_call<std::panic::AssertUnwindSafe<closure>,()>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:327
  47:     0x7ff65fc19f51 - _rust_maybe_catch_panic
  48:     0x7ff65e93eb78 - {{inlined-root}}::try<(),std::panic::AssertUnwindSafe<closure>>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:303
  49:     0x7ff65e93c76d - {{inlined-root}}::catch_unwind<std::panic::AssertUnwindSafe<closure>,()>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panic.rs:312
  50:     0x7ff65e9ab48e - build_script_build::generate_properties::{{closure}}
  51:     0x7ff65e96d669 - {{inlined-root}}::call_box<(),closure>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\liballoc\boxed.rs:587
  52:     0x7ff65fc1133e - std::sys::thread::Thread::new::h47f2f5af38ea3f4d
  53:     0x7ffd923f8363 - BaseThreadInitThunk
thread '<unnamed>' panicked at 'Couldn't find deduced type', c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\ty.rs:780
stack backtrace:
   0:     0x7ff65fc1738e - _<std..rand..OsRng as rand..Rng>::fill_bytes::h1d3cb513034d245d
   1:     0x7ff65fc14593 - std::panicking::Location::line::h885c12f456fada50
   2:     0x7ff65fc1542d - std::panicking::rust_panic_with_hook::h4cbd7ca63ce1aee9
   3:     0x7ff65ea2e167 - {{inlined-root}}::begin_panic<&str>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:384
   4:     0x7ff65eb80670 - libbindgen::ir::ty::Type::from_clang_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\ty.rs:3
   5:     0x7ff65eb7604b - libbindgen::ir::item::{{impl}}::from_ty_with_id
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1112
   6:     0x7ff65eb75605 - libbindgen::ir::item::{{impl}}::from_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1044
   7:     0x7ff65eb6a498 - libbindgen::ir::function::FunctionSig::from_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\function.rs:215
   8:     0x7ff65eb8099b - libbindgen::ir::ty::Type::from_clang_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\ty.rs:826
   9:     0x7ff65eb7604b - libbindgen::ir::item::{{impl}}::from_ty_with_id
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1112
  10:     0x7ff65eb75605 - libbindgen::ir::item::{{impl}}::from_ty
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:1044
  11:     0x7ff65eb72f04 - libbindgen::ir::item::{{impl}}::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:930
  12:     0x7ff65ebd0096 - libbindgen::parse_one
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:675
  13:     0x7ff65ebdbe78 - libbindgen::ir::module::{{impl}}::parse::{{closure}}::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\module.rs:52
  14:     0x7ff65eb4b6d0 - libbindgen::clang::visit_children<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:510
  15:     0x7ffd5de63070 - clang_disposeTranslationUnit
  16:     0x7ffd5de65701 - clang_isTranslationUnit
  17:     0x7ffd5de657b3 - clang_isTranslationUnit
  18:     0x7ffd5de64c7b - clang_isReference
  19:     0x7ffd5de6395b - clang_isDeclaration
  20:     0x7ffd5de6f588 - clang_visitChildren
  21:     0x7ff65edfcdcd - clang_sys::clang_visitChildren
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\clang-sys-0.12.0\src\link.rs:94
  22:     0x7ff65eb4a090 - libbindgen::clang::Cursor::visit<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:327
  23:     0x7ff65ebde8b9 - libbindgen::ir::module::{{impl}}::parse::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\module.rs:51
  24:     0x7ff65eb65d01 - libbindgen::ir::context::BindgenContext::with_module<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\context.rs:979
  25:     0x7ff65eb79db8 - libbindgen::ir::module::{{impl}}::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\module.rs:50
  26:     0x7ff65eb721f4 - libbindgen::ir::item::{{impl}}::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\item.rs:914
  27:     0x7ff65ebd0096 - libbindgen::parse_one
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:675
  28:     0x7ff65ebdcb91 - libbindgen::parse::{{closure}}::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:708
  29:     0x7ff65eb4c8d0 - libbindgen::clang::visit_children<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:510
  30:     0x7ffd5de63070 - clang_disposeTranslationUnit
  31:     0x7ffd5de65701 - clang_isTranslationUnit
  32:     0x7ffd5de657b3 - clang_isTranslationUnit
  33:     0x7ffd5de63d19 - clang_isDeclaration
  34:     0x7ffd5de6f588 - clang_visitChildren
  35:     0x7ff65edfcdcd - clang_sys::clang_visitChildren
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\clang-sys-0.12.0\src\link.rs:94
  36:     0x7ff65eb498d9 - libbindgen::clang::Cursor::visit<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\clang.rs:327
  37:     0x7ff65ebde842 - libbindgen::parse::{{closure}}
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:708
  38:     0x7ff65eb65b68 - libbindgen::ir::context::BindgenContext::with_module<closure>
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\ir\context.rs:979
  39:     0x7ff65ebd0486 - libbindgen::parse
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:707
  40:     0x7ff65ebcd9d0 - libbindgen::Bindings::generate
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:572
  41:     0x7ff65ebcb5c9 - libbindgen::Builder::generate
                        at c:\mozilla-source\servo\.cargo\registry\src\jiasu.xzqcsaa.nyc.mn-1ecc6299db9ec823\libbindgen-0.1.4\src\lib.rs:355
  42:     0x7ff65e9a368f - build_script_build::build_gecko::bindings::generate_structs
                        at C:\mozilla-source\servo\components\style\build_gecko.rs:424
  43:     0x7ff65e9abd46 - build_script_build::build_gecko::generate::{{closure}}
                        at C:\mozilla-source\servo\components\style\build_gecko.rs:626
  44:     0x7ff65e99a3d6 - {{inlined-root}}::call_once<(),closure>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panic.rs:256
  45:     0x7ff65e93f2b9 - {{inlined-root}}::do_call<std::panic::AssertUnwindSafe<closure>,()>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:327
  46:     0x7ff65fc19f51 - _rust_maybe_catch_panic
  47:     0x7ff65e93ef58 - {{inlined-root}}::try<(),std::panic::AssertUnwindSafe<closure>>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panicking.rs:303
  48:     0x7ff65e93c82d - {{inlined-root}}::catch_unwind<std::panic::AssertUnwindSafe<closure>,()>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\libstd\panic.rs:312
  49:     0x7ff65e9ab76e - build_script_build::generate_properties::{{closure}}
  50:     0x7ff65e96d6e9 - {{inlined-root}}::call_box<(),closure>
                        at C:\bot\slave\stable-dist-rustc-win-msvc-64\build\src\liballoc\boxed.rs:587
  51:     0x7ff65fc1133e - std::sys::thread::Thread::new::h47f2f5af38ea3f4d
  52:     0x7ffd923f8363 - BaseThreadInitThunk
@upsuper
Copy link
Contributor Author

upsuper commented Dec 28, 2016

It seems to be a regression from #352. Removing the code added there resolved this problem.

I guess it happens in some Windows header, so other people are not affected.

@upsuper
Copy link
Contributor Author

upsuper commented Dec 28, 2016

So this happens when auto return type is used with a function template, whose return type is related to its template parameter.

A minimal reproducible example of this assertion is

template<typename T> auto Test(T a) { return a; }

with cargo run -- --no-unstable-rust test.hpp -- -std=c++14.

@upsuper
Copy link
Contributor Author

upsuper commented Dec 28, 2016

Oh, actually, it just doesn't work with function template with auto return type, no matter whether its actualy return type is related to the template parameter. The following code also generates this error:

template<typename T> auto Test() { return 1; }

while removing the template<typename T> part, everything works fine.

It seems to me

template<typename T> int Test() { return 1; }

doesn't generate anything in the output (and it probably shouldn't, either), I think we can skip function templates earlier to bypass this issue.

upsuper added a commit to upsuper-forks/rust-bindgen that referenced this issue Dec 28, 2016
upsuper added a commit to upsuper-forks/rust-bindgen that referenced this issue Dec 28, 2016
bors-servo pushed a commit that referenced this issue Dec 28, 2016
ir: Skip function template earlier.

This fixes #364.

r? @emilio
jethrogb pushed a commit to jethrogb/rust-bindgen that referenced this issue Oct 18, 2019
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

Successfully merging a pull request may close this issue.

1 participant