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

codegen: Do the same workaround we do for template parameters with typename on aliases for decltypes we can't resolve. #384

Merged
merged 1 commit into from
Jan 30, 2017

Conversation

emilio
Copy link
Contributor

@emilio emilio commented Jan 6, 2017

@emilio
Copy link
Contributor Author

emilio commented Jan 6, 2017

Actually, fitzgen was on vacation IIRC, want to review this @nox?

inner_canon_type.name().map_or(false, |name| {
name.contains("decltype ") ||
name.contains("decltype(")
}) {
Copy link
Member

Choose a reason for hiding this comment

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

We should never have any spaces or parens for named types, regardless of decltype or typename.

What we want here is a generic check that this named type is a valid C++ identifier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tend to agree with this. My thinking was that given this is the exception, and not the norm, I think we want to know when can we generate these incorrect bits before skipping them.

I'm fine tweaking this to be a generic identifier check though, I guess.

@bors-servo
Copy link

☔ The latest upstream changes (presumably #414) made this pull request unmergeable. Please resolve the merge conflicts.

@fitzgen
Copy link
Member

fitzgen commented Jan 30, 2017

@emilio were you going to circle back to this?

We do the same for template parameters with `typename` on aliases.

This is not great, but it's better than generating invalid code.
@emilio
Copy link
Contributor Author

emilio commented Jan 30, 2017

Whoops, forgot about this, there you go :)

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.

Thanks!

}
_ => false,
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Would be great to have a small #[test] unit test, or a doc test. Just for sanity.

Ok as a follow up, or as an issue marked E-Easy.

Copy link
Member

Choose a reason for hiding this comment

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

r=me with your decision on what to do about ^

@emilio
Copy link
Contributor Author

emilio commented Jan 30, 2017

@bors-servo r=fitzgen

Will open an E-easy :)

@bors-servo
Copy link

📌 Commit f4d4994 has been approved by fitzgen

@bors-servo
Copy link

⚡ Test exempted - status

@bors-servo bors-servo merged commit f4d4994 into rust-lang:master Jan 30, 2017
bors-servo pushed a commit that referenced this pull request Jan 30, 2017
codegen: Do the same workaround we do for template parameters with `typename` on aliases for `decltypes` we can't resolve.

r? @fitzgen
@emilio emilio deleted the decltype branch January 30, 2017 18:48
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