Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add const generics to infer (and transitive dependencies) #59008
Add const generics to infer (and transitive dependencies) #59008
Changes from all commits
f1c83de
cafa10d
2254727
77447de
d7fdeff
0728b62
14f906f
d4e0951
05ac3ac
b9b9994
7d71a1c
bfc39b9
69423b3
d113ff8
3f675ab
ed3dae4
ef1b2ac
7bf175f
bd2fa22
e965b75
c13aa09
57d3a5a
fa394c2
cf1a719
245a474
f5712d2
e70797b
2308d2d
c888af5
fc16b0a
d8b9387
f241693
972e254
5cf45bc
67176f7
97c0c66
b872e63
d8b1ddb
388f823
beb2f84
a29eca5
c7deb5b
16d6ee3
a188850
1369132
541de81
a68ed06
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Sounds like
PlaceholderConst
should contain the type.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.
Yeah, it probably should. The reason I didn't do it earlier was it ended up propagating
<'tcx>
everywhere and I wanted to make sure it was definitely necessary before going down that route.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 attempted propagating
<'tcx>
around when originally addingCanonicalVarKind::Const
and found it to be impossible becauseCanonicalVarInfo
s are allocated in the global arena.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.
Sound like we need to bother @nikomatsakis.
But also, aren't const types supposed to be always be "global"?
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.
AFAIK, types are only global after they have been lifted and their dependencies on type parameters and such are taken care of.
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.
Type parameters are "global" in this sense, only inference variables aren't.
I'm saying that I don't think we should ever have a constant value in the type system with an uninferred type.
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.
Hmm. Something feels wrong here indeed. I'm trying too put my finger on what it is. I guess in short I don't like the idea of there being a type in the canonical-var-info -- I feel like types should in the canonicalized value.
I think what I would expect is that the placeholder doesn't replace the entire
ty::Const
, but rather just theConstValue
. In this way, it can be instantiated without needing the type.(Similarly, in the existential case that appears above, you wouldn't make a "Fresh type variable" to represent its type -- that also seems wrong.)