Skip to content
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

Layout tests can still contain id in its name #871

Closed
upsuper opened this issue Jul 31, 2017 · 0 comments · Fixed by #872
Closed

Layout tests can still contain id in its name #871

upsuper opened this issue Jul 31, 2017 · 0 comments · Fixed by #872

Comments

@upsuper
Copy link
Contributor

upsuper commented Jul 31, 2017

Input C/C++ Header

template<typename T>
class nsTArray {
  T* m;
};

struct Foo {
  nsTArray<int*> m;
};

Bindgen Invocation

$ bindgen input.hpp

Actual Results

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct nsTArray<T> {
    pub m: *mut T,
    pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Foo {
    pub m: nsTArray<*mut ::std::os::raw::c_int>,
}
#[test]
fn bindgen_test_layout_Foo() {
    assert_eq!(::std::mem::size_of::<Foo>() , 8usize , concat ! (
               "Size of: " , stringify ! ( Foo ) ));
    assert_eq! (::std::mem::align_of::<Foo>() , 8usize , concat ! (
                "Alignment of " , stringify ! ( Foo ) ));
    assert_eq! (unsafe {
                & ( * ( 0 as * const Foo ) ) . m as * const _ as usize } ,
                0usize , concat ! (
                "Alignment of field: " , stringify ! ( Foo ) , "::" ,
                stringify ! ( m ) ));
}
impl Clone for Foo {
    fn clone(&self) -> Self { *self }
}
#[test]
fn __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_9_close0_instantiation() {
    assert_eq!(::std::mem::size_of::<nsTArray<*mut ::std::os::raw::c_int>>() ,
               8usize , concat ! (
               "Size of template specialization: " , stringify ! (
               nsTArray<*mut ::std::os::raw::c_int> ) ));
    assert_eq!(::std::mem::align_of::<nsTArray<*mut ::std::os::raw::c_int>>()
               , 8usize , concat ! (
               "Alignment of template specialization: " , stringify ! (
               nsTArray<*mut ::std::os::raw::c_int> ) ));
}

Expected Results

As can be seen, the layout test is called __bindgen_test_layout_nsTArray_open0__bindgen_ty_id_9_close0_instantiation, where the _bindgen_ty_id_9 is sensible to context, so this can still cause merge conflicts.

bors-servo pushed a commit that referenced this issue Jul 31, 2017
Stablize name of pointer and array

This fixes #871.
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