Skip to content

Do not evaluate variadic template types #284

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

Merged
merged 1 commit into from
Nov 21, 2016

Conversation

fitzgen
Copy link
Member

@fitzgen fitzgen commented Nov 19, 2016

This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes #283

r? @emilio

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@fitzgen fitzgen force-pushed the dont-eval-variadic-templates branch from 04384c3 to 80ac773 Compare November 19, 2016 00:25
@fitzgen
Copy link
Member Author

fitzgen commented Nov 19, 2016

Rebased and fixed the merge conflict :)

@fitzgen fitzgen force-pushed the dont-eval-variadic-templates branch from 80ac773 to e3649e2 Compare November 19, 2016 00:26
This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes rust-lang#283
@fitzgen fitzgen force-pushed the dont-eval-variadic-templates branch from e3649e2 to 1c18ec7 Compare November 19, 2016 00:38
// `CXType_Unexposed` from evaluation.
let mut found_cant_eval = false;
cursor.visit(|c| {
if c.kind() == CXCursor_TypeRef && c.cur_type().kind() == CXType_Unexposed {
Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW I don't think recursing here is needed given the callers. Probably something like:

if cursor.semantic_parent().kind() == CXCursor_ClassTemplate

Could be enough for our use case, but anyway it's fine.

Please add in the comment the issue number, and add a comment in new saying that this could be relatively expensive to call if mis-called.

r=me in any case. Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

The semantic parent ends up being a CXCursor_VarDecl and then that cursor's semantic parent is a CXCursor_ClassTemplate. I think the existing check is probably better than looking for a VarDecl -> ClassTemplate inheritence, although neither is satisfying.

@fitzgen
Copy link
Member Author

fitzgen commented Nov 21, 2016

@bors-servo r=emilio

@bors-servo
Copy link

📌 Commit 1c18ec7 has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit 1c18ec7 with merge 94fff83...

bors-servo pushed a commit that referenced this pull request Nov 21, 2016
Do not evaluate variadic template types

This is a workaround for an internal clang assertion that gets triggered
if we try to evaluate a variadic template type reference.

Fixes #283

r? @emilio
@bors-servo
Copy link

☀️ Test successful - status-travis

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.

4 participants