-
Notifications
You must be signed in to change notification settings - Fork 183
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
const generics support #393
Conversation
@nikomatsakis I guess this is ready for review, I can't really think of something to make it nicer. As for the parser, I want #394 to land before I add proper name resolution to lowering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, but skipped most of chalk-solve in my review since I don't understand half of it 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left misc nits but this all looked basically correct to me
3244583
to
03d5e1d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we're still waiting on
work list extracted
Anything else? I haven't done a look, so some of those may be fixed, I mostly wanted to change it so that, in the list of PRs, this one was listed as "changes requested".
We have two things we haven't decided on what to do with: |
Work list:
|
So, I implemented const types by adding a) b) is not really "fixable" I think; If you have ideas on how to design this better, I would like to hear them. @jackh726 @detrumi I would appreciate if you took a second look at the pr if you have time |
One more of my concerns is const type unification: it can push lifetime constraints if types are not equal-equal, which is not a big deal maybe, worst case scenario it's kicking the can down the road. I decided to defer dealing with it until subtyping is implemented |
@Areredify I'm kind of confused -- I would expect to have a type like pub struct ConstData<I> {
ty: Ty<I>,
kind: ConstKind<I>,
}
pub enum ConstKind<I> {
Variable, Bound, Value, etc
} and then Was there something with this approach that didn't work? (Modulo having to find a good name for |
@nikomatsakis That's the current setup +
Right now, everything works, my concern is more of "maybe is there a way to design this better" |
@Areredify I'm not sure what you mean by "current", I guess, but it seems like the setup I laid out is not what you described. In particular, I don't understand why the EDIT: I guess I didn't make it totally clear, but I expect pub enum ParameterKind<T, L, C> {
Ty(T),
Lifetime(L),
Const(C),
} in addition to pub struct ConstData<I> {
ty: Ty<I>,
kind: ConstKind<I>,
}
pub enum ConstKind<I> {
Variable, Bound, Value, etc
}
type Parameter<I> = ParameterKind<Ty<I>, Lifetime<I>, Const<I>>; |
@nikomatsakis Because we use
|
@Areredify Why do we need |
To instantiate universal binders correctly, for example, it's a strange situation when your constants (in unverse sense) are not typed |
84bdaac
to
9dee20a
Compare
rebased against the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave this a quick read. Thanks for factoring out the other PR -- this PR now reads fairly cleanly, I think. At least based on my current reading, everything seems like a fairly straightforward extension. Did anything surprise you or catch your eye while you were rebasing?
@nikomatsakis locked and loaded; I think there is a suspicious place that we probably should save for later: specialization rules for consts say that literals are more specific than anything else, but in this pr I ignore that. Other than that, I can't think of anything |
No description provided.