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

ir: When something has a definition, return unresolved type references until we parse it. #926

Merged
merged 4 commits into from
Sep 5, 2017

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Aug 23, 2017

This fixes #888

@emilio
Copy link
Contributor Author

emilio commented Aug 23, 2017

r? @fitzgen

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything makes sense and seems good to me, except that A_C -> C change, which I think needs to be fixed.

src/ir/item.rs Outdated
let definition = cursor.definition();
let applicable_cursor = definition.unwrap_or(cursor);

if definition.is_some() && definition != Some(cursor) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Care to plop the commit message as a comment right here? I think that would help future readers of this code.

@@ -73,6 +53,26 @@ fn bindgen_test_layout_A() {
impl Clone for A {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Default, Copy, Hash, PartialEq, Eq)]
pub struct C {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still be A_C though, shouldn't it? I don't think this change is desirable.

class A {
public:
    int member_a;
    class B {
        int member_b;
    };

    class C;

    template<typename T>
    class D {
      T foo;
    };
};

class A::C {
  int baz;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch here, thanks! I'll take a look tomorrow when I have the time.

…s until we parse it.

This ensures that we see all the relevant types that are defined when parsing
the definition, avoiding problems like rust-lang#888.

Fixes rust-lang#888
@emilio
Copy link
Contributor Author

emilio commented Sep 4, 2017

I fixed that bit, can you re-review @fitzgen?

Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@fitzgen
Copy link
Member

fitzgen commented Sep 5, 2017

@bors-servo r+

@bors-servo
Copy link

📌 Commit 8ecb50a has been approved by fitzgen

@bors-servo
Copy link

⌛ Testing commit 8ecb50a with merge d23db77...

bors-servo pushed a commit that referenced this pull request Sep 5, 2017
ir: When something has a definition, return unresolved type references until we parse it.

This fixes #888
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: fitzgen
Pushing d23db77 to master...

@bors-servo bors-servo merged commit 8ecb50a into rust-lang:master Sep 5, 2017
@bors-servo bors-servo mentioned this pull request Sep 5, 2017
@emilio emilio deleted the issue-888 branch October 28, 2017 16:13
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 this pull request may close these issues.

Global enum in the wrong namespace
4 participants