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

Generate properly mangled test names #723

Closed
Manishearth opened this issue May 26, 2017 · 2 comments
Closed

Generate properly mangled test names #723

Manishearth opened this issue May 26, 2017 · 2 comments

Comments

@Manishearth
Copy link
Member

Currently bindgen generates a lot of tests like so:

    #[test]
    fn __bindgen_test_layout_nsTArray_instantiation_34() {
        assert_eq!(::std::mem::size_of::<root::nsTArray<root::nsCString>>() ,
                   8usize , concat ! (
                   "Size of template specialization: " , stringify ! (
                   root::nsTArray<root::nsCString> ) ));
        assert_eq!(::std::mem::align_of::<root::nsTArray<root::nsCString>>() ,
                   8usize , concat ! (
                   "Alignment of template specialization: " , stringify ! (
                   root::nsTArray<root::nsCString> ) ));
    }

The number is there because there is such a test for each T that is used as nsTArray<T>. Furthermore, the counting is global -- adding another instantiation will renumber all such tests, not just the array ones. This means that nontrivial binding updates are very prone to bitrot.

Instead of numbering this we should do something like fn __bindgen_test_layout_nsTArray_lt_nsCString_gt_instantiation. Basically, some mangling scheme that can reliably produce unique names.

cc @emilio

@fitzgen
Copy link
Member

fitzgen commented Jul 21, 2017

Was this fixed in #829 ? @Manishearth @emilio

@Manishearth
Copy link
Member Author

Lol yeah looks like I filed this is twice

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

No branches or pull requests

2 participants