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

Failing test case w/ replaces and using in namespaces #83

Closed
fitzgen opened this issue Oct 13, 2016 · 3 comments
Closed

Failing test case w/ replaces and using in namespaces #83

fitzgen opened this issue Oct 13, 2016 · 3 comments

Comments

@fitzgen
Copy link
Member

fitzgen commented Oct 13, 2016

cc @emilio

Input:

// bindgen-flags: -- -x c++ -std=c++14

namespace JS {
    namespace detail {
        template <typename T>
        struct Wrapped {
            T t;
        };
    }

    template <typename T>
    struct Rooted {
        detail::Wrapped<T> ptr;
    };
}

namespace JS {
    namespace detail {
        /**
         * <div rustbindgen replaces="Wrapped" />
         */
        template <typename T>
        using Wrapped_simple = T;
    }
}

Output:

/* automatically generated by rust-bindgen */


#![allow(non_snake_case)]


#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Rooted<T> {
    pub ptr: Wrapped<T>,
}

I'd expect there to be a pub type Wrapped<T> = T; in the output.

@fitzgen
Copy link
Member Author

fitzgen commented Oct 13, 2016

In fact, this also fails, is a little smaller, and does not involve replaces="..."

// bindgen-flags: --emit-clang-ast -- -x c++ -std=c++14

namespace JS {
    namespace detail {
        template <typename T>
        using Wrapped = T;
    }

    template <typename T>
    struct Rooted {
        detail::Wrapped<T> ptr;
    };
}

@fitzgen
Copy link
Member Author

fitzgen commented Oct 13, 2016

And everything works ok if we get rid of the namespace detail (although there is no pub type, it just gets inlined directly).

@emilio
Copy link
Contributor

emilio commented Oct 14, 2016

So basically Wrapped is a cursor of a kind we don't handle, I'm looking into it.

fitzgen pushed a commit to fitzgen/rust-bindgen that referenced this issue Oct 17, 2016
bors-servo pushed a commit that referenced this issue Oct 18, 2016
Handle templated aliases.

Fixes #83.

cc @fitzgen
r? @nox
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