Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign uptypeck should safe-guard against types with un-substituted formals #13139
Comments
pnkfelix
referenced this issue
Mar 25, 2014
Closed
typeck::check::check_item's ItemFn handling should subst more #13140
flaper87
added
the
A-typesystem
label
Mar 26, 2014
This comment has been minimized.
This comment has been minimized.
|
The way I had planned to solve this is to use distinct types for "types that may contain inference values" and "types that do not". I actually had a branch of rustc a couple of years back building that did precisely this. The basic idea is to parameter
This way, the types of an ast item are distinct from those used during inference. You can write folders and so on generically over T (in fact, lacking default methods, this was INCREDIBLY PAINFUL which is part of the reason I never tried to land the branch, but it should be easier now). You can see some of the groundwork from this branch still:
But one of the challenges I remember was having to find the right canonicalization scheme. I just didn't canonicalize during inference but instead allocated fresh |
This comment has been minimized.
This comment has been minimized.
|
Triage: I'm not familiar with the relevant internals here and #5121 is closed, so I'm not sure what is still left to do here. |
This comment has been minimized.
This comment has been minimized.
|
Nothing has really changed. Still a sort of "nice to have" refactoring though I think, most likely, we'd want to just roll this into whatever "next generation" design we come up with for type checking. |
This comment has been minimized.
This comment has been minimized.
|
Triage: no idea if this has changed in the last year. |
pnkfelix
added
the
T-compiler
label
Nov 7, 2015
brson
added
P-low
I-wishlist
labels
Apr 11, 2017
This comment has been minimized.
This comment has been minimized.
|
@pnkfelix @nikomatsakis is this valuable to have open? |
This comment has been minimized.
This comment has been minimized.
|
I think we can close this. |
pnkfelix commentedMar 25, 2014
Spawned off of #5121.
Part of the bug underlying #5121 lay dormant for quite a while because some of the type-checking machinery is not as aggressive as it could be about ensuring that the types it is checking actually correspond to concrete types.
In particular, in a concrete function type, the bound-type/lifetimes (i.e. the "formals" in P.L. speak) from the function's signature have been replaced with other concrete types (i.e. the "actuals").
Currently, the
tyrepresetnation does not really distinguish between formals and actuals except for lifetimes. But nonetheless, we can at least safe-guard against this problem in that case (and presumably if we later changetyto between distinguish between formal/actual for type variables as well, then similar checks would go into the same place, probably).