Skip to content

cannot find type i32 in module std::os::raw #1025

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
ctaggart opened this issue Sep 23, 2017 · 1 comment
Closed

cannot find type i32 in module std::os::raw #1025

ctaggart opened this issue Sep 23, 2017 · 1 comment
Assignees

Comments

@ctaggart
Copy link

ctaggart commented Sep 23, 2017

Input C/C++ Header

template <typename> class a {
  enum {};
};
template <typename> class b {};
namespace octave {
class c {
  b<a<char>> d;
};
}

Bindgen Invocation

~/rust-bindgen/target/debug/bindgen \
    --output __bindgen.rs \
    --enable-cxx-namespaces \
    --use-core \
    __bindgen.ii \
    -- -v -x c++ -std=c++11

Actual Results

How do I pretty print this on multiple lines like it used to?

/* automatically generated by rust-bindgen */

# [ allow ( non_snake_case , non_camel_case_types , non_upper_case_globals ) ] pub mod root { # [ allow ( unused_imports ) ] use self :: super :: root ; # [ repr ( C ) ] # [ derive ( Debug , Copy , Clone ) ] pub struct a { pub _address : u8 , } pub type a__bindgen_ty_1 = :: std :: os :: raw :: i32 ; # [ repr ( C ) ] # [ derive ( Debug , Copy , Clone ) ] pub struct b { pub _address : u8 , } pub mod octave { # [ allow ( unused_imports ) ] use self :: super :: super :: root ; # [ repr ( C ) ] # [ derive ( Debug , Copy ) ] pub struct c { pub d : root :: b , } # [ test ] fn bindgen_test_layout_c ( ) { assert_eq ! ( :: core :: mem :: size_of :: < c > ( ) , 1usize , concat ! ( "Size of: " , stringify ! ( c ) ) ) ; assert_eq ! ( :: core :: mem :: align_of :: < c > ( ) , 1usize , concat ! ( "Alignment of " , stringify ! ( c ) ) ) ; assert_eq ! ( unsafe { & ( * ( 0 as * const c ) ) . d as * const _ as usize } , 0usize , concat ! ( "Alignment of field: " , stringify ! ( c ) , "::" , stringify ! ( d ) ) ) ; } impl Clone for c { fn clone ( & self ) -> Self { * self } } } # [ test ] fn __bindgen_test_layout_b_open0_a_open1_char_close1_close0_instantiation ( ) { assert_eq ! ( :: core :: mem :: size_of :: < root :: b > ( ) , 1usize , concat ! ( "Size of template specialization: " , stringify ! ( root :: b ) ) ) ; assert_eq ! ( :: core :: mem :: align_of :: < root :: b > ( ) , 1usize , concat ! ( "Alignment of template specialization: " , stringify ! ( root :: b ) ) ) ; } }

Expected Results

Instead of

pub type a__bindgen_ty_1 = :: std :: os :: raw :: i32 ;

It would be

pub type a__bindgen_ty_1 = i32 ;

or

pub type a__bindgen_ty_1 = :: std :: os :: raw :: c_int ;
@emilio
Copy link
Contributor

emilio commented Sep 24, 2017

This is a regression from 0df8441, astonishing that we hadn't found it before. Thanks a lot for the report!

bors-servo pushed a commit that referenced this issue Sep 25, 2017
codegen: Avoid generating wrong type for enums with unknown representation

Fixes #1025
bors-servo pushed a commit that referenced this issue Sep 25, 2017
codegen: Avoid generating wrong type for enums with unknown representation

Fixes #1025
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