Skip to content

"Should have been resolved after parsing" #355

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
jsgf opened this issue Dec 21, 2016 · 5 comments
Closed

"Should have been resolved after parsing" #355

jsgf opened this issue Dec 21, 2016 · 5 comments
Labels

Comments

@jsgf
Copy link
Contributor

jsgf commented Dec 21, 2016

I'm getting a "Should have been resolved after parsing" message from Type::canonical_type(). I printed more detail about the type:

thread 'main' panicked at 'Should have been resolved after parsing! Type { name: Some("category_type"), layout: Some(Layout { size: 1, align: 1, packed: false }), kind: ResolvedTypeRef(ItemId(43009)), is_const: false }', /home/engshare/third-party2/rust-bindgen/HEAD/src/build-centos6-native/build/libbindgen/src/ir/ty.rs:359

This appears to be https://github.com/facebook/folly/blob/master/folly/FBString.h#L598-L604:

  typedef uint8_t category_type;

  enum class Category : category_type {
    isSmall = 0,
    isMedium = kIsLittleEndian ? 0x80 : 0x2,
    isLarge = kIsLittleEndian ? 0x40 : 0x1,
  };
@jsgf
Copy link
Contributor Author

jsgf commented Dec 21, 2016

This is on current rust-bindgen master with #352 applied.

@jsgf
Copy link
Contributor Author

jsgf commented Dec 21, 2016

The backtrace is:

   1:     0x7f67283f020f - std::sys::backtrace::tracing::imp::write::h6f1d53a70916b90d
   2:     0x7f67283f54ed - std::panicking::default_hook::{{closure}}::h137e876f7d3b5850
   3:     0x7f67283f440a - std::panicking::default_hook::h0ac3811ec7cee78c
   4:     0x7f67283f49a8 - std::panicking::rust_panic_with_hook::hc303199e04562edf
   5:     0x7f67283f4842 - std::panicking::begin_panic::h6ed03353807cf54d
   6:     0x7f67283f4780 - std::panicking::begin_panic_fmt::hc321cece241bb2f5
   7:     0x7f6728182571 - libbindgen::ir::enum_ty::Enum::from_ty::h79afcd3700c3375c
   8:     0x7f672818b8d9 - libbindgen::ir::ty::Type::from_clang_ty::h96de7b4df8f64a57
   9:     0x7f6728187d76 - <libbindgen::ir::item::Item as libbindgen::parse::ClangItemParser>::from_ty_with_id::h3b18bde2dfd7e3bb
  10:     0x7f6728186a2f - <libbindgen::ir::item::Item as libbindgen::parse::ClangItemParser>::parse::h748c9a7eee18e573
  11:     0x7f6728172200 - libbindgen::clang::visit_children::h01c4c84a308b4cc9
  12:     0x7f67247d2cd3 - _ZN5clang8cxcursor13CursorVisitor5VisitE8CXCursorb
  13:     0x7f67247d3ca0 - _ZN5clang8cxcursor13CursorVisitor23handleDeclForVisitationEPKNS_4DeclE
  14:     0x7f67247d3dbf - _ZN5clang8cxcursor13CursorVisitor16VisitDeclContextEPNS_11DeclContextE
  15:     0x7f67247d27b8 - _ZN5clang8cxcursor13CursorVisitor13VisitChildrenE8CXCursor
  16:     0x7f67247db7f9 - clang_visitChildren
  17:     0x7f6728381547 - clang_sys::clang_visitChildren::h131b51420ac8c1c5
  18:     0x7f672817903d - libbindgen::ir::comp::CompInfo::from_ty::hae6bdbcf9a788e3f
  19:     0x7f672818cf14 - libbindgen::ir::ty::Type::from_clang_ty::h96de7b4df8f64a57
  20:     0x7f6728187d76 - <libbindgen::ir::item::Item as libbindgen::parse::ClangItemParser>::from_ty_with_id::h3b18bde2dfd7e3bb
  21:     0x7f6728186a2f - <libbindgen::ir::item::Item as libbindgen::parse::ClangItemParser>::parse::h748c9a7eee18e573
  22:     0x7f67281921b6 - libbindgen::parse_one::hb593feb510752b09
  23:     0x7f6728174632 - libbindgen::clang::visit_children::h708f7eb429c329ed
  24:     0x7f67247d2cd3 - _ZN5clang8cxcursor13CursorVisitor5VisitE8CXCursorb
  25:     0x7f67247d3ca0 - _ZN5clang8cxcursor13CursorVisitor23handleDeclForVisitationEPKNS_4DeclE
  26:     0x7f67247d3dbf - _ZN5clang8cxcursor13CursorVisitor16VisitDeclContextEPNS_11DeclContextE
  27:     0x7f67247d27b8 - _ZN5clang8cxcursor13CursorVisitor13VisitChildrenE8CXCursor
  28:     0x7f67247db7f9 - clang_visitChildren
  29:     0x7f6728381547 - clang_sys::clang_visitChildren::h131b51420ac8c1c5
  30:     0x7f6728185f85 - <libbindgen::ir::item::Item as libbindgen::parse::ClangItemParser>::parse::h748c9a7eee18e573
  31:     0x7f67281921b6 - libbindgen::parse_one::hb593feb510752b09
  32:     0x7f67281738c3 - libbindgen::clang::visit_children::h06ec4cfa51eb2752
  33:     0x7f67247d2cd3 - _ZN5clang8cxcursor13CursorVisitor5VisitE8CXCursorb
  34:     0x7f67247d3ca0 - _ZN5clang8cxcursor13CursorVisitor23handleDeclForVisitationEPKNS_4DeclE
  35:     0x7f67247d3dbf - _ZN5clang8cxcursor13CursorVisitor16VisitDeclContextEPNS_11DeclContextE
  36:     0x7f67247d2995 - _ZN5clang8cxcursor13CursorVisitor13VisitChildrenE8CXCursor
  37:     0x7f67247db7f9 - clang_visitChildren
  38:     0x7f6728381547 - clang_sys::clang_visitChildren::h131b51420ac8c1c5
  39:     0x7f672818f787 - libbindgen::Bindings::generate::h6c75a2cba47e7c38
  40:     0x7f672818ecc6 - libbindgen::Builder::generate::h48eeb1e06e93b2f9
  41:     0x7f672813f4f8 - bindgen::main::h9410c5945bb1c695
  42:     0x7f67283fe3c6 - __rust_maybe_catch_panic
  43:     0x7f67283f3c81 - std::rt::lang_start::h538f8960e7644c80
  44:     0x7f6727502b14 - __libc_start_main

@fitzgen fitzgen added the bug label Dec 21, 2016
@fitzgen
Copy link
Member

fitzgen commented Dec 21, 2016

Thanks for the bug report :)

@jsgf
Copy link
Contributor Author

jsgf commented Dec 22, 2016

Here's a minimal repro:

Command: bindgen fbinit.i -- -x c++ -std=c++14

fbinit.i:

namespace std
{
  template < class > class fbstring_core;
}
typedef char uint8_t;
namespace std
{
  template < class > class fbstring_core
  {
    typedef uint8_t category_type;
    enum Category:category_type;
  };
}

@emilio
Copy link
Contributor

emilio commented Dec 22, 2016

See #357, thanks for the report and the test case, they're invaluable! :)

bors-servo pushed a commit that referenced this issue Dec 23, 2016
Multiple cleanups and fix for #355

Fixes #355

Also improves the output of #354.

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

No branches or pull requests

3 participants